71a22fc2be3ee353836f211e0f76e2f71a166b0e
1621
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
71a22fc2be |
command-replay: a play that ends with differing IDs exits 3 with an ids line, apart from a stopped run
A run that played every frame but whose objects' gpuResourceID differ from the recording's exited 1 with an 'error ids' line, the status of a run that stopped: two clean plays read as crashes. It now ends 'ids: played to the end; ...' and exits 3; docs/REPLAY-STREAM.md says so. |
||
|
|
9f2ca244ff |
rt: attachment reads through a copy into a shadow, on a device without the feedback loop
A device whose descriptor limits hold set 1's second elements but that does not report attachmentFeedbackLoopLayout and attachmentFeedbackLoopDynamicState (the UHD 630 on Windows, driver 101.2145) refused every draw that reads an attachment of its own pass through a texture. It now reads through a copy: the one form left on that device, recorded as a known gap. The query: floor::Capabilities::attachment_reads is the descriptor room alone, and the new feedback_loop is the room plus both extensions and features; device creation enables the extensions, features and dynamic-state loader only where feedback_loop holds, so the extension device test's expected list (core().feedback) follows the query unchanged. The form (crate::shadow): an image a draw may read so gets one shadow, same format, extent, levels and layers, made at its first reading draw, homed by the next submission's upload, freed with the image (Free::Shadow) and counted in Gauges::shadows and shadow_bytes. A texture reaching the rendered level and layer reads its own view of the shadow at its second element (index + 65,536), written under the owner rule (Arrays::place_shadow); one reaching neither reads the image at home. The points are the feedback form's: the pass's first reading draw, and a reading draw after a memory barrier after draws (which leaves every shadow holding nothing). At any reading draw the planner copies what the shadow does not hold, as one area per read where what is new is one, with no look-ahead: an own-pixel slot reads the scissor a pixel wider each way, clamped; any other every level and layer its texture reaches. The copy ends the rendering, records one barrier (a global memory barrier, the image's copied ranges to transfer source from the attachment layout or home, the shadow's to transfer destination), the copies and one barrier back, and begins again. Each copy counts in Metrics::attachment_read_copies and attachment_read_copy_bytes, and in bytes_copied. Docs: the rt README (set 1's second elements, the render encoder's copy form, the floor's attachment reads and extension table, the chosen-by-a-query note, and the known gap with the UHD cost: 39.0 to 53.5 us a MiB plus 3 to 8 us a copy, about 12 to 16.5 ms a frame for r3 and 4 to 5.5 ms for b3, from the census's 298.0 and 93.4 MiB a frame), DrawKind::AttachmentRead, REFUSALS.md regenerated and the public signatures blessed. Tests: host unit tests of the planning (tests::shadow) and of the floor's two answers; the device test of attachment reads now runs the copy form where the device has it, asserting its barriers (7), copies (2) and bytes, the live shadow, and the texels, and printing the counters; the level test runs it too, one copy a level. Checks are run on the potluck legs after this commit. |
||
|
|
fe23decd1b |
rt: a constexpr sampler's index under the owner rule, and an object released with work pending
A constexpr sampler's numbering is a placement like any other. Where a sampler state took the index from it, a later pipeline state that numbers the constexpr sampler there took nothing back: it sampled through the program's sampler. Now it places the constexpr sampler there again with every element it holds (Arrays::hold_samplers: under the grants' lock, the owner's additions where it still owns the index, else a placement), and the constexpr sampler keeps its elements' samplers to write them. The consumer chooses constexpr indices and keeps them from the program's sampler states while a state numbering one lives; rt does not check it (rt README, compute pipeline docs). An object the program released while a command buffer that used it is pending is displaced like a live one: a placement at its index takes it at once, and its teardown once the command buffer retires touches nothing it no longer owns (one owner compare for both). Nothing empties an element at the program's release: a committed command buffer still reads the object through its index, which Metal allows. The owner's teardown nulls it. RESOURCE-ID.md states the duty (no work in flight reads a displaced or released object through its ID) and what an element no object owns holds: every element is written at device creation, a null descriptor (nullDescriptor, on the floor) or the array's default sampler, and written back to that when its owner goes. The replay player gave constexpr samplers the lowest free sampler index, the range the stream's named sampler IDs come from, so a program's sampler state could take a constexpr sampler's index. It now gives them the highest free one, outside that sequence (Indices::highest; REPLAY-STREAM.md). Tests: - sampling::every_device_gives_a_constexpr_sampler_s_index_to_the_object_placed_there_last: a nearest sampler state over sample_up's linear constexpr sampler reads nearest; a later state numbering it takes the index back (linear, for both states); the sampler state's going touches nothing; the slot gauge counts the index once. - sampling::every_device_gives_a_released_object_s_index_to_the_next_at_once: a command buffer samples A through SA, signals and waits on the host; A and SA are released and B and SB made at their indices while it is pending (asserted); another queue reads B through SB; after the first command buffer retires, and A and SA with it, the index still reads B through SB. The writes are valid under UPDATE_UNUSED_WHILE_PENDING with PARTIALLY_BOUND (vkspec: "as long as they are not dynamically used by any shader invocations"): A's dispatch completed before its signal. - replay a_constexpr_sampler_takes_no_index_of_the_sequence. |
||
|
|
fd916e7f99 |
rt: an index has one owner, the texture or sampler placed there last
The consumer's program places a texture at an index a live texture of its own still holds, and releases the older one later (179 placements in one recorded stream, 92 in another). Metal takes it: the later texture takes the ID. rt refused it (IndexInUse). Now Grants keeps one owner word per held index (a HashMap per class, the word given at placement and never again on the device; no list of holders, no refcount, no second bitset). A placement at a granted index always succeeds and makes the placed object the owner; a release vacates the index and empties its elements only where the releaser still owns it, so a displaced object's going touches nothing. Placement and element writes happen under the grants lock in one step (Arrays::place_texture, place_samplers, add_samplers, vacate_texture, vacate_samplers), so the elements always belong to the owner. Where a placement displaces another object, a texture with no storage view writes its storage element null and a sampler writes the arrays it does not use back to their defaults, so nothing stale answers. The descriptor-slot gauge counts held indices: a displacing placement adds none. The same occupancy serves textures, sampler states and constexpr samplers. Constexpr samplers are kept by (index, state words), each with its owner word; a later pipeline state of the same words adds its arrays where the constexpr sampler still owns the index. Refusal::IndexInUse is deleted: nothing Metal refuses remains. A texture now takes its index after its image and views are made, so an index not granted is refused after the image is made and freed at once. The duty: no work in flight reads a displaced object through its ID, as Metal's. rt does not check it. RESOURCE-ID.md and the rt README state the rule and the duty. The harness takes the next index round each class's range (its workloads make far fewer objects than a range holds). The replay player keeps the object placed last per index: a named index an object holds is taken, and the earlier object's release leaves it; with no index free for a constexpr sampler it answers IndicesNotGranted past the range. Tests: grants' an_index_has_one_owner_the_object_placed_there_last (both classes); sampling::every_device_gives_an_index_to_the_texture_placed_there_last (a storage-capable D at 3, a sampled-only A over it, whose placement empties D's storage element: a write through 3 is dropped and D keeps its texels; B storage-capable over A, A dropped; sampling through 3 reads B, writing through 3 writes B; B dropped, sampling through D's ID reads zero; the slot gauge counts 3 once); the sampler states' test places a state over a live one; replay's indices test. REFUSALS.md regenerated, api_signatures loses IndexInUse. |
||
|
|
cc9ab54b86 |
rt: one texture index class, 1 to 65,535, and a storage array as long as the sampled
The consumer hands each guest process texture IDs from one pool (1 to 16,320) and places every texture at its own ID whatever its usage. rt split textures into two index classes by usage (StorageTexture 1..4095 with shader-write usage, Texture 4096..65535 without), so every named sampled-only texture below 4,096 and every storage-capable one above it was refused (IndicesNotGranted), where Metal takes them: 4,818 makings in one recorded stream and 5,707 in another. Now there is one texture class, IndexClass::Texture, 1 to 65,535, with one grant bitset and one occupancy; IndexClass::StorageTexture is deleted. Set 1's storage-image array (binding 1) is as long as the sampled-image array, 65,536 (floor::TEXTURES replaces SAMPLED_IMAGES and STORAGE_IMAGES). A texture with a storage view writes both elements at its index; any other writes its sampled element alone and its storage element stays null; a texture that goes writes both null. Samplers keep their class. Why every floor device holds it: Vulkan's Required Limits (vkspec 56.1, Table 75 and Table 76) give maxPerStageDescriptorUpdateAfterBindStorageImages, maxDescriptorSetUpdateAfterBindStorageImages, the two SampledImages limits, maxPerStageUpdateAfterBindResources and maxUpdateAfterBindDescriptorsInAllPools a minimum of 500,000 on a device that supports descriptorIndexing. The floor's own sums become 2 * 65,536 + maxColorAttachments (131,080 at 8) and 2 * 65,536 + 3 * 4,000 = 143,072, both below 500,000. Every lab capture (2080, 3090, XTX, 780M x2, HawkPoint, RX 550, Iris Xe, UHD 630, lavapipe) reports descriptorIndexing and 1,015,808 or more for each of the six limits. The floor's limit check stays the one gate: no query-chosen size, no second form. Translator: link.rs's identity set 1 sizes binding 1 by IDENTITY_TEXTURES (65,536), the same constant as binding 0, so rt's of_the_device check still matches it. Nothing else in the pipeline interface, binding plan or resource-ID decode assumes a storage index below 4,096: the identity handle is the low word (masked only of bit 31 where the alpha flag rides it), indexing each array's runtime-array variable. The identity domains are reached only from Device::from_queries' profile (rt sets PointerDomain::Identity; the old runtime never does), so Device::new's modules, refusals and notes do not change. SEMANTICS_VERSION 2173: the identity set 1 layout is a binding-plan fact that changed under unchanged keys. Consumers in the tree: the harness and the replay player grant and place every texture in the one class; the player reserves a texture ID in it. Docs: RESOURCE-ID.md's class table (nil, texture, sampler), the rt README (set 1, grants, textures, the fault paragraph, the floor's limits table), IndicesNotGranted's doc (an object at an index not granted, as well as a release) and IndexRange's basis; REFUSALS.md regenerated; api_signatures loses the variant. Tests: sampling::every_device_makes_a_texture_of_any_usage_at_any_index grants the whole texture range, makes a shader-read texture at 2 and a shader-write one at 5,000, and checks one sample_down dispatch against the CPU mean. arrays' fill-past-capacity fills every texture index (a storage texture at 1, views of it at 2..65,535, 128 made again). |
||
|
|
da02260f2b |
Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development` while this branch was in flight, so the copy committed here counted a smaller one. Verified: regenerating at this tip leaves no change beyond the `Generated at` stamp. |
||
|
|
0c6d48aa7b |
replay: the player zeroes each block and heap of the stream once at its making
The live system zeroes a heap's memory once when it is made, so a buffer placed there reads zero where nothing wrote it. The runtime's take_block leaves a block's bytes undefined, and a block it takes again holds a released block's bytes: placed buffers read them where the program read zeros, a resource ID among them. zero_block zeroes [from, len) of a new block through buffers zeroed from their start; from is the extent the runtime zeroed itself, none yet. The device test writes a placed buffer, releases it and its block, and reads zeros from a buffer placed in a block of the same length; the bytes zeroed show both blocks went through it. |
||
|
|
b527ae9f68 |
rt, translator: a step above 1 on a device without supportsNonZeroFirstInstance runs from base instance 0
Vulkan's divisor needs firstInstance 0 where the device does not report supportsNonZeroFirstInstance
(VUID-vkCmdDraw-pNext-09461): lavapipe and the UHD 630 among the lab's devices. The translator
refused the step there under the identity domains, as a Metal draw may carry a base instance, so
those devices lost every draw through such a state, base instance 0 included. The WebGL divisor
stream draws 462 times through its two stepped states, every draw at base instance 0 (it calls no
baseInstance form and draws nothing indirectly).
Now, under the identity domains, fetch_as takes the divisor wherever the profile has
vertexAttributeInstanceRateDivisor and the rate is within maxVertexAttribDivisor; outside them the
step is pulled where the property is missing, as before, so the old runtime's path is unchanged.
divided() names the feature or the limit; its not-implemented arm had no caller left and is gone.
The new runtime marks such a state where the device lacks the property
(Draws::first_instance_zero) and refuses a draw through it at a base instance other than 0,
Gap::Draw { DividedBaseInstance }, before anything is recorded; a draw of no vertices or instances
still records nothing. Indirect draws are not built in the new runtime.
Tests: from_queries_divides_an_instance_step_where_the_divisor_feature_is_enabled (lavapipe and
moltenvk-m3 profiles, with and without the property: an instance-rate binding of divisor 2, both
modules L3-valid; rate 5 past a limit of 4 refused naming it). The device test
every_device_with_the_step_rates_fetches_per_instance_at_rate_2_from_the_base_instance draws from
base instance 0 on every device with the step rates (every texel the first mark) and from base
instance 1 where the property is reported (the second mark), expecting DividedBaseInstance where it
is not, and prints which path ran.
docs/REFUSALS.md regenerated (scripts/refusal-surface/refusal_surface.py): VertexStepRate has one
site. The rt README names the draw refusal on those devices; docs/API.md the identity-domain rule.
|
||
|
|
6f8d3ebc14 |
conformance: record and time vertex-step-rate-instances on the M3 Max
Record mode (job m3-max-46378 at 37f73671dd, an Apple M3 Max, macOS 27.0.1 26A434) took the case's Metal answer: plain Metal ran the pass with no error. Every instance fetched element base + (iid - base) / rate, its count starting at the draw's base instance: - rate 2 from base instance 0: elements 0, 0, 1, 1 (words 0x10, 0x10, 0x11, 0x11); - rate 2 from base instance 5: 5, 5, 6, 6 (a count from instance 0 would read 2, 3, 3, 4); - rate 3 from base instance 0: 0, 0, 0, 1; - rate 3 from base instance 5: 5, 5, 5, 6 (from instance 0: 1, 2, 2, 2). That is Vulkan's divisor, firstInstance + (instanceIndex - firstInstance) / divisor. conformance times --runs 8 --write (same job) wrote both legs' figures: within the 10x margin, the margin reported unjudged (the instrument's floor read 17.77 instrument costs on Metal's leg). The same job's replay on the M3 Max (the old runtime over MoltenVK) reads exact. docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py). |
||
|
|
cecc252f26 |
rt: refuse indirect arguments and indices a placement puts off Vulkan's multiple
The consumer places buffers at any byte of a block, so a buffer's place in its block's VkBuffer
plus a Metal-valid offset can miss the multiple Vulkan reads at. Metal's own rules (an indirect
offset a multiple of 4, an index offset a multiple of the index size) assume a buffer that starts
at an aligned address, as every Metal buffer does; here the absolute offset is what Vulkan sees:
- VUID-vkCmdDispatchIndirect-offset-02710: the offset in the VkBuffer is a multiple of 4.
- VUID-vkCmdBindIndexBuffer-offset-08783: the offset plus the base of the memory range backing
the VkBuffer is a multiple of the index size. A block's VkBuffer is bound at a multiple of the
pool's granule (64 KiB) or at 0 of its own allocation, so the place in the VkBuffer decides it.
dispatch_threadgroups_with_indirect_buffer and draw_indexed_primitives now check the place in the
block (the device copy's, for a Managed buffer with one, which is what the GPU reads) after
Metal's own checks and refuse with the new Refusal::ArgumentPlace { place, alignment }, basis
ours. Nothing is copied to an aligned place: a copy is not a design answer here.
Tests (device cfg): every_device_reads_indirect_arguments_only_at_a_multiple_of_4_of_their_block
places a buffer 2 bytes into a Shared block and shows offsets 0 and 16 refused at places 2 and 18,
then dispatches from a buffer placed at byte 4100 and checks the result;
every_device_takes_indices_only_at_a_multiple_of_their_size_in_their_block places indices 2
bytes into a block and shows 32-bit indices at offset 0 refused (place 2, alignment 4) before
anything is recorded, then draws 16-bit indices from there and checks the texels and the pass's
counts. README's placement contract names the rule; docs/REFUSALS.md regenerated; the API table
gains the variant.
|
||
|
|
c459695b88 |
rt: the consumer places a Managed buffer's device copy, in a Private block it holds, at any byte offset
new_managed_buffer(bytes, copy, length, copied) takes both placements from the consumer: the bytes as (block, offset) in a block the host maps, and on a device that keeps a device copy (has_unified_memory false) the copy as (block, offset) in a Private block the consumer holds, at any byte offset; gpu_address is that block's address plus the offset. rt chooses no layout any more: its copy blocks, COPY_ALIGN, the first fit and the device's copies place list are deleted, and so is the Private block of the copy's own that the copy took where device-local memory had no room. Placement, and so the slack past a buffer's length, is the consumer's: rt writes the copy's length and no byte past it. New typed refusals: ManagedCopyMissing (no copy where the device keeps one), ManagedCopyOnUnified (a copy where it keeps none) and ManagedCopyNotPrivate (a copy in a block that is not Private); a copy range past its block is BufferPastBlock, as for any buffer. managed_spilled_bytes is now per buffer: a copy the consumer placed in a spilled Private block counts its length while the buffer lives. new_buffer shares the range check (placed). The harness places a Managed buffer's device copy as it places a Private buffer of its length and frees both with the buffer. The player places the GPU copy through its places at their current rule, as a Private buffer of the buffer's length: a buffer in a place of its own keeps the copy's place beside its own and gives both back with the same users; a buffer in a stream's block or heap holds the copy's place as its one place. REPLAY-STREAM.md says so. Tests: the two-copy rule places its device copy 4 KiB into a Private block the consumer takes and checks gpu_address there (and, under the spill test, in a consumer take that spills, counted in managed_spilled_bytes); a new device test places the copy at byte 4099 of a Private block filled with 0xA5 and checks the whole block after the copy's creation and after a copy-in of the whole buffer: the copy's bytes at 4099..5099 alone, the consumer's slack write at 5100..5200 and every other byte unchanged; and the four refusals. Every other Managed test places its copy at the start of a Private block of its own (tests::managed::on_device::new_managed). Regenerated docs/REFUSALS.md (scripts/refusal-surface); api_signatures.tsv by hand. |
||
|
|
55c88de862 |
replay: a stream whose header marks its announced bytes recorded keeps its read-backs out of the CPU copies
The recorder now keeps an announce invariant (its header flag bit 0, FLAG_ANNOUNCED_BYTES_RECORDED; the version stays 2): at each didModifyRange: of a Managed buffer, the last m2v.write before it that carries each 4 KiB chunk of the range holds the bytes the program's CPU copy held there, the GPU's that a synchronizeResource: read back included. A player that also plays the read-back into its CPU copy pushes the GPU's bytes where the program put its own back without the stream writing them again, which is how r3's appender lost its count reset at call 4319503 and overran its list. The reader takes the flags, refusing a segment with another bit or with flags unlike the first segment's, and the writer writes them (StreamWriter::with_flags). The player tells the backend before the first call (Backend::announced_bytes_recorded). On a marked stream a synchronizeResource: of a buffer played with two copies leaves the CPU's copy as the stream's writes made it: the new runtime's backend copies the GPU's copy into an aside buffer of its own (one per buffer, in a Shared place, given back at the buffer's release), which a check of the buffer reads from the read-back to its next didModifyRange:; the old runtime's backend moves nothing, and its checks read the GPU's copy as before. An unmarked stream plays as before. Each backend's report says which rule played on its "announced bytes" line, with the read-backs it kept out. docs/REPLAY-STREAM.md takes the flags (section 1), the invariant (section 6) and the player's rule (section 10). Tests: a unit test of the flags (read alike in every segment, refused otherwise); rt_replay device tests of one stream played marked and unmarked: a write of 5s announced, a fill of 9s read back (a check sees the 9s), an announcement with no write after it, then a copy of the buffer and checks: marked, the GPU's copy and the CPU's hold the stream's 5s; unmarked, the 9s read back (the marked test fails on a player that ignores the flag). Check follows. |
||
|
|
264c28feef | translator: a grid tile's edge test runs on every invocation, against the region's last thread, with no branch on the ragged flag | ||
|
|
12b113fa5a |
Re-derive the generated documents at the landing tip
They are generated from the whole case set, and the set grew on `development` while this branch was in flight, so the copy committed here counted a smaller one. Verified: regenerating at this tip leaves no change beyond the `Generated at` stamp. |
||
|
|
428c680bdd |
translator: Device::kernel_observes_partition answers before any lowering
What: Device::kernel_observes_partition(kernel, inputs, budget, entries) answers what CompiledFunction::observes_threadgroup_partition answers for the compile under the same inputs, lowering nothing: from the specialized entry StageEntries holds (or one made there now), ordered for the device as the compile orders it (lockstep's inserted barriers observe the partition). Why: a runtime can then lower only the variant a creation needs: an observing kernel runs at its own size and needs no tiles, an oblivious one runs its grid in tiles. Split from the ragged branch, without its SpecKey::Ragged (ruled out). Tests: engine_identity's the_partition_query_answers_what_the_compile_does: the query equals the compile's answer for an oblivious and an observing kernel on both profiles. API table and API.md. |
||
|
|
370290b92d |
conformance: record and time vertex-constant-step-instances on the M3 Max
Record mode (job m3-max-45736 at f5172d90a3, an Apple M3 Max, macOS 27.0.1 26A434) took the case's two Metal facts: - Plain Metal ran the pass, Completed with no error, over 3 runs folded into one outcome. Every slot a draw's vertex and instance sums reach holds the attribute buffer's first word, 0x10, with its sum, and the one slot they do not reach stays 0xEE..: from vertex 0 slots 0-2 (0x10, 0..2); indices 1-2 at base instance 1 slots 2, 3, 0 (0x10, 2..4); vertex start 2^30 and base instance 2^30 slots 0-2 (0x10, 2^30..2^30+2). So Metal's constant step reads the first element whatever the vertex start, the instance and the base instance, past the buffer's end included. - Metal's API validation let the case run. conformance times --runs 8 --write (same job) wrote both legs' figures: within the 10x margin, the margin reported unjudged (the instrument's floor read 19.59 instrument costs on Metal's leg). The same job's replay on the M3 Max (the old runtime over MoltenVK) reads exact. docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py; --check passes). |
||
|
|
212bba29c6 |
rt: Metal's constant step is a vertex-rate binding of stride 0, on every device
Under the identity domains (Device::from_queries' profile, the new runtime's), Metal's
MTLVertexStepFunctionConstant was refused as Unsupported{VertexStepRate}, needing
vertexAttributeInstanceRateDivisor and vertexAttributeInstanceRateZeroDivisor, which the floor
does not enable. The constant step needs no divisor: it is now a vertex-rate binding of stride 0,
one form, no query, every device.
Vulkan permits it. The specification's "Vertex Input Address Calculation" (28.4) gives a
vertex-rate attribute's address as bufferBindingAddress + vertexIndex * stride +
attribDesc.offset, so a stride of 0 reads the layout's first element for every vertex and every
instance, whatever the base instance: what Metal's constant step reads. A binding's stride has no
lower bound outside the portability subset: VUID-VkVertexInputBindingDescription-stride-00619
bounds it above (maxVertexInputBindingStride) and is the only other rule on it, and
VUID-vkCmdBindVertexBuffers2-pStrides-06209 names 0 among the strides a bind may set. Under the
portability subset (VUID-VkVertexInputBindingDescription-stride-04456: at least
minVertexInputBindingStrideAlignment) link refuses the stride of 0 as
Unsupported{VertexInputLayout}, as it refuses any stride the subset forbids.
Translator, under the identity domains only (lower::access::identity), so Device::new's profile
and the old runtime are unchanged:
- metal::vertex::fetch_as answers Constant with VERTEX rate, divisor 1;
- pipeline::link::vertex::binding_stride emits stride 0 for any fixed-function fetch of a
constant-step layout, keyed on the layout's step rather than on a divisor of 0 (on Device::new's
profile the only such fetch is the divisor-0 one, so its bindings are the same);
- link's check that an attribute the vertex function lists as alike at every vertex of a
primitive is fetched once per instance also takes a constant step's binding, which reads one
element at any rate.
- The per-instance refusal (rate above 1) names exactly what the profile lacks:
vertexAttributeInstanceRateDivisor, else the maxVertexAttribDivisor the rate passes. Its old
text, and Feature::VertexStepRate's, claimed the constant step needed the divisor; both now name
the per-instance step alone.
Docs: docs/API.md (identity-domain vertex input), the rt README's vertex lines, REFUSALS.md
regenerated (the VertexStepRate row and its reach mark no longer name the constant step).
Tests:
- engine_identity_render from_queries_fetches_a_constant_step_at_vertex_rate_with_stride_zero:
on lavapipe (no buffer robustness, no divisor, no supportsNonZeroFirstInstance) ima_vertex's mark
layout at the constant step links to a VERTEX-rate binding of divisor 1 and Static(0), both
modules L3-valid; on moltenvk-m3 (portability subset, minVertexInputBindingStrideAlignment 1) it
is Unsupported{VertexInputLayout}. Fails without this commit (VertexStepRate on both).
- rt draw every_device_fetches_a_constant_step_attribute_for_every_vertex_and_instance: two
instances of a triangle from vertex 1 at base instance 1, the uint mark at the constant step over
four distinct marks: every texel holds the first mark, provoking vertex 1, and its instance (1
above, 2 below). Points are a gap of rt's draws, so the draw is of triangles; the provoking
vertex is vertex 1, so a vertex-rate stride other than 0 would read the second mark, and an
instance step the second and third.
- The Device::new-path tests stay as they were: a_constant_step_links_to_a_zero_divisor_binding_of_
zero_stride, fetch_is_fixed_function_only_when_exact,
a_constant_step_is_a_zero_divisor_only_where_a_zero_stride_is_legal.
|
||
|
|
3cbf244329 |
replay: the new runtime's backend gives textures and sampler states the indices the stream names
The new runtime leaves texture and sampler indices to its consumer. The backend now gives each object the index the stream names where the runtime takes it: a descriptor's or a view's resource index, else the index of the ID the program saw of the object (its first gpuResourceID record, read ahead by the player and handed over before the call that makes it). Otherwise it gives the lowest index of the object's class that no live object holds and the program did not reserve, as Metal's pool hands out a sampler state's ID. A reserved index (reserveResourceIndicesForResourceType:indices:indexCount:) is taken only where the stream names it. Where the runtime refuses a named index (an object of the play holds it, or it lies outside the class), the object takes the lowest free one and the report counts it on the backend's "indices named" line. Released objects give their index back. Before this, a play of a recorded stream on the new runtime reported tens of objects whose gpuResourceID differed from the recording's. Tests: unit tests of the index bookkeeping (Indices), and rt_replay device tests: sampler states made and released past the class's 3,999 indices reuse the released ones; a reserved index is taken only where named; a state takes the ID the program saw. docs/REPLAY-STREAM.md says how the new runtime's backend places textures and sampler states. The same change, on an older base, passed clippy, the replay unit tests and the four rt_replay device tests on lavapipe (m3-max-45671, m3-max-45775). The rebased tree's check follows. |
||
|
|
eb16d34f15 |
matrix: the instructions gate judges the new runtime's own threads, a driver's left beside
The burst rows' whole-process count swung by up to 25 million instructions per run between processes on NVIDIA, all of it in the driver's own "[vkrt] Analysis" thread, while rt's own threads held steady (48-50k instructions per command buffer on the 2080, 23k on the XTX). A gate on the whole count judged the driver. rt now registers the OS id of every thread it starts in Gauges::threads, at one place: the spawn helper device::start, which the reaper, block-maker, submit and completion threads and the cache store's removal thread all start through. A thread holds its slot until it ends. The list is bounded by construction (5 slots), nothing on a commit or submit path reads it, and Device::new's paths are untouched. devtools gains ThreadInstructions (per-thread user-space counters by OS id, a thread that already ended skipped) and this_thread. The harness reads the runtime's thread ids through Device::threads before a row's timed runs, counts them with its own thread, and records own_per_run and others_per_run beside per_run. Every counter read now sits outside the timed wall span. results.py, per the planner's ruling: EXACT, the new runtime's own count at most 1.03 times its stored count (instructions.tsv now holds own counts), ratcheting down; LENIENT, named on every row, the own count at most the old runtime's whole count, old's driver share not separable since the old runtime names no threads. A whole count with no own count fails the row. The base comparison skips the harness's counts: the gate judges them. Verified: scripts/matrix/test_results.py, 42 tests OK locally. Builds and the other suites run on the check job. |
||
|
|
88624689b6 |
replay: the render-command skip test expects the gap as the runtime's Debug prints it
The device run (lavapipe) printed 'Draw { kind: Points }'; the count, frame and call matched.
|
||
|
|
3ec80f3c7d |
replay: a render command the new runtime does not build is skipped, counted, and ends the verdict
The rt backend ended a play at the first render command the runtime answers with a typed gap: r3 stopped at frame 111 on a draw that reads its pass's own target, so nothing past it could be measured. Such a command is now skipped and counted, as a render state the runtime does not build is: `skipped_render_commands`, and a report line for each gap with its count and the frame and call of the first. A dispatch is still skipped only where it names a skipped object. So that a skip can never pass as a result, the player notes where the backend first skipped anything (`Backend::skips`, told the frame and stream position of each call through `Backend::locate`), and `Report::first_skip` holds it. Where it is set, command-replay's skipped line and its last line (`ok` or `error ...`) end `; not a verdict past frame F, call C`. Tests: a player unit test on a backend that skips draws (the first skip's frame and call, the verdict note, none without a skip), and an rt device test where a draw of points after a covering triangle is skipped, counted, named on its line, and the check still matches. |
||
|
|
8b428fe5ed |
matrix: a compute creation row's call alone is shown beside its first use, never judged
The cold-creation split (probe a3318b088f, m3-max-45806/45807/45809/45810) found the old runtime returning from new_compute_pipeline_state before it makes its VkPipeline: no vkCreateComputePipelines runs inside the call, and the driver's compile comes before the first dispatch completes. rt compiles inside the call, as Metal does at newComputePipelineState. A compute creation row's `/first` sample already spans the creation, one dispatch and the wait for it (CreateReport::first_us), so that row compares like with like. The call alone was only in the table's text. The harness now also records it as `harness-<runtime>/<row>/first_call` for a compute state row. The creation processes keep it like the other first samples (FIRST_KEEP matches it as is). results.harness_budget shows it with the median of each runtime's five processes and their ratio, as "shown, not judged: the creation call alone, which old returns from before it makes its pipeline", and never judges it. One process's sample alone is not shown. `/first` and its floors are unchanged. The planner approved this form. Test: test_a_creation_call_alone_is_shown_beside_its_first_use_and_never_judged. Docs: VALIDATION.md's creation and harness budget paragraphs. Verified: nothing yet; the Python suite and the harness build are reported with this sha. |
||
|
|
70dffca0c2 |
Deep threadgroups run as one row: SpecKey::DeepThreadgroup on from_queries, rt keys it on the size
Metal allows 1024 threads along z; a device's maxComputeWorkGroupSize[2] may hold 64 (NVIDIA's), so rt refused a kernel's threadgroup of 1x1x320 (Limit::ThreadgroupShape) and could not play a recorded stream past its frame 216 on any NVIDIA card. One form serves every shape on every device: a threadgroup deeper than DEEP_THREADGROUP (64) runs as one row of its threads. Translator, on Device::from_queries' profile only (ProfileFacts::deep_threadgroups, OneRow; Device::new keeps Axes and is byte-equal): a kernel whose workgroup is its threadgroup (LocalSizeForm::Spec, no compute derivatives) declares the boolean SpecKey::DeepThreadgroup. Its WorkgroupSize is (Deep ? sx*sy*sz : sx, Deep ? 1 : sy, Deep ? 1 : sz), OpSpecConstantOp selects (the WorkgroupSize rule now takes spec-constant operations whose defaults are positive), and its position in the threadgroup Deep ? LocalInvocationIndex unflattened over (sx, sy) : LocalInvocationId. The linear index, workgroup and grid builtins keep their values, so group counts, regions and indirect buffers are untouched. The binder sets it for a region deeper than 64 and checks that region as the flattened tiers' are. MetalDeviceProperties on that profile reports the capped invocations on every axis (1024 on every floor device) instead of the device's per-axis sizes. SEMANTICS_VERSION 2172, ARTIFACT_FORMAT_VERSION 536. rt: the key is a function of the variant's size (size[2] > DEEP_THREADGROUP), so it adds no pipeline and no cache key. choose() takes no device limit: an image-only kernel's deep tile runs whole as one row on every device (it ran whole on RADV/ANV and in tiles on NVIDIA). fits(), ComputeLimits::max_group_size and Limit::ThreadgroupShape are deleted: every workgroup is within the floor by construction (a const assertion). A module that neither flattens nor declares the key is a creation gap. README: the deep form, worst-case pipeline counts, the 50-pipeline line. REFUSALS.md regenerated; API.md; api_signatures blessed; api_surface pins DEEP_THREADGROUP. Tests: the translator runs a barrier-exchange kernel at 1x1x320, 2x3x100, 1x4x256 (deep) and 4x4x4 on the interpreter, checks the evaluated WorkgroupSize, no key on Device::new, the binder's setting on an NVIDIA profile, and the reported maxima; rt's choice tests drop the device limit; the observing-kernel device test adds deep whole, ragged and indirect dispatches; the square test adds a column 256 deep. Verified: built and tested under the check job named in the report. |
||
|
|
5c5ce57119 |
replay: the Managed form comes from the identity of the device the guest makes its objects on
A stream may record more than one device: reims's one-copy recording on the 780M also holds the host window's device on the display GPU, which is not unified. Each segment opens with one identity record per live device in id order, and the player passed every record to the backend, so the last one decided how every Managed buffer was kept, whichever device the guest used. The player now reads ahead which recorded device the guest makes its objects on (the one that most calls making an object have as their receiver, the lowest id of a tie) and takes the Managed form from that device's identity record only. The report names the other devices on a `devices apart from the guest's` line. Test: a unit test with two devices, one unified and one not, the guest on each in turn. |
||
|
|
53274a5352 |
rt: a Managed buffer keeps two copies on every device that is not unified
What: where device-local memory has no room for a copy block, a Managed buffer's device copy is now a Private block of its own, taken through the pool, so it spills to whatever memory type has room like any Private block; where no type has room, new_managed_buffer returns the allocation's out-of-device-memory error (Metal: nil). Before, such a buffer was its Shared range, one copy, on a device whose has_unified_memory is false. Gauges::managed_spilled_bytes counts the bytes of Managed buffers whose device copy is not device-local, while they live; the replay player reports it beside spilled_bytes. The rt README states the cost: on a full discrete card a Managed kernel reads its copy across the host link. Why: the planner's ruling. Metal keeps a Managed buffer's two copies on a discrete Mac: a kernel's write stays in the GPU's copy until a synchronize, and didModifyRange sends the CPU's bytes over it. With one copy, a kernel's write reached the consumer's bytes, and a range named with no CPU write left the kernel's value in place: a program could observe the difference. Tests: tests::managed::every_device_keeps_metal_s_two_copy_rule_for_a_managed_buffer (every device): a kernel takes each word x to 2x+1, the range is named with no host write, a second kernel reads it. Where has_unified_memory is false the consumer's bytes keep the host's words and the reader reads them, and the buffer's address is not its Shared range's; on a unified device the reader reads the kernel's write. tests::spill: the same rule with the Private type's allocations made to fail (the test seam core.fail_private) and the pool's Private blocks spilled; on a device that is not unified the gauge counts the buffer's 256 bytes while it lives and reads 0 after. The api signature table gains the gauge field. |
||
|
|
d2e5edbd60 |
harness and matrix: record the whole process's instructions per run and gate the frame and burst rows on them
The harness now counts each timed run's user-space instructions across the whole process. The counts repeat run to run where the times do not: rt's p50 spread across processes was 0.16 to 0.27%. The matrix gates the frame and burst rows (WALL_ROWS) on those counts, beside the host-time judgement and floors they keep under the GPU-p50 rule. devtools: ProcessInstructions opens one user-space instructions counter per core type with inherit set, so every thread started after it opens counts: the runtimes' and the drivers' threads too. The harness opens it first thing in main, before any device starts a thread, and each timed run records the counted delta. A node that refuses perf_event_open, and every non-Linux host, records none. harness: each row whose runs were not sized prints `M2V-MATRIX instructions harness-<runtime>/<row>/per_run <p50>`. matrix: a frame or burst row with a count on both runtimes passes the instructions gate as well as its time's limit: - it fails when rt's count is over old's; - it fails when rt's count is past 1.03 times the stored count in scripts/matrix/instructions.tsv (one column per driver family, `all` where the legs agree within 3%); - it is named when its count is more than 1% under the stored count, which then ratchets down; - it is named when no count is stored, and is then gated against old alone. The single-kernel rows stay judged on their GPU p50 as before, and every row's count is shown beside its times. The old runtime's harness counts are parked from the per-record instructions-versus-base check, like its times. instructions.tsv starts empty: a matrix run's counts seed it. VALIDATION.md describes the time rules and the gate in one paragraph. Verified: scripts/matrix tests (python3 -m unittest discover, 45 OK) on this Mac, over this rule and the GPU-p50 rule together. Before the rebase, check m3-max-45591 on msi (at c597bb3603) passed clippy x4, nextest for devtools, harness and rt (118 passed, with the process counter's test), and the release harness build. Count job m3-max-45641 on the 2080's node recorded the per_run count of every row on both runtimes except long_4cb, which is sized. |
||
|
|
b2e33dba6d |
matrix: a harness row with a GPU time is judged on it against the old runtime's GPU-time floor
The planner's ruling on the old-against-old GPU-p50 floors. On the XTX, whose host-time floors
reach 1.2-1.3 on the shader rows (8 runs, m3-max-45546), the same runs' GPU p50 spreads 1.004 on
simd_reduce (36.96-37.12 us, host time 44.9-55.8 us), 1.008 on narrow_ints, 1.012 on image_filter
and 1.024 on constexpr_sampling: the host time's spread is the host's, not the card's. So:
- A row with a GPU time on both runtimes is judged on its GPU p50, new over old, against the old
runtime's GPU-time floor on that leg (the new scripts/matrix/gpu-floors.tsv), with its host
times shown beside it. A ceiling applies to the time its row is judged on.
- The frame and burst rows (WALL_ROWS) stay on their host time and its floor, with the
instructions gate: their GPU time spans the gaps between their command buffers and spreads as
widely on several GPUs (1.68 on the Iris Xe's frame_5cb, 1.43 on the UHD 630's
burst_160_shared). gpu-floors.tsv lists no such row.
- CARD_VARIANCE names rows whose GPU time varies on the card itself: the XTX's sampling (GPU p50
16.3-20.3 us over the 8 runs; 1.264 in the earlier 4-run set, m3-max-45424) and
constant_managed (66.8-69.2 or 74.4 us). They are judged like any other row, never fail a leg,
and are named on its line as the card's variance.
- A re-timed run keeps the row's GPU time too (RETIME_KEEP, harness-retime-gpu/), and the re-time
selection chooses by the same measure (RETIME_SELECT with GPULIMITS and WALLRE), so a row judged
on its GPU time is re-timed and judged on its re-timed GPU pairs.
gpu-floors.tsv comes from the runs behind floors.tsv, no new job: the harness of
|
||
|
|
73f24bed7a |
replay rt backend: the report names the first skipped render state and why
A render pipeline state the runtime answers with a typed gap or the translator refuses is skipped and counted, and nothing said which one or why: the replay device test's draw was skipped on every device (legs 45244, 45245, 45246) with skipped_render_states=1 and no reason. The backend now keeps the first such state's object id and the runtime's answer, and its lines print `skipped render states N, the first #ID: WHY`. The device test prints the backend's lines after the player's. REPLAY-STREAM.md names the line. Verified: the next job builds the validation crate in every cfg and runs the replay test on lavapipe. |
||
|
|
e8113811dd |
replay: the rt backend plays render pipeline states, passes and render encoders
The new runtime builds draws (its render encoder, render pipeline and depth-stencil states), so the player's rt backend stops skipping render encoders whole. It plays, on rt's API: - newRenderPipelineStateWithDescriptor:error:, its constexpr samplers numbered as a compute pipeline state's are (one helper, `numbered`, for both); newDepthStencilStateWithDescriptor:; MTLRenderPassDescriptor.new and .renderPassDescriptor with their m2v.setPass, m2v.setColorAttachment, m2v.setDepthAttachment and m2v.setStencilAttachment setter records; - renderCommandEncoderWithDescriptor: and the render encoder's calls the old runtime's backend plays, with the vertex stage's textures and samplers, both stages' bytes, cull mode, winding, blend color, and the draws' instance, base-vertex and base-instance forms. What rt does not build stays skipped and counted, honestly: a render pipeline state rt answers with a typed gap or the translator refuses (skipped_render_states); a parallel render encoder, or a render encoder of a pass that holds what rt's descriptor does not (resolve textures, depth planes, store action options, a visibility result buffer, layered or tile rendering, a skipped texture) or that rt answers with a typed gap (skipped_encoders); and a draw whose pipeline state, bound buffer or texture, or index buffer is a skipped object (skipped_draws). The render pipeline, depth-stencil and pass-key parsing moves from the old backend's descriptors.rs to replay/translator.rs, shared by both backends, as the sampler's is. docs/REPLAY-STREAM.md says what the rt backend plays and counts. Verified: lint of the validation crate (clippy in every cfg, the replay tests, rustdoc); the device test that follows plays a draw on every device. |
||
|
|
0d1a32436b |
vertex input under the identity domains: every attribute in fixed function, no pulled form
Planner ruling 11-18 (final): fixed-function vertex input for every attribute on every device,
the form native Vulkan uses and the fastest measured on every device, one form. Nothing of the
pulled form is taken on Device::from_queries' profile. Before this, the translator's
containment rule (contain::encoding is Check::InShader without buffer robustness) moved every
[[stage_in]] attribute into the shader, a form that reads through a descriptor the identity
domains refuse, so every rt render state with a vertex descriptor was refused as
Unsupported(IdentityDomains).
Translator (metal::vertex::fetch_as, pipeline::link::vertex::resolve), under the identity domains
only (lower::access::identity), so Device::new's profile and the old runtime are unchanged:
- the containment rule no longer moves an attribute: the device bounds the fetch as it bounds
any (no buffer robustness: a fetch outside its buffer reads what the device gives);
- an unnormalized signed-integer format (Char*, Short*, Int*) is fetched in fixed function into
a variable declared int, VertexFetch::SignedFixedFunction (new): Vulkan's numeric-type match
lets a SINT format feed only a signed variable, and the device sign-extends as Metal does. The
module reads the variable's bits by OpBitcast. Elsewhere such an attribute is still pulled and
sign-extended in the shader;
- every case that pulled is a typed refusal by what it needs, never a second fetch form.
Metal's vertex descriptor on the rt floor:
- Maps directly:
- formats: every Metal vertex format to the Vulkan format of its layout and conversion, by the
device's VERTEX_BUFFER format query. 8/16-bit integer formats read into float attributes go
through USCALED/SSCALED, signed integer formats into int variables, UChar4Normalized_BGRA is
B8G8R8A8_UNORM, the 10:10:10:2 formats are A2B10G10R10, and FloatRG11B10 is
B10G11R11_UFLOAT_PACK32. The validation crate's profiles of RADV (780M x2, RDNA3), ANV (Iris
Xe, UHD 770), NVIDIA (Pascal, RTX 50) and lavapipe report VERTEX_BUFFER for all of them but
FloatRGB9E5;
- steps: PerVertex is VERTEX rate; PerInstance at rate 1 is INSTANCE rate;
- offsets and strides: the descriptor's, baked into the VkPipeline.
- No fixed-function equivalent on the floor, so a typed refusal:
- PerInstance rate > 1 and Constant: Unsupported{VertexStepRate}, by query. They need
VK_KHR_vertex_attribute_divisor's vertexAttributeInstanceRateDivisor (plus ZeroDivisor for
Constant) and supportsNonZeroFirstInstance, which the floor does not enable, so it is
refused on every rt device today. Its needs name the missing feature, or the
maxVertexAttribDivisor limit;
- a format the device does not report for VERTEX_BUFFER: Unsupported{Format} with that format
usage, by query;
- FloatRGB9E5: Unsupported{Format}, not implemented, by need. Of the profiles above only
lavapipe's reports it, and its fetch answers 0 for the fourth component, where Metal and
Vulkan give 1;
- an offset or stride off the format's component alignment (Metal takes any byte multiple on
Apple5+), and an offset, stride, attribute count or layout count past
maxVertexInputAttributeOffset, maxVertexInputBindingStride, maxVertexInputAttributes or
maxVertexInputBindings: Unsupported{VertexInputLayout}, with the limit where one is passed;
- PerPatch and PerPatchControlPoint: Unsupported{Tessellation}, as before.
rt: RenderPipelineKind::StepRate is deleted: the translator's VertexStepRate refusal comes first
on every rt device, so no pipeline states a divisor. README: the vertex input bullets, their
refusals, and the known gap that a vertex fetch outside its buffer returns what the device gives.
docs/API.md: the identity domains' vertex input. REFUSALS.md regenerated, with reach marks for the
two new features (VertexStepRate app, VertexInputLayout rare); api_signatures blessed.
Tests:
- engine_identity_render from_queries_fetches_every_attribute_in_fixed_function (lavapipe and
moltenvk-m3 profiles with buffer robustness and the divisor withheld): ima_vertex's float2
and short attributes are R32G32_SFLOAT and R16_SINT, nothing pulled, L3-valid; a rate-2 layout
is VertexStepRate needing vertexAttributeInstanceRateDivisor. It fails without this commit (the
attributes were pulled, then refused as IdentityDomains);
- rt draw every_device_fetches_a_signed_attribute_in_fixed_function: a short of -2 reaches the
fragment's uint output as 0xFFFFFFFE on every texel; a rate-2 layout is refused as
VertexStepRate. The existing stage-in test (vertex buffer and set_vertex_bytes) now makes its
pipeline.
Verified: the next lint job and the device legs on every device.
|
||
|
|
2aabffabb0 |
rt draws: a buffer bound off its argument's alignment is refused before the draw records anything, by the dispatch's shared check
Identity's Refusal::BufferOffsetAlignment (
|
||
|
|
b29fcccdc9 |
rt: the render encoder's draws, its state, and render states that number their samplers
A render encoder now draws. It holds Metal's render state (a pipeline state, the vertex and fragment functions' buffers, bytes, textures and sampler states, one viewport and scissor rectangle, cull mode, winding, a depth-stencil state, the stencil references and the blend color) and records draw_primitives and draw_indexed_primitives as one vkCmdDraw or vkCmdDrawIndexed each, setting the dynamic state that changed and pushing each function's fields in the one push range. Draws take no barrier, as Metal orders none within an encoder. - render: a content's Draws (slots with accesses, push fields, vertex bindings), derived from the translator's interface; a state numbers its functions' samplers through the compute path's numbering (number_samplers), so new_render_pipeline_state takes sampler_ids, and RenderPipelineKind::Samplers goes; DrawInput refuses what a draw does not supply. Vertex strides are baked (the descriptor key holds them): VERTEX_INPUT_BINDING_STRIDE leaves the dynamic states, so a per-bind stride is refused by DynamicState. The line class's pipeline is made at its first draw, a first-use wait. - pass: both store actions store, so a pass can end its rendering early (a memory barrier after a draw that wrote memory, or a copy a draw needs first) and begin it again with LOAD; Pass::begin serves both. - PUSH_STAGES: one constant for the layout's push range and every push. - Device::new_depth_stencil_state; IndexBuffer, Viewport, ScissorRect; Refusal VertexBufferOffset, IndexBufferOffset, ViewportNotFinite, StencilAttachment; Gap::Draw with DrawKind (Points, DepthTest, Viewport, AttachmentFormats, AttachmentRead). - ring: a write answers its block buffer and offset, so set_vertex_bytes feeds fixed-function vertex input. - harness: one sampler_ids for compute and render states. The census of the gb and b2 render contents (m3-max-44704) set the scope: every translated content reads only SlotGuestBase and ConstexprSampler fields, facts AddressAlignment, DeviceAddresses and MovableStorageWrites, no parameter block, writes no memory; 146 of 267 number samplers; 93 have one vertex binding. Tests: host tests for the viewport mapping; device tests for triangles where Metal's clip space puts them (direct, indexed through a scissor, through a viewport; 3 barriers, no pipeline made, no bytes copied), the line pipeline made once, stencil replace and test, a constexpr sampler sampling each texel, stage_in from a buffer and from bytes, and the refusals and gaps. Not yet run. |
||
|
|
813dd5cfd7 |
matrix: jobs sized from whole builds' peaks, and a job short of RAM runs again with twice its room up to the default
The UHD leg of matrix
|
||
|
|
56efbd0e13 |
matrix: the floors measured with the mean statistic on seven legs; the seeded-floor stopgap deleted
scripts/matrix/floors.tsv held floors seeded from old-runtime runs under the nearest-rank
statistic, some of them the old runtime's paired completions read as a fast run (alu 22.066 on
the 780M leg, 19.640 on the Iris). Measured again with the harness of
|
||
|
|
5abbd52c0e |
matrix: the memory pool's blocks gauge fails only on a rise between iterations 100 and 200
The matrix at
|
||
|
|
5422cf1825 | matrix: every row's GPU p50 beside its time; rows passing only on a seeded floor over 1.10 named | ||
|
|
2f362d5f66 | replay: a texture its descriptor marks outside takes none of the program's IDs; a gpuResourceID record of one stops the play | ||
|
|
f1ae24f38d |
replay: the skipped objects' IDs leave the differing count, beside the compute pipeline states' gap
The new runtime's backend skips render pipeline and depth-stencil states, so nothing in its play reads their IDs; b3's play counted 8,082 of them as differing. It now counts them (skipped_resource_ids) and command-replay leaves them out of differing_ids, as it leaves the compute pipeline states' typed gap. The id lines stay. |
||
|
|
de2ce035e9 |
matrix: creation rows timed alone in five processes, per-row floors, an A B B A re-time
The planner's timing rule for the matrix's harness legs: - The harness takes `--skip NAME,...`, and a name ending in `*` in `--only` or `--skip` names every workload it starts. A name that names no workload is an error. - Each runtime's harness run skips the creation rows (`--skip 'create_*'`); they then run alone (`--only 'create_*'`) in five processes per runtime, each with a fresh driver cache and store, so no row before them moves their times. The first process's records are kept whole, its device's gauges at drop renamed to harness-<runtime>/creates/device/... so every key is recorded once; the later processes keep only the creation rows' first samples, as harness-first/<row>/<n>/<runtime> (parked records). - A creation row's first sample (/first, /first_take, /next_take, /first_allocation_total) is judged by the ratio of the medians of its five processes; a single first sample is never red. - A row's limit is 1.03 times the greater of its ceiling and its floor: the widest ratio between two of the old runtime's own runs of the row on that GPU (scripts/matrix/floors.tsv, seeded from store2's noise table's "widest" column; 1002:1900 has no column there, so its floors are 1). Ceilings are unchanged. - A row past its limit is re-timed once, A B B A (two pairs), and fails only if the median of the pairs' ratios is past the limit too. Deterministic counts are untouched. docs/VALIDATION.md describes the new runs and rule. Verified: scripts/matrix/test_results.py, 33 tests OK locally (new: a row within its floor passes, past it but back within on its re-time passes, past both fails; first samples by the median of five, never one alone; the creation processes' sed programs record each key once; the floors table reads). The generated harness_runs shell passes bash -n for a Linux and the Windows leg. The harness's selection tests and lint run in the check job. |
||
|
|
366ff410a3 | replay: the old runtime's backend tells a texture's storage mode too, for the texture_writes line | ||
|
|
48f7079244 |
replay: the report counts CPU writes into Managed textures a committed user may still be using
Whether rt must capture a Managed texture's bytes at replaceRegion (rather than when the GPU copy is next used) turns on how often a program writes one while a command buffer that used it may still be running. The report now says. - The player keeps, from the stream alone (replay/texwrites.rs): the textures and each view's texture; each encoder's command buffer; the textures each command buffer used (an encoder call naming the texture or a view of it, or an encoder made with an MTL...Descriptor object, or one made on such an object, that names one); each texture's latest committed user per queue; and the completions the stream records, which are only the program's CPU waits (waitUntilCompleted of a command buffer or a later one of its queue, waitUntilSignaledValue:timeoutMS: reaching a value one of its queue's command buffers signals). The play itself waits at each commit, so this is the recording's order, not the play's. - At each call on a texture that carries bytes (replaceRegion:...), blobs resolved, it asks the backend whether the texture is Managed (Backend::managed_texture, default None; the rt backend answers from the texture's descriptor) and counts the write, and where a committed user has no recorded completion, counts it by the presents since that user's commit (0, 1, 2, 3+) and names the first eight. - Report::texture_writes (TextureWrites) carries the counts and the report's texture_writes line says them, with the writes into textures whose storage the backend does not tell. REPLAY-STREAM.md section 10 documents the line. Verified: a replay test (Kept backend) writes a Managed texture used through a view by a committed command buffer, before and after a present, writes a texture that is not Managed, and writes again after the CPU waited: 3 writes, 2 with the user not seen complete (one per present bucket), the first two named; clippy and the plays in the check job. |
||
|
|
1d9ceb87c8 |
rt: the compute encoder's use_heap keeps the heap's block for its command buffer, and the new-runtime player plays useHeap
Metal's useHeap: names a heap the encoder's work may reach. rt had no such call, so the player skipped and counted each one. ComputeCommandEncoder::use_heap takes the heap's block number (a HeapRange's block, or the block a placement heap's buffers sit in) and keeps that block in the command buffer until it retires, exactly as use_resource keeps a buffer's block (keep and the new keep_block share one list). Metal states no retention for useHeap:, so keeping is the safe reading. The call declares no access: a kernel that reaches a heap's resources through addresses outside its slots already orders against every write since the last barrier. A number no handle names answers Error::NoSuchBlock, as new_buffer's does. The player's compute encoders now call use_heap with the heap's block, and still skip and count a useHeap: of a skipped object. REPLAY-STREAM.md's skip list and the rt README say so. Test: heap::every_device_holds_a_used_heap_until_its_command_buffer_retires takes a Private block, uses it twice in one encoder (the command buffer holds it once), releases it while the encoder is open (the command buffer still holds it, and a new use of its number answers NoSuchBlock), commits, and waits for the block's last holder to go once the command buffer retires. api_signatures.tsv regenerated (one new method); REFUSALS.md unchanged. |
||
|
|
61f2799088 |
replay: --until-frame, frame lines as each frame ends, and the rt backend's unwritten line
A play that hangs (gb's fault at frame 1095, b2's at 312) wrote no report: report.txt got its frame and end lines only at the play's end, so every hung play left 0 frames in its timing table, and the cold and warm plays of the frames before each fault could not be read. - Player::until_frame(F) stops after frame F's present (frames counted from 0 as Report::frames counts them), completes the work committed so far and reports as at the stream's end; command-replay's --until-frame F sets it and says `until-frame F`. - Player::with_frame_lines(out) writes each frame's lines (Report::frame_lines: its frame and end lines) to out as the frame ends, flushed; command-replay passes its open report.txt and writes the rest at the end (Report::lines_but_frames). Report::lines keeps every line, the completed groups' first. - The rt backend's report gets an `unwritten N` line: the Shared buffers made without bytes that a compute encoder bound or used and whose command buffer committed before any recorded write, upload or GPU pass reached their bytes since their making, with the first few named and the command buffer that read each. It is where a recording that missed the program's writes shows (b2's uniform ring #58725 had no recorded byte in its life). What reaches a buffer: an m2v.write into it, into its block over it or into another buffer of the block over it; a blit or render encoder call naming it or such a buffer (skipped encoders included); the commit of a dispatch binding it. It counts and stops nothing (new_runtime/unwritten.rs, hooks in the make paths, write, release, the encoder calls and the commit). REPLAY-STREAM.md section 10 documents --until-frame, the per-frame lines and the unwritten line. Verified: replay tests for the frame stop and the per-frame lines (Kept backend) and for the unwritten count (the tracker alone: block writes, a blit naming, a write before the commit, a release, a later commit, an alias made later); clippy and the device plays in the check job. |
||
|
|
92f773ba0a |
conformance: record buffer-bind-off-alignment on the M3 Max
Record mode (job m3-max-44847 at 09c51a35ef, an Apple M3 Max, macOS 27.0.1) took the case's two Metal facts: - Plain Metal ran the pass: every step answered Ok, and the command buffer is Completed with no error, over 3 runs folded into one outcome. - Metal's API validation stopped it at the pass: "Compute Function(vwp_words): the offset into the buffer src that is bound at Buffer index 0 must be a multiple of 4 but was set to 2.", and the same for dst at index 1. docs/CONFORMANCE-COVERAGE.md regenerated (scripts/conformance-coverage/coverage.py): 167 case modules, 1,282 recordings. Verified: the recording's facts as listed (read from the file); coverage.py --check passes. |
||
|
|
9bec8a977e |
rt: a dispatch that reaches a buffer bound off its argument's alignment is refused
The planner ruled that the bind-offset mask becomes a typed refusal. The binder pushed a bound
buffer's address, its gpuAddress plus the offset, rounded down to the alignment the kernel takes
it to have (FieldValue::BufferAddress's mask, from RuntimeFact::AddressAlignment), where Metal's
API validation refuses the bind offset ("must be a multiple of 4 but was set to 2" for a uint *
argument, probe vector_access_placement.m in the conformance crate). Plain Metal runs such a
dispatch at addresses of its own: an M3 Max reaches each element at its address rounded down to
the smaller of its alignment and 4. That is not the rounding the binder did for 8- and 16-byte
arguments.
The dispatch now refuses it with Refusal::BufferOffsetAlignment { index, offset, alignment }
before it records or keeps anything. check_alignment runs after the threadgroup size check and
before a kernel without effects returns, so both direct and indirect dispatches take it.
fill_parameters pushes each address as it is. A set_bytes copy sits at a multiple of 16 in the
ring, which every mask divides, so it is never refused.
Docs:
- docs/API.md: the identity-domain paragraph and the section 10 entry (renamed: "A dispatch that
reaches a buffer bound off its argument's alignment is refused"); no case names its slug.
- RuntimeFact::AddressAlignment's doc and the mechanism comment.
- The rt README paragraph and FieldValue::BufferAddress's doc.
- docs/REFUSALS.md regenerated (44 rt refusals); api_signatures.tsv gains the variant's row.
Tests (device, under --cfg m2v_gpu or m2v_cpu_icd):
- every_device_refuses_a_bound_address_off_its_alignment (was ..._rounds_a_bound_address_down_...):
at alignments 2, 4, 8 and 16, each of 17 binds 1 to 15 bytes past a multiple of 16 that the
alignment does not divide is refused and leaves the buffer unchanged, and the same buffer bound
at 48 runs. Without the check every one of the 17 dispatches returns Ok.
- an_argument_bound_off_its_alignment_is_refused (was ..._runs_at_the_address_rounded_down):
the translated vector_word_phases kernels with one argument off its alignment are refused,
naming the index, offset and alignment, and the command buffer completes with every buffer
unchanged.
|
||
|
|
d1e9062b5f |
rt: blocks are ranges of 16 MiB allocations; the block-maker thread allocates only while a class's free bytes run low
The pool handed a take of up to a block length a whole pooled block and kept one ready block per
class, which the block-maker thread made again as soon as a take used it. A 16-byte Shared buffer
took the ready block, and the 16 MiB allocation that followed held the consumer's next pipeline
creation for its whole length on NVIDIA's driver.
Now each block is a range of one of its class's allocations, with its own VkBuffer:
- A take is a kept block of its length, else the first free range that fits, else the start of an
allocation made in the call: 16 MiB, or the block's own length where that is longer. Lengths
round up to 64 KiB (or bufferImageGranularity); a block starts at its length rounded up to a
power of two, up to 2 MiB.
- Device::new makes one 16 MiB allocation per class. After that, the block-maker thread makes
another only while the class's free bytes are under 8 MiB. A take never waits on it for memory.
- A take that no free range fits, while the class keeps blocks of other lengths, allocates at once.
It also asks the block-maker thread to give those blocks' bytes back, after the consumer's hook.
Only when its own allocation fails does it wait for those bytes, then look for a free range once
more.
- An allocation holding no live block is idle. A class keeps its idle allocations while their
bytes plus those of its allocations in use stay at or under the most bytes it had in use over the
last 10 seconds, and within an eighth of its memory type's heap. Past that it frees the oldest,
except the reserve that keeps 8 MiB free. The rule runs at takes and give-backs on an injectable
clock; there is no timer.
- Removed: the dedicated path, fits-and-fills-half, the 256 and 128 MiB idle bounds and the 64 MiB
Private block.
- Metrics: blocks_reused replaces dedicated_blocks_reused. New metrics: block_bytes_made, and the
vkAllocateMemory time on the consumer's threads (count, total, longest) apart from the
block-maker thread's.
Tests:
- Unit: rounding, base alignment, and the window and surplus rule.
- On device:
- the first allocations, and the trigger at 8 MiB free;
- kept blocks taken again with their number, address and mapping;
- an allocation beside kept blocks of other lengths, with their bytes given back;
- the failed-allocation path, at an answered maxMemoryAllocationCount;
- idle allocations following the window down, the reserve kept;
- a seeded 300-step stress of mixed takes and releases across both classes, each step under a
one-minute timeout.
- Tests that took a block of 1 byte and used more of it now take what they use.
- The replay's rt counters read the new metrics.
Verified: cargo fmt; api_signatures blessed; REFUSALS.md regenerated. Clippy, the suites and the
device legs follow as potluck jobs.
|
||
|
|
13bb9a0a4e |
replay: Managed buffers play in the recording device's form, from its identity record or --managed
How a Managed buffer behaves depends on the recording device's hasUnifiedMemory: one copy where it is true (a CPU write needs no didModifyRange), a GPU copy made at the buffer's making and changed only by didModifyRange where it is false. The stream did not say which, and the rt backend always made the runtime's Managed buffer: gb, recorded on a discrete GPU, wrote its no-copy Managed buffers (#368205, #368202, #368214) once before first use with no didModifyRange, so their GPU copies never got the bytes; b2, recorded with unified memory, relies on such writes legitimately. The player now takes the form from the stream's new m2v.deviceIdentity record (it plays as nothing and tells the backend hasUnifiedMemory through Backend::recorded_unified_memory), or for a stream without one from command-replay's --managed one-copy|two-copy. One copy: every Managed buffer plays as a Shared one. Two copies: the runtime's Managed buffer, its GPU copy from the bytes it was made with: a copied buffer's, or the new create-time bytes a no-copy one's making now carries (newBufferWithBytesNoCopy's first argument, a no-copy descriptor's contents). A stream with no identity record gives none, so a no-copy buffer's GPU copy takes the writes recorded before its first use (the commit of a command buffer whose encoder names it). With neither the record nor the setting a Managed buffer stops the play with an error saying so. The report's managed line names the form and its source, counts the Managed buffers and the no-copy ones with contents from first use, not from create, and notes a two-copy recording played on a unified-memory device. REPLAY-STREAM.md documents the identity record, the create-time bytes and the player's rule. Verified: a replay test plays an identity record as nothing and sees the backend told hasUnifiedMemory; the rt paths need a device play (gb on the 3090 next). |
||
|
|
2868c3946d |
rt error: the BufferCopyOverlap variant and its Display arm closed again after the rebase over the b2b copy
Rebasing the render encoder over
|
||
|
|
4d1b0bf113 |
rt: the render encoder, one dynamic rendering a Metal render encoder with its load and store actions one to one
CommandBuffer::render_command_encoder(&RenderPassDescriptor) is renderCommandEncoderWithDescriptor:. It begins one vkCmdBeginRendering (dynamic rendering, in the floor: floor.rs requires vulkan13.dynamicRendering) into the pass's attachments, and end_encoding ends it with vkCmdEndRendering. Load and store actions map one to one (Load/Clear/DontCare, Store/DontCare). A clear color is a float in a float, normalized or sRGB channel (the device converts it), and an integer channel's is truncated toward zero and saturated, NaN 0, as Metal's; rotated formats and A8Unorm held in R8_UNORM go through the format's rotation; a clear stencil keeps its low 8 bits. The render area is the smallest attachment's level, cut to renderTargetWidth/Height where set. Each attachment is one level and slice of a 2D texture, 2D array, cube or cube array of one sample: the texture keeps an identity-swizzled image view of that level and layer, made at the first pass and freed with the texture through the reaper (new gauge attachment_views). A pass orders itself as a blit copy does, two barriers: the first after every earlier command, moving shader-read-only homes to the attachment layout (general and attachment homes render in place) and paying an owed barrier; the second after the rendering, moving them home and making the writes visible to every later command. Refused as Metal's validation stops them: Refusal::AttachmentUsage, AttachmentPlace, AttachmentFormat; past maxColorAttachments, Limit::ColorAttachments. Not built, Gap::RenderPass naming RenderPassKind: a depth attachment, more than one sample, a resolve, a 1D or 3D attachment, the Unknown and CustomSampleDepthStore store actions, a clear of a format only a shader clears, a pass with no attachment. The replay streams' passes (pass census over gb and b2, counts only): one or two color attachments plus a stencil in 11,187 of them, every attachment a level of a 2D texture of one sample, no depth, no resolve, loads Load/Clear/DontCare, stores Store/DontCare. Tests: tests::pass's host tests pin the action mapping and the clear values; on_device clears a mip level of a shader-read texture (moved and back), an integer texture and a stencil, loads and keeps, cuts the area, clears one slice of a 2D array, and counts one pass alone as one submission, three barriers, one pass and no bytes copied; each view is made once and freed with its texture; refusals leave the command buffer open. README render encoder section and known gaps; REFUSALS.md and api_signatures regenerated. Verified: the lint job and the device legs are the check. |
||
|
|
b0e68fd826 |
Delete the folded-tile pipeline: a kernel that is not image-only runs every grid in the remap's tiles
The planner's ruling makes the rule two lines. An image-only kernel that does not observe its threadgroup partition is declared: 16x16x1 on a grid one deep, the grid's tile (grid_tile) on a deeper one, at MultiRegion 0 with the extent test. Every other such kernel runs today's remap: 256-lane workgroups, each one tile the region carries. The fold no longer serves buffer-touching kernels. Image-only kernels used it only where the grid's tile is past the device's maxComputeWorkGroupSize, and that class is too small to keep a form for, so those dispatches take the remap too. The census (replay's job m3-max-44582, both recorded streams): image-only non-observer dispatches whose tile is past a depth of 64 (NVIDIA's, the floor's limit) are 6 dispatches, 1,760 threads in each stream, one (spec, tile) pair of tile 1x1x256. That is 0.0004% of the image-only non-observer threads in one stream and 0.0033% in the other. No tile is past a side of 1,024. Deleted: SpecKey::FoldedTile and the select that took it in place of the region's tile (lower::dispatch), its binder entry, codec tag, signature row and API guide sentence; rt's Variant::fold, Constant::FoldedTile, Choice::fold and Last::fold. The cache versions stay at this branch's single bump (SEMANTICS_VERSION 2171, ARTIFACT_FORMAT_VERSION 535, now for KernelFacts::image_only and the edge test under MultiRegion 0 alone). An image-only kernel's pipeline per tile stays: its workgroup is the tile, so a deeper grid's first dispatch at a tile makes it, and waits once, as the square device test's two-deep dispatch checks. Verified: cargo fmt; docs/REFUSALS.md regenerated (unchanged). The dispatch-choice tests pin a tiling kernel's grids of every depth in the remap's tiles, and a 1,024-deep column in them past a depth of 64. The translator's engine test runs the edge kernel at MultiRegion 0 in 16x16x1 workgroups and at the grid's tile. |