What. a_held_group_goes_before_another_queue_s_submission_handler_runs's record now holds the
kernel submissions made, groups kept and batches grouped since A's commit, read once A was taken
in, B scheduled and X scheduled, and its printed line names them.
Why. On the RX 7900 XTX (RADV) the test found the queues sharing one VkQueue and the driver
merging, yet X was not kept behind A and B (kept 0), where the lane's behind_running_work keeps
its second command buffer there. Which step sent X decides whether the test or the runtime is
wrong; the line said only the end.
Verified: cargo fmt. The XTX run is a potluck job.
(cherry picked from commit 9da06ab3a435d48d4e1991af32e6b62c9f99e399)
(cherry picked from commit c4efae0678220c8cb886ba3622eff89d6d1416b9)
What. a_coverage_chain_through_fetch_keeps_every_block's line for each case now also prints, from
the device's WorkCounts around the case's pass: the render pass instances begun, the splits for
interlocked writes, for a barrier and for a memoryless write, and the draws dropped (still
making or unmade).
Why. The test still loses 8x4 blocks under load on the M3 Max (MoltenVK) in the cases with a
discard, after the split for interlocked writes. Whether the split ran in a failing case, and
whether a draw went missing, decides where to look; the line said neither.
Verified: cargo fmt. The run on the M3 is a potluck job.
(cherry picked from commit 94061430214bfa257f0eb64bfb76bed5aaa752e7)
(cherry picked from commit b2db90a08beda968daec04b4fd548d65b85ec5e3)
What. The probe's header now records its runs: on an M3 Max under macOS 27.0.1, 10 runs of each
case, a command buffer's completed handler reached another queue's waiting scheduled or
completed handler in every run, 7.6 to 9.3 ms after the wait began, b committed first included;
on one queue it never did, the 5 s bound in every run, the two handlers on one thread.
Why. The scheduler's rule for groups and submission handlers cites it.
Verified: the M3 job's output (10 runs of each of the four cases).
(cherry picked from commit 311a41620234505ec7b6d3f7d9dd893d3d0c1dba)
(cherry picked from commit fc26039e6145ba50b180a234cb1ba3d27073192c)
What. A pass that ends with batches held for one kernel submission keeps them held while their
VkQueue runs two or more earlier submissions (Group::keeps). It now sends them instead where a
submission handler the thread runs once its passes end (scheduler::round) is of a command
buffer of another logical queue (Metal command queue) than a batch held:
scheduler::holds_back_another_queue, over the round's handler list and the batches held with
their logical queues. The handlers of the held batches' own queue still keep the group held.
CommandBufferShared::logical_queue reads a command buffer's queue identity for it.
Why. A submission handler runs on the scheduler thread, and a held batch's handlers run as it
is held, before its group goes to the driver. Where two command queues share one VkQueue on a
driver that merges, a batch of one queue held and kept behind running work, and a batch of the
other queue with a handler that waits for the first one's completion joined the group: the
group stayed held until the handler returned, so the handler waited for work its own return let
go (the deallocator lane test on the Iris Xe hit it once, its handler waiting 60 s). Metal does
not do that: on an M3 Max under macOS 27.0.1 (probe cross_queue_handler_waits), a command
buffer's completed handler reached another queue's scheduled or completed handler that waited for
it in each of 30 runs, 7.6 to 9.3 ms after the wait began, b committed before a included. On one
queue it never did (the 5 s bound in each of 10 runs): Metal runs one queue's handlers one at a
time, so the runtime keeps the group there and promises nothing more than Metal.
Cost: a group mixing two queues' batches is no longer kept past a pass in which a submission
handler of one of them runs; it goes then, the batch that joined last included, in one
submission. Measured on a lane (frame_costs_over_imports, the guest's shape) in the runs that
verify this commit.
Docs: group.rs ("Kept while its queue runs earlier work", Group::keeps),
CommandBuffer::add_submission_handler ("Keep it short"), the runtime README's handler entry,
and FAST-PATHS.md's grouped-submission row.
Verified: cargo fmt. Build, clippy and runs (the previous commit's test, without and with this
change; the deallocator lane test as it was) are potluck jobs on the Iris Xe and the XTX.
(cherry picked from commit 8d04b2d15d3cb745363428fdc9acbbb9ca2eb868)
(cherry picked from commit 2cbd8a970905d931b7be39c92fbdd18d6024f62a)
What. A lane test, a_held_group_goes_before_another_queue_s_submission_handler_runs: on two
command queues, X is committed on the first behind running work (A, then B) and held; then Y on
the second, whose submission handler waits for X's completed handler. Where the two queues
submit to one VkQueue on a driver that merges (Iris Xe's ANV, RADV's single graphics queue), X
is kept behind A and B, Y joins its group, and the test asks that X's completed handler reach Y's
handler, that X was kept, and that X and Y went to the driver in one submission before Y's
handler began. A is made longer until it outlasts the handler's start, as
behind_while_a_runs does. Elsewhere X goes before the handler in any case and only the delivery
is asked. Nothing is asked of one queue: Metal never delivers there.
Why. On Metal (M3 Max, macOS 27.0.1, probe cross_queue_handler_waits) a completed handler
reaches another queue's scheduled or completed handler that waits for it, every run; the
runtime kept such a group held behind the handler, so the handler waited for work that only
its own return let go to the GPU. This commit holds the test alone: it fails until the next
commit's scheduler change, where the device groups and shares one VkQueue.
Verified: cargo fmt. Build, clippy and runs are potluck jobs on the Iris Xe and the XTX.
(cherry picked from commit b1560d73d9ba1ca68c511a1fcdbe0e5217468d41)
(cherry picked from commit 2c50ce4b83f36e6cda676c490a4ba1ffefb23318)
What. probes/cross_queue_handler_waits.m: a command buffer `a` with a completed handler and a
command buffer `b` whose handler waits at most 5 s for it, on two queues (b's scheduled handler,
b committed after a and before it; b's completed handler) and on one queue as the control. It
prints whether the completion reached the waiting handler, the statuses and the handlers' threads.
Why. The runtime's grouped submissions run a held batch's submission handlers before the group
goes to the GPU; whether a handler that waits for another queue's command buffer may hold that
command buffer back is Metal's answer to read first (the deallocator lane test on the Iris Xe).
Verified: it compiles (clang -fsyntax-only); its runs are a potluck job on the M3.
(cherry picked from commit f4dde7aa1aef5d6f31c5c1987f42a5af0b0017bd)
(cherry picked from commit 9846145176fd28a87eec55079778f5c6b9f091dc)
The commit before this is nvreds' fix of the mirror of the X32_Stencil8 bug. A Depth32Float heap texture over a
D32_SFLOAT_S8_UINT image presents no stencil, yet its copies took the image's stencil plane: they read the heap's
bytes after the texture's depth (at 16x16, the 256 bytes at 1024..1280) into that stencil and wrote them back.
texel_units now drops every depth or stencil aspect the pixel format does not present. That is one structural test
for X32_Stencil8 and its mirror. A format that presents every aspect of its image moves as before. Heap copies
change, which a stored runtime artifact can see, so RUNTIME_VERSION goes 1952 -> 1953 and the runtime-sources pin
is recomputed: 024636ce2d7c319e5f480b2bc34f665b46092ab83cd58d2ea877342402f97892.
Verified at the tip de0c2f3f27 (on 3dad05d1cb) by nvreds, gem10 11086:
- runtime unit tests heap|texture|stencil|depth 215/215; plain clippy clean;
- the new test fails at the base: Depth32Float took (DEPTH 0, STENCIL 1024), 1280 bytes where 1024 are its own.
No device lane reaches the path on a measured device (none is known to send Depth32Float to the combined image).
The cherry-pick onto 81f3419f6f was clean; this tree is not yet built. api-signatures --check, refusal-surface and
conformance-coverage leave the docs unchanged.
A Depth32Float texture whose image is D32_SFLOAT_S8_UINT (FormatEmulation::DepthInCombined,
taken where D32_SFLOAT does not serve the texture's usages) presents no stencil. Its heap planes
still took the image's stencil: heap_plane_layout iterated texel_units, which dropped only an
unpresented depth. So the copies of a heap shadow, or of a no-copy heap's texture that no image
serves, read the heap's bytes past the depth's planes into that stencil and wrote it back over
them. For 16 x 16 that is 256 guest bytes Metal's texture does not own. The tiled route refused
such an image, because image_element asked for a lone depth unit among copy_units, so the
texture stayed untiled.
texel_units now drops every depth or stencil aspect the pixel format does not present
(metal::format::aspects), the mirror of the X32_Stencil8 rule. image_element's depth arm takes it,
so the image holds Metal's 4-byte depth elements, and held_aspect gives the tiles the depth
aspect alone. Unaudited: whether any measured device's D32_SFLOAT lacks a usage that makes the
runtime take the combined image. The fix is structural either way.
The test a_heap_texture_over_a_combined_image_moves_only_the_aspects_its_format_presents checks
heap_plane_layout at 16 x 16:
- Depth32Float over D32_SFLOAT_S8_UINT: the depth's planes alone, 1024 bytes, as over D32_SFLOAT.
- Stencil8 over S8_UINT, D32_SFLOAT_S8_UINT and D24_UNORM_S8_UINT, and X32Stencil8 over
D32_SFLOAT_S8_UINT: the stencil's alone, 256 bytes.
- Depth32Float_Stencil8: both planes, 1280 bytes.
It also checks that each of those images holds Metal's texels (holds_metal_texels). Without the
fix, the Depth32Float lines fail.
(cherry picked from commit de0c2f3f275b49c5d15d8d68a29af41e4d7e3d7e)
The seven commits before this are ownpixel's carried kept draw. It was in progress at the owner's 11-08 park and
lands under it.
- A render encoder that ends with a rebinding kept draw in a plain first instance leaves its LiveBind and Kept in
its command buffer. The next render encoder takes them where the pass shape, the layers and the under-state
match.
- The carried draw goes through restate, bring-in of the slots bound since, a stale check and a full state
recording into the new VkCommandBuffer.
- Any other call that settles the end lets them go.
- New WorkCounts: kept_draws_carried, kept_draws_carry_dropped_{between,layout,under}, draws_rebound_carried and
draws_carry_stopped{,_stale,_attached,_other}.
Counts and recordings change, which a stored runtime artifact can see. So RUNTIME_VERSION goes 1951 -> 1952 and
the runtime-sources pin is recomputed: 8b28de4fe9b2026ddc99e37d472db0199c4c0a64c1060b6ba26ea70d38762481.
Verified at the tip dd6f32b81b (on 99a11fd507) by ownpixel:
- 780M, gem10 11039, release, composite_costs medians of 9:
- `passes`: frame CPU 3.228 -> 2.694 ms; per pass 29.60 -> 23.49 us; a draw 5650 -> 3597 ns. All 91 later
passes carried, no carry stopped or dropped.
- glass: frame 0.580 -> 0.529 ms, all 7 later passes carried.
- One pass unchanged.
- 780M, debug: runtime device suite 1967/1967; touched tests 65/66 (the one red, a_volume_s_plane_is_an_attachment,
was the base's RADV volume red, fixed on development by c1a825d748).
- MoltenVK touched tests 66/66.
- lavapipe: carried_draws 5/5, draw_again 19/19, lane render tests 36/36.
- Clippy (m2v_gpu, and plain) green at 11106.
The cherry-pick onto a1b2bb1907 was clean. This tree is not yet built; development's round runs it. api-signatures
--check, refusal-surface and conformance-coverage leave the docs unchanged.
The frame's read back, a blit encoder after its last pass, lets that pass's
carried draw go, counted as one between (kept_draws_carry_dropped_between); the
counts expected now hold it. The colors' buffers are all 768 bytes, so a pass
binding another buffer, or the same at offset 256, keeps the bind state's shape
(bind::length_class of 512 to 1023 bytes), as a draw rebound needs: on the M3
(m3-max-10992) the 512-byte and 256-byte buffers' classes differed, and the
carried draw of the other buffer stopped as any rebound draw stops at a new
shape.
Verified: cargo fmt; the runs follow.
(cherry picked from commit dd6f32b81b9e35c5c21f8b0f83868a006d76db05)
Vulkan leaves the rounding of a blend's conversion to an RGBA8Unorm texel to the
device, so the passes' sums are bounded (each pass about 16 in each channel; red,
green and blue alike) rather than pinned; the pixels equal to the same passes in
command buffers of their own stay exact.
Verified: cargo fmt; the runs follow.
(cherry picked from commit b4ac86112c479cf1cfc59ac826107ec02bf20197)
What a carried draw brings in, where it stops and how it is counted, what it
records into the new encoder's instance, and its own count of every-step
checks.
Verified: cargo fmt; comments only.
(cherry picked from commit 4631774de2c2fd29680821de60c3f50c128117fd)
The color groups' assemble call passes no carry: a grouped pass neither carries
nor takes one (render/carried.rs). The build at 44277482a7 missed the argument.
Verified: cargo fmt; the build follows.
(cherry picked from commit 9ff293dc5f0c43e860d635832a678363f418733e)
Passes of the same state in one command buffer rebind the carried draw
(kept_draws_carried, draws_rebound_carried), with the pixels of the same passes
in command buffers of their own, and a blit encoder between each two drops the
carry (kept_draws_carry_dropped_between). A carried draw rebinds the values its
own encoder bound: the same buffer at another offset, and another buffer, each
pass adding its own color in a channel of its own. A slot the next encoder
leaves unbound stops the carry (draws_carry_stopped_stale); a pass of another
layout drops it (kept_draws_carry_dropped_layout); a carried draw that samples
its pass's attachment stops (draws_carry_stopped_attached).
Verified: cargo fmt. The runs follow in their own jobs.
(cherry picked from commit 44277482a74b4332338319b77158cc2dee67c724)
A pass of a composite costs its first draw every step in a fresh encoder: about
12 us of the 35 us a pass takes on the 780M's encoding thread, where each later
draw of the same state is rebound for about 2.3 us. An encoder that ends with a
kept draw that rebinds now leaves its bind state, with its settle, and the kept
draw in its command buffer (render/carried.rs) in place of the device's spares.
The next render encoder of that command buffer takes them where its pass is the
ended one's in everything the settle and the recording read (the same PassShape
and layers, no memoryless color, visibility buffer, sample positions,
extended-range color, rate map or color groups) and where what the kept draw read
that changes with no call is as it was (no no-copy buffer moved, the sampler IDs'
slots, the residency's generation). Any other call of the command buffer that
settles the end lets it go.
The new encoder keeps the carried draw under its own epoch, between, of another
render-state stamp and through no record, and its tables' stamps are the
encoder's first ones. Its first draw of the same state is then rebound: it brings
in every slot the new encoder's calls bound since the opening, stops where the
bind state holds a slot none of them bound (stale: a new encoder inherits no
binding), makes its uses whole, stops where it samples an attachment of its pass,
begins the pass's first instance as every step's first draw does, and records
every state command into the new command buffer, whose record holds none.
Counted: WorkCounts::kept_draws_carried, kept_draws_carry_dropped_between,
_layout and _under; draws_rebound_carried, draws_carry_stopped and
draws_carry_stopped_stale, _attached and _other. In builds with debug
assertions the first carried draw of a command buffer and every second one after
it takes every step and is compared with the rebound (DrawAgain::carries).
Verified: cargo fmt; api_signatures blessed. Build, clippy and the device tests
follow in their own jobs.
(cherry picked from commit 13e996baeb5286d9fe5aa561cd5adc92695d5bf6)
The three commits before this are radvruns' fix for a bug reims hit at pin 27 on Iris: the guest's texture
reservation handed out IDs 1..15 twice.
- Cause: the in-place check's command queue went through queue_place as a program's queue. It made the texture
pool and took the device sampler, so a reservation after it kept the pool's first range (Metal's first-queue
rule), and a sampler reservation after it was ignored. The race goes to the check on Iris, where more check
classes run.
- Fix: the check's queue is now made by Device::own_command_queue_now, and each queue records whom it was made for
(MadeFor). Only a program's queue makes the pool or takes the device sampler, including the place a recovery
re-makes.
The ID answers change, which a stored runtime artifact can see. RUNTIME_VERSION goes 1949 -> 1951, skipping 1950,
which pin 27b (67f9922c3c plus this fix, a separate branch) takes so that no two trees share a number. The
runtime-sources pin is recomputed: e9c0cdabf11dcf274fa1cf9271b9fdc71fddcaa659d3912c2e7e56bbcb095e17.
Verified at the tip ca36de998a by radvruns:
- M3 MoltenVK 11102: clippy under m2v_gpu and m2v_cpu_icd 0; in_place_check, resource_ids, numbered_samplers,
reserved_queues, queue*, device_recovery and caller_queue_writes 72/72.
- 11099 at cdc84aff87: plain clippy 0, runtime suite 1357/1357.
- lavapipe 11103: 73/73.
- The new test, with the check's render queue made before the reservation: textures took 65..96, samplers 18..25,
0 late lines.
- Negative control (base queue.rs and in_place_check.rs): 4/4 runs fail; textures took 1..15 inside the
reservation, samplers 2..9, 1 late line.
Still to run: RADV PHOENIX. The cherry-pick onto 3dad05d1cb was clean; this tree is not yet built. api-signatures
--check, refusal-surface and conformance-coverage leave the docs unchanged.
clippy::field_reassign_with_default under --cfg m2v_gpu and m2v_cpu_icd (M3, job 11099) on the
reservation test's sampler_state.
(cherry picked from commit ca36de998a2f9704ddb1ac75fe333d0dcf1bad94)
The device's in-place check of render targets made its passes' queue with
new_command_queue_now, whose place took Metal's device sampler ID and made the texture pool as
the program's first command queue does (resource_ids.rs). The check runs on its thread while the
program makes its objects, so on a device whose check made that queue before the program's
reservation:
- a texture reservation kept the pool's first range (1 to 15) beside its own, and plain textures
took those IDs again (the consumer's pin 27: 15 of 256 plain textures inside the reserved
range);
- the device sampler ID started the sampler pool, so a sampler reservation was ignored, with a
late-reservation line.
Queues now carry whom they were made for (queue.rs, MadeFor). Device::own_command_queue_now
makes a round-robin queue as new_command_queue_now does, but its places, a recovery's new one
included, touch neither ID rule; the check takes its queue there. The check's draw (CheckDraw)
makes only Vulkan objects and takes no Metal ID. No other runtime-internal queue exists.
The test replaces the one before it, which asserted the wrong mechanism: settle the check, then
reserve texture IDs 1 to 64 and sampler IDs 1 to 16, make 32 plain textures and 8 plain sampler
states, and assert none lands in a reserved range and no late-reservation line is given; the same
with the reservation made as the device is made. It prints whether the check made its render
queue before the reservation, the path the bug needs.
Verification: device runs on lavapipe, Iris and the M3, each with a negative control at the
previous queue.rs and in_place_check.rs, are reported with the branch.
(cherry picked from commit cdc84aff87ef5faee0f4d48bc242862570ea1412)
The consumer's guest IDs are reserved by the device's first call. On Iris at pin 27 the
reservation was ignored as late and plain textures took reserved IDs. This test makes the
device, reserves 1..=64 at once (and, in a second device, once the check has run to its
end), asserts the texture pool had not started before the reservation, and that 16 plain
textures take IDs past it.
Verified: cargo fmt only; runs on Iris and lavapipe next.
(cherry picked from commit ceeb4a56152b7d6d0cda8e905399a109a6ef44ec)
The three commits before this are nvreds' X32_Stencil8 fix, a bug reims found at pin 27. Heap textures of a pixel
format with no depth aspect (X32_Stencil8, and Stencil8 over a combined image) now move their stencil alone. The
test is structural: texel_units is copy_units minus the depth aspect the format does not present. They no longer
announce restricted-depth-upload, which reported a clamp of depths those textures do not hold. A stored runtime
artifact can see that the announcement changed, so RUNTIME_VERSION goes 1948 -> 1949 and the runtime-sources pin
is recomputed: 19dd0107e3c354befc4b67ce969ca4cdfbe494dcb5f10e8fecb9833a3f44ba81.
Verified at the tip 8afe3989e2 (on 242539b584) by nvreds:
- M3 MoltenVK 11016: runtime unit tests (heap, texture, stencil, depth) 320/320; plain clippy clean; heap and
depth lanes 61/61. The negative control fails at the base with "an X32Stencil8 texture announced
restricted-depth-upload".
- lavapipe 11017: the same lanes 61/61.
Not run: Iris. The cherry-pick onto d4184690eb was clean; this tree is not yet built, and development's round
runs it. api-signatures --check, refusal-surface and conformance-coverage leave the docs unchanged.
On the M3 (job m3-max-10983), a_heap_stencil_texture_over_a_combined_image_moves_its_stencil_alone
failed in its Depth32Float_Stencil8 part with "a copy of a depth outside [0, 1]". The layer's
GPU-assisted check reads a copy into a combined image's depth at 5 bytes a texel
(reported_no_depth_outside_0_1). For the 185 depths of a 37x5 copy that is 925 bytes, past the
copy's 740 bytes of depths. A report at a multiple of 4 past them is no depth of the copy. The
first run (10962) reported 6 such reads, all off 4 bytes, so they were set apart; this run
reported one at a multiple of 4. The depths themselves read back as the device stores them,
clamped, in both runs.
The control needs no GPU-assisted check: it asks whether the copy clamps the depth and announces
restricted-depth-upload, and its depths read back answer that. So it now runs on a validated
device of its own, whose layer reports nothing. The X32Stencil8 part keeps the GPU-assisted
check and the strict reading (no misreads set apart), since no copy of it may touch a depth.
(cherry picked from commit 8afe3989e27bc158b1f082d6ee9c0ddc91f556db)
clippy -D warnings on the M3 (job m3-max-10962) found copy_units and ImageAspectFlags unused in
texture/heap.rs since heap_plane_layout takes texel_units.
(cherry picked from commit 094ebe79411a3d7f98df5c0d4991d468681b1625)
An X32_Stencil8 texture in a heap lies over a D32_SFLOAT_S8_UINT image. Its copies between the
heap's bytes and that image already moved the stencil aspect alone, but they decided that from the
format's name (heap_plane_layout, image_element, metal_heap_layout, multisample_tiles). The
announcement at the texture's making decided from the image's format alone
(Texture::degrade_shadowed_depth): a 32-bit float depth image on a device that clamps uploaded
depths. So every such texture with a shadow announced restricted-depth-upload, on MoltenVK and
on any other device without VK_EXT_depth_range_unrestricted, though no depth of it is uploaded.
Metal's X32_Stencil8 has no depth: its 32 bits beside the stencil are padding it never presents.
The decision now comes from the aspects the pixel format presents
(metal2vulkan::metal::format::aspects). texel_units is copy_units minus the depth aspect where
the format presents none. The plane layout, the tiled element check and the tiles' one aspect
(held_aspect) all take it, so any stencil-only format over a combined image moves its stencil
alone. That includes Stencil8 on a device that holds it in one, whose plane layout used to take
the depth plane too. degrade_shadowed_depth announces only for a texture that holds texels in
its image's depth.
The new lane, a_heap_stencil_texture_over_a_combined_image_moves_its_stencil_alone, checks an
X32Stencil8 texture in a Shared placement heap: 37x5 with allowGPUOptimizedContents off and on,
and 64x64 with it on (Metal keeps that one losslessly compressed). The heap's bytes are first
written as NaN patterns, infinities and words outside [0, 1]. A blit reads each stencil as the
byte at Metal's tiled offset. A blit write into part of the texture changes those bytes alone,
and every other byte of the answer is unchanged. No restricted-depth-upload is announced, and
the GPU-assisted layer reports no out-of-range depth copy. A Depth32Float_Stencil8 texture in
the same kind of heap still reads its depth as the device stores it and announces
restricted-depth-upload where the device clamps and the texture is a shadow.
(cherry picked from commit 47fa1b36126645b82a61b204e4000352b3cfe236)
The five commits before this, exitcrash's per-draw CPU work, in progress at the owner's 11-08 park and landed under
it:
- a pass without custom sample positions asks the device nothing;
- end_pass takes each ~2 KiB instance alone;
- inline_first's begin borrows its device;
- composite_costs gains a `joined` shape, the one lane that exercises augment_into;
- an ended encoder's host-alias keys found go to the device's next encoder (at most 8 sets of 256 keys, only those
found at the standing version).
host_alias_lookups and the pass's instruction counts move, which a stored runtime artifact can see. So
RUNTIME_VERSION goes 1947 -> 1948 and the runtime-sources pin is recomputed:
18ae56cb799c595cee3cf629bdc599c35d4d3456e59dacab072c27dfd20a47bd.
Verified at the pre-rebase sha a74139fe4c on um790's 780M (exitcrash):
- clippy -D warnings clean, all targets and features and under --cfg m2v_gpu;
- host_aliases unit tests 19/19;
- the runtime device suite 1960 passed, 23 skipped (hazard and GPU-time tests excluded).
composite_costs `passes` on the 780M: opening+end went 41.6k -> 40.9k instructions and CPU per pass 31.0-31.3 ->
30.2-30.7 us. On `joined`, host_alias_lookups go 184 -> 92 a frame, net about -48 instructions a pass (kept
built-neutral). The rebase onto 1c7a75be62 was clean and touched none of these files; the rebased tree is not yet
built, and development's round runs it. api-signatures --check, refusal-surface and conformance-coverage leave the
docs unchanged.
An encoder kept the keys it looked up under the host aliases' lock (Quiet), each with what a use
of its bytes takes, valid while the aliases' version stands; every new encoder started from none,
so a frame of many passes over the same buffers over host pages looked each key up once a pass.
reims' desktop makes about five lookups an encoder.
The device now keeps up to 8 sets of keys an ended encoder found (each of at most 256 keys, and
only one found at the version that stands); an encoder opening takes the newest. What a key takes
is a function of the buffers joined and placed alone, so the keys hold for any encoder of the
device while the version stands, and the first command that finds the version changed forgets
them, as it did its own. Where no buffer joined a memory and no range is crowded, an encoder
opens with none and takes no lock, as augment_into looks nothing up then.
A correction to 990e587374's body: the buffer going that recomputes `any` is
HostAliases::forget, not HostAliases::release.
Test: an_ended_encoder_s_keys_go_to_the_next_while_nothing_changes (later encoders look none of
the keys up and take what they took; after a placement the next looks its key up again). The
joined shape of composite_costs measures the lookups per frame before and after, on the 780M.
(cherry picked from commit 0475bf383e442917584060ccde127aee56571136)
reims' Iris lanes spend 1.3% of their samples in HostAliases::augment_into,
with 18k lookups a second under the aliases' lock (WorkCounts at its busiest
second: host_alias_lookups 18274, render_encoders_ended 3722), and no lane of
ours reached it: the composite's one no-copy chunk joins nothing, so every
command's augment returns at its first check.
The joined shape draws passes as passes does, while a second no-copy buffer
over the chunk's very bytes lives, as a guest's two textures over one
surface's pages: it joins the chunk's memory, so each command's uses of the
chunk carry the memory's key, through the encoder's Quiet keys or a lookup.
The second buffer is made for the shape's frames alone and goes after them,
so the other shapes run as before (HostAliases::release recomputes any). Its
COMPOSITE-COUNTS line gives host_alias_lookups a frame. The chunk's pages field
loses its underscore: the joined buffer reads them.
Not yet run; a measurement, ignored by default as the lane is.
(cherry picked from commit 393eb8f7c9f2c418b35ca0428729d6aebdb1d18e)
inline_begin and begin_inline each cloned the encoder's Device for the length
of the call: a clone of a program handle is two atomic read-modify-writes (the
generation's Arc and the holds' program count, holds.rs) and its drop two more,
at every pass that begins its first instance inline, which is nearly every
pass. Both now borrow the core's device: inline_begin's last use of it comes
before the core's pass hold, and begin_inline reads only the device's shared
state while it changes the encoder's other fields.
Device clones and drops were 0.74% of the encoding thread of
composite_costs_passes_alone on um790's Radeon 780M, these two among their
sites (render/inline_first.rs:411 and 479 at 67f9922c3c). Not yet measured
after.
(cherry picked from commit 65e0ca54b4598a4c8e3604eeca8d767a5cf96dfe)
end_pass walked the pass's instances zipped with their shadow fills, reformat
copies and moved images, then enumerated. An Instance is 1864 bytes, and each
adapter layer's item copied it again: the line-table build of 67f9922c3c shows
memcpy calls of 1856 to 1976 bytes from the zip and enumerate adapters inside
end_pass, besides the one into the destructuring. Each instance is now taken
from an enumerate of the instances alone, its fills, copies and moves taken
from their own iterators beside it.
Same iterations as before: the fills and copies chain repeats without end, and
the moved images are one an instance, so the walk stops at the last instance
as the zip did, and the loop's break on a missing one is the zip's stop.
memcpy was 8.4% of the encoding thread of composite_costs_passes_alone on
um790's Radeon 780M, end_pass's own calls 1.33%. Not yet measured after.
(cherry picked from commit 52049c92be35292c6ada97ad06f37b6e565bced3)
grid and taken looked the device's sample-location rules up in the profile's
enabled properties (two BTreeSet lookups of VkProperty) before they checked
whether the pass names any position, so every render encoder's opening paid for
them through render_pass::layout. A pass without positions, as nearly all are,
gets the empty grid at once now; the rules are read only where there are
positions to check, and the answer for every pass is the one positioned gave
before (an empty list is Ok(empty) whatever the rules).
Seen in a frame-pointer profile of composite_costs_passes_alone on um790's
Radeon 780M at 67f9922c3c: sample_positions::grid 0.40% of the encoding thread,
0.37% of it the BTreeSet walk. Not yet measured after the change.
(cherry picked from commit 55a9e6e41912c7afb1584f741308532d5105d1f6)
The seven commits before this change what a stored runtime artifact can see:
- sweep: RuntimeDriverDefect::VolumeResolveFirstPlane on RADV, where a colour resolve into a 3D
texture's planes past the first goes through a 2D scratch of the pass's layers copied into the
planes (announced resolve-scratch); on the 780M and the XTX a resolve into any plane wrote
plane 0. Test-only: dma_buf_imports expects the copy RADV makes of memfd memory with no
source; first_use's frame-sized reads are event-gated instead of racing a 2 s busy work.
- nvreds: a multisampled Depth32Float fill clamps each sample's depth into [0, 1] on the CPU
where the texture clamps depth uploads (restricted-depth-upload, depth_uploads_clamped); on
Iris the colour-to-depth copy wrote 0 for a NaN where the notice promised 1.0. Test-only:
draw_work expects a set-0 write only in a draw that bound its pipeline (ANV links both
alternating states as one VkPipeline).
RUNTIME_VERSION 1946 -> 1947; runtime-sources pin
43dea09e84fa5e92afdc42ca0c5572baccc30bb7177f61dcad0efbc28caad275.
Verified at the tips (agents' runs): sweep at dcffee4308 (same commits on an older base):
a_resolve_writes_the_volume_plane_it_names fails on the 780M and the XTX without the fix, passes
with it and on the M3; dma_buf on the XTX; first_use XTX 4/4, M3 3/3; M3 70/70 across
view_attachments, first_use, grouped_submissions, resolves, layered_passes; plain and gpu
clippy clean. nvreds: Iris 10725 sample_fills passes (d32-wide-4 clamped, base control fails),
draw_work passes; lavapipe 10688/10726 and M3 10689/10727. Not yet built on this exact tree;
development's round runs it. api-signatures --check, refusal-surface and conformance-coverage
leave the docs unchanged.
draws_alternating_states_of_one_layout_push_only_what_changed expected every alternating draw past
the first to push at least one set-0 write on a driver whose pushed descriptors go stale across a
pipeline bind (ANV: RuntimeDriverDefect::PushedDescriptorsStaleAfterPipelineBinds). On the Iris Xe
(ANV, RPL-P, probe job 10515) the alternating draws pushed [3, 0, 0, 0, 2, 0, 0, 0], as the first
state's alone did, and recorded no vkCmdBindPipeline past the first draw: the two states, the
second blending with factors one and zero, bound one VkPipeline. Where the RGBA8Unorm attachment
takes a rule of Metal's (color_writes::takes_metal_rule), link gives such a blend no Vulkan blend,
so the two variants link alike. With no bind, nothing goes stale, and the runtime pushes only what
changed (render/bound.rs), which is right.
The test now reads each draw's vkCmdBindPipeline count and expects at least one write only in a
draw past the first that bound its pipeline; every other draw pushes what the first state's
alone does, as before. The println names the draws that bound.
Verified: the Iris probe (10709) is to show the binds and the shared VkPipeline; the lane's run
is reported with the tip.
(cherry picked from commit e879081d2c32cbfa3a8225722c0d90db9d2fb54c)
On Iris Xe (ANV, RPL-P), which lacks VK_EXT_depth_range_unrestricted, the sample_fills case
d32-wide-4 fills a 4-sample Depth32Float texture with 33221100 77665544 bbaa9988 ffeeddcc and
reads back 33221100 3f800000 00000000 00000000. A multisampled fill writes each sample's bits
into an R32_UINT scratch image and copies it into the depth image (maintenance8's colour-to-depth
vkCmdCopyImage on ANV), and Vulkan writes undefined values there for a depth outside [0, 1]: ANV
stores the NaN as 0. restricted-depth-upload, announced once per device on an earlier case,
promises a clamp, a NaN 1.0, that no step made. replace_region and the buffer-copy route clamp
before the copy (depth_clamp.rs); the multisampled fill did not.
sample_fill now clamps each sample's depth word on the CPU (bind::clamped_depth) where the
texture clamps depth uploads, announces restricted-depth-upload for the fill, and counts it in
WorkCounts::depth_uploads_clamped, as replace_region does. A device with the extension writes
the bits as before. The docs of depth_clamp.rs, the counter, the degradation and docs/API.md's
entry name the fill.
The lane: the probe recorded d32-wide-4's digest (9c5b7be066d1c9fc) alone. depth_lines rebuilds
a byte-filled Depth32Float case's lines from the fill rule; the_recorded_lines_are_the_probes
holds the rebuild to that digest and to the recorded d32-4 and d32-2 lines. A Depth32Float case
on a device that announced restricted-depth-upload passes where it holds Metal's lines with every
word through clamped_depth, the fill counted (SAMPLE-FILLS-CLAMPED). Expected on Iris:
33221100 3f800000 00000000 3f800000. The metal.txt fixture, and so the conformance recordings'
input digest, is unchanged.
Verified offline: the rebuilt d32-wide-4 and d32-4 lines hash to the probe's 9c5b7be066d1c9fc
and 2098b9445cd43b96. Device runs (Iris, lavapipe, M3) are reported with the tip.
(cherry picked from commit b3f0f2ba7e176fa1972cb89982f6404375ffd169)
On a Radeon 780M (RADV, Phoenix) a 4x multisampled RGBA8Unorm attachment resolved into depth plane
3 of a 4x4x4 volume, through the 2D view of the plane that resolve::destination attaches, wrote
plane 0 instead (the volume's first byte held the resolve; view_attachments, three runs at each of
two commits, ownpixel's job). Drawing into the same kind of view writes its plane there, and the
usage is valid: a 2D view of a 3D image made 2D_ARRAY_COMPATIBLE "can be used as a framebuffer
attachment that refers only to the specified range of slices" (VkImageSubresourceRange), and of a
resolve attachment Vulkan refuses only a 3D view (VUID-VkRenderingAttachmentInfo-resolveImageView-
12471). MoltenVK on the M3 Max writes each named plane (a_resolve_writes_the_volume_plane_it_names).
RuntimeDriverDefect::VolumeResolveFirstPlane names it, on every RADV GPU until a probe finds one
clean (driver_defects.rs, the table's rule). There a color resolve into a 3D texture's planes past
its first, or into more than one, goes into a scratch image of the pass's layers (Destination::
attach), whose layers ResolveCopies copies into the planes after the pass: one region whose depth is
the layers, from the resolve's first plane (VUID-VkCopyImageInfo2-srcImage-01791, dstImage-04444).
The scratch's copy into a 3D texture was not built before (render_pass::not_2d refused it); it is
now, but for a level reaching past the attachment, whose clear would be of the planes alone, which
stays NotImplemented(Render). Announced as resolve-scratch, its reason naming the defect; the
catalogue and the variant's docs say so. The device's own resolve still averages: the copy moves
its result unchanged.
Tests: tests::driver_defects lists the defect for every committed RADV profile;
runtime_lane::view_attachments::a_resolve_writes_the_volume_plane_it_names fails without the
change on the 780M (to be run with the runtime before it and after, on the 780M and the XTX).
docs/REFUSALS.md regenerated: unchanged.
(cherry picked from commit dcffee430897a499f47155664a8549a248b8a8ad)
(cherry picked from commit 707ef3439b2ca3c5f81f967a1322470da47c0d77)
c46292aad3 kept the busy work alive until released by committing links for WAIT (240 command
buffers of 250 ms on a queue of their own). On MoltenVK that stalls: its Metal queue takes at most
64 command buffers, so the commits past them waited for links that ran their whole cap (the M3
Max's run sat in the test for minutes). The chain is gone; Busy::commit is as before.
Where the texture copies on the host or the staging queue, the busy work (as before, about 2 s)
is now followed on its queue by a command buffer that waits for a shared event the host signals
only once the reads returned, or WAIT passed. The reads run on a thread of their own: a read that
waited for the queue's work would wait for that signal, and the test fails at WAIT; one that waits
for none returns first, however long it takes on the device (1.0 to 1.7 s for a 1080p read from an
RX 7900 XTX's uncached device-local memory), even past the busy work's end, which no longer fails
it. That is cpu_copies_return_while_queued_work_waits_on_a_later_event's gate, at frame size. The
reads that returned while the busy work ran are still the printed distribution under load. Where
the texture copies through submissions the reads wait for the busy work as before.
Verified: to be run on the M3, the XTX and lavapipe; the runs go in the report.
(cherry picked from commit 26bf408ca54b902aeccb3dba9541e5f8e3f945ca)
(cherry picked from commit 601e5cb050b2bd0f684e4850b60fce387f5b50a2)
The volume-plane test resolved into plane 3 alone and stopped at the first byte off, which on a
Radeon 780M (RADV) was plane 0's first: it did not say where the resolve landed, and the layer's
reports were read only after the bytes passed.
a_resolve_writes_the_volume_plane_it_names resolves a 4x multisampled RGBA8Unorm attachment into
each plane of a 4x4x4 volume filled with 0x11, one volume a plane, prints the planes each resolve
wrote (VOLUME-RESOLVE lines), fails on any report of the validation layer, and then checks every
plane: the named one holds the resolve, the others their fill. The plane-3 case Metal measured
(t3d_resolve_plane3) moves here from a_volume_s_plane_is_an_attachment, which keeps its three
drawn planes.
Verified: to be run on the 780M, the XTX, lavapipe and the M3; the runs go in the report.
(cherry picked from commit 5be5c2dd547d0a2d71c7272fb77faf579c4e754e)
(cherry picked from commit a98c4be3dd4fa98a67a8851e13266bbfb9a6c817)
frame_sized_textures_copy_texel_exact read a 1080p texture under 2 s of busy GPU work and
required the first read to return before the work's cap ended it. On an RX 7900 XTX a 1080p
get_bytes from the image's uncached device-local memory takes 1.0 to 1.7 s, so whether the
first read beat the cap was a race of the read's own length against 2 s, and the test failed
at 0b52add1c9 (one of two runs) with no wait for the GPU at all.
Where the texture copies on the host or the staging queue, the busy work now lasts until it is
released after the reads (Busy::commit_lasting: links of BUSY / LINKS each, enough for WAIT,
on a queue of their own that takes them all uncompleted), the reads go on for about BUSY or
LOADED_READS, and every read must return while the work runs. Only a read that waited for the
work sees it end, at WAIT. Where it copies through submissions the reads wait for the work as
before, which ends at its cap.
Verified: to be run on the XTX, lavapipe, the M3 and the 5080; the runs go in the report.
(cherry picked from commit c46292aad36d3abb8fe9f194fdb5908f1d1c9c3e)
(cherry picked from commit 51db8307420ed754c50d18c88cd560151e7880bc)
shared_memory_is_refused_without_a_working_source still expected RADV to refuse a no-copy
buffer over memfd pages made with no dma-buf source. Since 3f69d1af77 the runtime makes that
buffer over a copy of the pages (copied.rs, counted as copied_host_buffers_device_refused), as
Metal makes a no-copy buffer over any page, so the test's first check failed on every RADV
device (an RX 7900 XTX at 0b52add1c9) before it reached the refusals it is about.
The no-source case now expects the buffer on every device: on RADV a copy
(HostBacking::Copied, one copied_host_buffers_device_refused), on NVIDIA and lavapipe the
pointer's import (ImportedByPointer, none counted); a driver not measured has its answer
printed. The rest is unchanged: a failing source keeps the device's refusal and is called
once, short chunks and a chunk that is no dma-buf are misuse, and no dma-buf import is counted.
Verified: to be run on the XTX and the 780M (RADV) and lavapipe; the runs go in the report.
(cherry picked from commit bd6676c26bc68b87707c26f4eea15c12d87ecb60)
(cherry picked from commit dadada31c211c8fccf1f909beb259937bafe3d14)
nvreds' wide-lines change (the commit before this) announces every draw on the device's own
wide-line route (device-wide-lines): RADV's wide lines differ from Metal's parallelogram (the
XTX and the 780M draw 628 pixels at width 2.5 where Metal's has 622), so no device's own lines
are taken as Metal's. Under WideLinePolicy::Exact the band takes the draw where the device
tessellates. A stored runtime artifact can see the new announcement, so RUNTIME_VERSION moves
1945 -> 1946 and the runtime-sources pin is recomputed:
797202448efb78fd8cd016736f5789171d324030e60daa50b363d8aa916f3696.
Verified at the change's tip (nvreds): gem10 lavapipe 10937 runtime unit tests line_width and
degradation 21/21, plain clippy of the three crates clean, line_widths lanes 7/7; gem10 XTX
'1002:744c!' and 780M '1002:15bf!' 10938 line_widths 7/7 each. Not run: the M3 (no wideLines,
route unchanged), Iris (already announced), the 5080 (development's round runs it). On this tree:
api-signatures --check, refusal-surface and conformance-coverage leave the docs unchanged.
RADV fails wide_lines_draw_metal_s_parallelograms and its exact-answers twin at the lane's
"scattered lines width 2.5, fragments" map, 628 pixels where Metal's has 622: on the Radeon RX
7900 XTX (homelab-gem10-1, m3-max-10724) and on the 780M (homelab-um870-1, its only GPU,
m3-max-10773), at this branch's base and at development alike. The runtime took RADV's lines as
Metal's there, unannounced: RADV is the one driver of the committed profiles stating non-strict
parallelogram lines (strictLines unset, nonStrictWideLinesUseParallelogram set), and 2.5 lies on
its 1/8 granularity above 1, so the route was the device's lines under both policies.
Cause, measured: a probe on the XTX (m3-max-10800, a scratch branch, never merged) drew each of
the 48 scattered lines alone and printed its pixels. 21 of them lie a row or a column off Metal's
parallelogram at an end: one more past the first vertex, one fewer before the last. A model of
Metal's rule (endpoints on the 1/256 subpixel grid, the parallelogram whose minor-axis edges are
w' long through them, the ends not extended, pixel centres by the top-left rule) reproduces
Metal's map pixel for pixel; the XTX's ends fit no constant shift of it. Vulkan leaves where a
non-strict wide line's ends fall to the implementation, and no driver is measured to place them
as Metal does.
Change: the device route has no exact form any more (render/line_width.rs route). Every draw the
device's own lines take is announced device-wide-lines, the notice naming "parallelograms, whose
ends and endpoints' snap the driver places as it draws them" where the width is on the grid above
1, and under WideLinePolicy::Exact (exact_answers) the band draws it wherever the device has
tessellationShader. On RADV, widths above 1 on the 1/8 grid move from silent device lines to
announced device lines under the default, and to the band under exact answers. No other profile
changes route: lavapipe and NVIDIA (strict) and ANV (not stated as parallelograms) were announced
already.
Tests: the runtime's route table reads A or B where it read E for the three RADV profiles (Cell::
Exact removed). The validation lane drops LineFacts::draws_as_metal, and asserts per case that
the draws of the device's own lines announce device-wide-lines one for one, which fails without
this change on RADV (width 2.5 drawn by the device's lines with no notice); the edges test
asserts the notice at each device-line draw.
Docs: render/line_width.rs's module docs, DeviceWideLines' rustdoc and docs/API.md's entry and
policy text, WideLinePolicy's and DevicePolicy::wide_lines' docs, the runtime README's route table
(its "exactly Metal's" row folded into the announced one), docs/FAST-PATHS.md's row (no device's
lines are taken as Metal's; the cost adds a row or a column at an end), docs/RUNTIME-PORTING.md's
SetLineWidth row. The announced cost string is unchanged.
Notices: one device-wide-lines per device (once per kind, unless announce_each names it) on a
RADV run that draws wide lines only at widths above 1 on the 1/8 grid, where it announced
nothing; a run that already drew a width below 1 or off the grid announced it already.
Needs the runtime-sources pin and a RUNTIME_VERSION (the orchestrator's numbers).
Verified: cargo fmt. The XTX, 780M, lavapipe and M3 runs follow through potluck.
(cherry picked from commit be88ae03f199d5a485abcc546d0d52b181290e7b)
Translation changed at 99a11fd507 (SEMANTICS_VERSION 1999). Blessed on the M3
(s37-pl.sh bless, dv-golden).
(cherry picked from commit 3ed7a71c0272cda83dcbb37757d02481f4da63d5)
The four commits before this (nvreds) put a refused band's lines at the nearest width on the
device's lineWidthGranularity grid: the nearer step, a tie the wider, never 0 (render/line_width.rs
drawn_width). On RADV (granularity 1/8 from 0) Metal's width-0 line was handed 1/16, a tie between 0
and 1/8 that the driver may take either way, and it drew nothing. It now draws at 1/8.
Verified (nvreds):
- RX 7900 XTX (10724, NAVI31) and the 780M (10773, PHOENIX): 23 pixels at width 0.125 where
Metal draws 23, against 'drew nothing' at the base;
- lavapipe 10911: runtime tests 21/21, plain clippy, lane 7/7;
- M3 10654 lane 7/7; Iris 10629 23/23 before the rebase.
The two wide_lines reds (628 against 622 pixels) are on both sides and their fix is the next tip.
Landing: pin-compute, api-signatures --check, refusal surface and coverage with no diff.
The line also prints for the triangle's edges, where Metal's 23 pixels of the horizontal line are
not the comparison.
(cherry picked from commit c05e75e4f54883fe5666198180ee2cc17679159d)
A LINES-NEAREST line names each round's pixels beside the width drawn, so a run shows how near
the device's line comes to Metal's 23 pixels for the horizontal line through centres.
(cherry picked from commit ddfe0e41e786c243c2b8c243325d710da21ab903)
With the refused band's lines through pixel centres (the commit before), RADV on gem10's RX 7900 XTX (NAVI31; the 780M, PHOENIX, on um870 reads the same, job 10773)
drew nothing at round 0 of a_refused_band_draws_at_the_nearest_width (m3-max-10559), where Metal
draws 23 pixels (its probe's 'horizontal y=16.5 x 4.5 to 27.5 width 0'). The nearest route
handed the driver w' = 1/16 for Metal's width 0, clamped into lineWidthRange [0, 8] alone. RADV's
lineWidthGranularity is 1/8 from 0, so 1/16 is a tie between 0 and 1/8, and Vulkan lets the
driver take either ("the nearest supported width"): a line of width 0 covers no pixel centre.
ANV's grid is 1/128, which holds 1/16, so ANV draws it as it is.
The nearest width is now on the device's grid: clamped into the range, then the nearer step of
lineWidthGranularity from the range's bottom (a tie the wider), and never 0 where the range starts
at 0 (render/line_width.rs drawn_width). So RADV draws Metal's width 0 at 1/8, and ANV still at
1/16. The runtime's route test and the validation lane's LineFacts::nearest mirror the rule; the
module docs, the runtime README's table, docs/API.md's lines-at-nearest-width entry and the
kind's rustdoc say it. The announced cost is unchanged.
Needs the runtime-sources pin and a RUNTIME_VERSION (the orchestrator's number).
Verified: cargo fmt. RADV, lavapipe, the M3 and the Iris lanes follow through potluck.
(cherry picked from commit c20de3da6e, message corrected: the run it cites (m3-max-10559) took the XTX, its MESA_VK_DEVICE_SELECT lacking the "!")
On Iris Xe (ANV, RPL-P) a_refused_band_draws_at_the_nearest_width failed at round 0's line:
'drew nothing'. The line ran from (4, 4) to (28, 4), along pixel edges. ANV's lineWidthRange
starts at 0, so the nearest width to Metal's width 0 is 1/16, which ANV draws as it is: a band
1/16 pixel wide around y = 4 holds no pixel centre. Metal draws none there either: its probe's
'horizontal y=16 width 0 (through no centre)' is 0 pixels, and 'horizontal y=16.5 x 4.5 to 27.5
width 0' 23. Devices whose nearest width is 1, or whose thin lines cover more, drew something,
which is why the case passed elsewhere.
The triangle's corners now lie on pixel centres, so each line and edge runs through centres,
where Metal's lines at width 0 draw; the test still asserts the draw drew, routed to the nearest
width and announced.
Verified: built and run on Iris in the job that carries this commit (reported with the tip).
(cherry picked from commit d733ab2c25d0fd177ecfd9f2f202ebaf3214e525)
The four commits before this (ownpixel) let a draw's slot that samples a mipmapped texture, one
level of which a colour attachment of its render pass instance renders, read the texture's own
image through a view of the levels before the attached one (same base, fewer levels), where every
read the slot can make (StageModule::level_reads, through the sampler the draw binds) stays below
the lowest attached level. Such a slot no longer reads a usage shadow, and nothing is copied for
it. The answer is the shadow's: no draw of the instance writes those levels, and the view overlaps
no attachment. A slot that reaches the attached level, any level, or a texture's first level keeps
the shadow, counted by reason (attached_read_slots_apart, _written and _narrowed replace _below).
FAST-PATHS records it.
Verified (ownpixel, M3 MoltenVK m3-max-10859 at fd1ddfb852): --cfg m2v_gpu clippy on runtime and
validation green; 61/61, among them tests::attached_levels (five cases: explicit level 1 with level
2 attached narrowed; level 2 with level 2 attached copied; an implicit read clamped by the bound
sampler at LOD 1 narrowed; the same read unclamped copied; level 1 with level 0 attached copied;
every byte against the level's colour before the pass), attachment_reads, view_attachments,
snapshot_reads, attached_read_standing, kept_shadowed_draws, draw_again, shadow_carried_read and
shadow_merge_read. Linux clippy x3, Rustdoc, the runtime suite, lavapipe and the 780M counts follow
(m3-max-10860). The new fixture's golden and expectation rows are re-blessed on development.
The narrowed slots' second command_uses_into named its plan, command and tables `made`, which
shadowed the stencil shadow's `made` read further down, and the runtime did not compile (E0599,
E0308 in m3-max-10849). They are `parts` now.
Verified: cargo fmt only; the build follows as potluck jobs.
(cherry picked from commit fd1ddfb85286bd7ff591b35aa9bdd05dac9b3546)
tests::attached_levels draws once over level k of a private 16 x 16 RGBA8Unorm of five levels,
each level filled with its own color by a blit, sampling the same texture through a runtime
sampler of nearest filters and mip filter, and reads level k back:
- level 1 read at an explicit LOD while level 2 is attached: narrowed (no copy), level 1's color,
the texels the copy holds there;
- level 2 read while level 2 is attached: reaching, copied, level 2's color from before the pass;
- an implicit read (LOD 2 by its derivatives) through a sampler clamped at LOD 1: narrowed, level
1's color; the same read unclamped: reaching, copied, level 2's color;
- level 1 read while level 0 is attached: first level, copied, level 1's color.
Each case compares attached_read_slots_narrowed, _reaching and _first_level and whether the pass
copied anything (shadow_copies, shadow_texels_first_copied_in_images).
The fixture's .ll and .air.ll come from scripts/regen-air-fixtures (TOOLCHAIN gains its line).
api_signatures blessed for the WorkCounts fields the previous commit renamed and added
(attached_read_slots_below out; _apart, _written and _narrowed in).
Verified: cargo fmt only; the device runs follow as potluck jobs.
(cherry picked from commit c8bcf0221cf5aa2d2003c8925fa8ae17c55bc44c)
A draw's sampled slot of a texture its render pass instance renders at level k (counted from the
texture's own first level) took the texture's usage shadow, a whole copy of every level, even
where its reads reach only levels before k. Such a slot now binds the texture's own image
through a view of its levels 0..k, the same first level, so an explicit level of detail selects
the same level, and names those levels in its uses (`binding::NarrowedSlots`): no copy is taken
for it. The copy would hold the same texels: nothing the instance does writes those levels
where the texture is an image of its own the bind reads in place (not sparse, no decoded twin,
the sampled usage), no attachment of the instance is at them, no earlier draw wrote them since
the instance's last barrier (a draw after one records into a new instance), and no write of the
draw's own meets them (else every narrowed slot of the draw takes its copy, its uses made
again). Which levels a read reaches is the translator's fact (`StageModule::level_reads`)
through the samplers the draw binds: level-count and level-of-detail queries, computed fetch
levels and samples without a sampler-bounded level keep the copy.
A draw rebound works its narrowed slots out again and is rebound only where they are its kept
draw's; a draw again binds as its kept draw did.
WorkCounts: attached_read_slots_below becomes attached_read_slots_apart (the own image cannot
serve them), attached_read_slots_written (something writes those levels) and
attached_read_slots_narrowed.
Verified: cargo fmt only; the build, clippy, a device test of an explicit read of level k - 1
while level k is attached and the touched suites follow as potluck jobs.
(cherry picked from commit 7ba814a2e2f419643c2f9e68b9768709658cbe94)