8e9c144ccb431d1af940a16bb91c6232941baecc
6280
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8e9c144ccb |
unread_attribute: compare the drawn codes within one code of Metal's
The test compared the 8-bit codes exactly. The RTX 5080 Laptop GPU (615.71.09) drew `shade` as [64, 127, 191, 255], where the M3 Max stores [64, 128, 191, 255]. `shade`'s green is 0.5, which scales to 127.5, a tie. Vulkan 1.4, 3.10.2 lets the float-to-unorm conversion return either of the two codes nearest f x (2^b - 1) and only asks it to round to nearest. The fragment module records `PrecisionNote::DeviceColorConversion`, whose documentation names this exact case: NVIDIA's 615.71.09 stores 0.5 as 0x7f where Metal stores 0x80. Under owner rule 1 the device's conversion stands, so a test that expects Metal's bits there is wrong. Each channel is now compared within one code of Metal's answer, for both the gated-off and the gated-on draws. The test still proves what it is for: `shade` (64, 128, 191, 255) and `color` (191, 64, 64, 191) lie 127 codes apart in red, so a gated-off state that read the attribute still fails. Verified: the 5080 run of this commit (named in the tip report). |
||
|
|
9090e8a58f |
Exit guard: list spares.rs among the modules that keep the device's functions
RUNTIME 2455 gave the begin-ahead thread `BeginTargets` (spares.rs), which keeps an
`Arc<Functions>` so the thread can begin a spare pool's primaries without holding the device.
`only_the_listed_modules_keep_the_device_s_functions` failed on every venue since
("copies of the device's functions outside the listed modules: spares.rs: ...functions:
Arc<Functions>..."; seen on the RTX 5080 leg of the 596d917dfe round).
The copy cannot be called after the device's teardown: each begin runs inside a section of the
exit guard, and the teardown stops and joins the thread (`BeginAhead::stop`) before it releases
the spares and before vkDestroyDevice (device/mod.rs). So spares.rs joins KEEPERS with that
reason.
Verified: the test passes in the msi job that compiled this commit (named in the tip report).
|
||
|
|
b874899768 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
74223b54a4 |
RUNTIME 2492: A batch's first work that only uploads Managed copies takes narrower barriers
A batch whose first work is a Managed buffer's uploads alone (copies or inline writes of did_modify_range ranges into its device copy) recorded the barriers every first work takes: from ALL_COMMANDS to ALL_COMMANDS (MEMORY_WRITE -> MEMORY_READ|MEMORY_WRITE) before, and from TRANSFER to ALL_COMMANDS|HOST with HOST_READ after. Uploads are transfers and carry no acquire, so the lead barrier keeps its first scope (every command before, every write before) and narrows its second to TRANSFER (TRANSFER_READ|TRANSFER_WRITE; the spec: the second access scope only includes accesses of the stages in the destination stage mask). The device copies they write are never read by the host (contents maps the host copy), so the trailing barrier drops HOST and HOST_READ: no domain operation to the host (the spec: HOST_READ/HOST_WRITE in the destination access mask perform that domain operation). Every other first work keeps its barriers. Also: the INLINE_BYTES doc carries its XTX and 2080 numbers (a9df804b7f, which missed RUNTIME 2491's landing). RUNTIME_VERSION 2492. Verified: msi m3-max-38180 at dc5ffee24e: fmt 0; clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings plain 0, --cfg m2v_gpu 0, --cfg m2v_cpu_icd 0; rustdoc -D warnings 0. The managed suites and the bench (development against this, inline against none at 64 B) on the XTX and the 2080 follow. |
||
|
|
c091862da8 |
Fair queue turns: the FAST-PATHS row's measured lavapipe numbers; the queue_share example's --fixture
The lavapipe test of both QueueTurnPolicy values (job m3-max-38162, msi, load 7.32): twelve command buffers of one queue committed at once, each about 37 ms there, and a small one of another queue committed after the first was scheduled. Fair: the small one's GPU run started 37.5 ms after its commit, between the burst's first and second (14 looks held, 5 let go under the idle budget). CommitOrder: 454.8 ms after, behind all twelve (0 held). Verified: m3-max-38177 (msi) at c46daf583b: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0 (compiles the example); nextest -p metal2vulkan --all-features fast_paths 36/36. The numbers: m3-max-38162 (msi lavapipe, load 7.32): under Fair the small command buffer's GPU run started 37.5 ms after its commit, between the burst's 1st and 2nd (14 looks held, 5 let go idle); under CommitOrder 454.8 ms, behind all 12 (0 held). |
||
|
|
a686dac601 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
2911334351 |
RUNTIME 2491: A discrete host's small Managed ranges go to the GPU inline in the command stream
WIP: the mechanism, the counter, tests and bench; the bound and docs follow. Measured bound (managed::INLINE_BYTES = 16 KiB; release managed_inline_bench, 200 one-dispatch command buffers, p50 GPU us, copy against inline): RX 7900 XTX (m3-max-38126) 64 B 11.7-11.8 vs 10.2-10.3, 4 KiB 12.2-12.3 vs 11.0, 16 KiB 13.8-13.9 vs 11.0-11.1, 64 KiB 20.8-20.9 vs 11.2; RTX 2080 (m3-max-38161) 64 B 36.4-37.0 vs 31.1-31.6, 4 KiB 38.5-39.1 vs 31.7-32.3, 16 KiB 44.7-45.4 vs 39.4-39.9, 64 KiB 69.5-70.0 vs 70.5-71.0 (inline loses). Unaligned ranges keep the copy: widening them would put the host copy's bytes over GPU writes beside the range. New WorkCounts::managed_ranges_inlined. RUNTIME_VERSION 2491. Verified: msi m3-max-38118 at 7094cdbcd3: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings plain 0 and --cfg m2v_gpu 0; 5f78fe489a compiled in m3-max-38132. managed_inline (bytes at 4 B, B, B+4, 65540, unaligned ranges, a range named twice, GPU-filled neighbours kept, bound 0 the negative control with 0 inlined) plus the Managed, host-RAM and copy suites: 61/61 on the XTX (m3-max-38126) and 61/61 on the 2080 (m3-max-38161). Lavapipe has unified memory, so it never takes this path. The 3090 bench and --cfg m2v_cpu_icd clippy and rustdoc follow. |
||
|
|
72a4836b41 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
8f1e4157d8 |
RUNTIME 2490: Command queues sharing a VkQueue take fair turns: a queue's own work in flight there is bounded
What: a new DevicePolicy field, queue_turns. Under QueueTurnPolicy::Fair (the
default), on a VkQueue that two or more command queues hold, a batch of a queue
not made unshared goes only while less than 2 ms of its own queue's expected GPU
work is in flight there (16 ms while no other command queue took a batch there
within 50 ms); else the scheduler holds it in its place (HeldFor::QueueTurn) and
a later commit of another queue that shares nothing with it goes first.
QueueTurnPolicy::CommitOrder keeps the old behaviour: every ready batch at once,
in commit order. exact_answers() keeps Fair.
Why: on a device with one graphics VkQueue (RADV, ANV, lavapipe, Intel's Windows
driver) every ready batch went to the VkQueue at commit, so a command buffer a
second queue committed after one queue's burst (a long command buffer cut into
parts, a backlog of frames) waited for the whole burst. The unshared hold
protected only queues made unshared, and released the other queues' held
batches in commit order, so a later plain queue still waited behind the whole
burst, only paced. Metal ran a second queue's small command buffer beside a
first queue's 200 ms one (the consumer's oracles, UHD 630 and 5300M).
How: the VkQueue's flight (unshared_hold.rs) now counts each plain queue's
batches in flight and the latest two submitting queues; Flight::own_ahead
prices each of a queue's batches at its expected run now (a longer run prices
the rest of a burst at once), credits the running oldest only where it is the
queue's own, and holds a queue with no run seen to one batch. Under Fair every
batch enters the flight. The scheduler's look holds a head for its turn beside
the unshared hold (same gate and timer wake, await_room); a committing or
waiting thread's pass leaves such a head to the scheduler's thread
(LeftAtCommit::Turn). New counters: heads_held_for_queue_turns,
heads_let_go_turn_idle, scheduler_at_commit_left_turns. Unshared queues are
never held for a turn. FAST-PATHS gets the row; its known gap now says what
remains (a submitted batch runs to its end).
Tests: tests::queue_turns (the flight's turn math: two budgets, a later queue
not held by another's burst, repricing against the unshared bound, no run seen,
the oldest's credit, published completions); the existing unshared_hold unit
tests on the new flight API; queue_share_device::
a_later_queue_s_command_buffer_takes_its_turn_ahead_of_another_queue_s_burst on
a device under both values (Fair: the small one before the burst's fourth, heads
held; CommitOrder, the negative control: after the twelfth, none held);
fast_paths' ledger choice, keys-no-profile and exact_answers tests. API
signatures blessed; REFUSALS.md unchanged.
Also: the queue_share example's --turns fair|commit-order; the conformance probe
cross_queue_burst_turns.m (not yet run); the queue-sharing and unshared-hold device tests pin
CommitOrder so they keep testing their own mechanism. Public: QueueTurnPolicy::{Fair, CommitOrder},
DevicePolicy::queue_turns, WorkCounts::heads_held_for_queue_turns / heads_let_go_turn_idle /
scheduler_at_commit_left_turns. Default Fair per the owner's 11-03 decision (isolation outranks peak
rate); CommitOrder is today's behaviour. RUNTIME_VERSION 2490.
Verified: m3-max-38127 (msi, 37143cedda): clippy -p metal2vulkan -p metal2vulkan-runtime 0; fast_paths,
api_surface, api_signatures 51/51; queue_turns, unshared_hold, queue_share unit tests 32/32. At
079c3b7635: m3-max-38140 workspace clippy 0, rustdoc 0; m3-max-38142 --cfg m2v_gpu clippy 0;
m3-max-38141 (lavapipe) --cfg m2v_cpu_icd clippy 0, queue_share_device + queue_turns + unshared_hold +
scheduler_held_wakes 47/47: a_later_queue_s_command_buffer_takes_its_turn_ahead_of_another_queue_s_burst
passes under both values (Fair: the small CB starts before the burst's 4th, held > 0; CommitOrder, the
negative control: after the 12th ends, held 0). The 780M numbers for the row follow.
|
||
|
|
fe23f92141 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
f19c613fe1 |
RUNTIME 2489: A compute or render encoder's core is made in the box it lives in: one 3 KB copy per encoder fewer
EncoderCore (2984 bytes, -Zprint-type-sizes on msi) was built by value in EncoderCore::open, copied out of it in the returned Result, and copied again into its box (EncoderCore::boxed / boxed_in) by the compute and render opens: two 3 KB memcpys per encoder. A pinned LBR profile of a guest-shaped compute stream (dispatch_chain --host 400 --only encoders --dispatches 5 --groups 64 --states 3 --binds tex-moved, msi lavapipe) put libc copies under EncoderCore::open (~110 ns) and open_compute (~98 ns) per guest dispatch, one encoder each. EncoderCore::open_placed takes a place closure that puts the core where it lies, the box for compute (parked room or the device's spares) and render (spares), so the core moves once. open keeps the by-value form for the blit encoder (HeldCore). Nothing else changes: the same fields, the same order under the same lock, the same boxes. Test: tests::compute_parked::a_compute_encoder_core_lies_in_the_box_its_command_buffer_parked (three encoders of one command buffer find their core at one address; it pins where the core lies, not the copy count). RUNTIME_VERSION 2489. Verified: msi m3-max-38102: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0; lavapipe debug (cfg m2v_cpu_icd) compute, dispatch, encoder, tracker and render suites 190/190. Pinned interleaved A/B (msi lavapipe, release, taskset -c 0-7, 5 base/tip pairs, guest shape dispatch_chain --host 400 --only encoders --dispatches 5 --groups 64 --states 3 --binds tex-moved, --runs 30): the open call 640 -> 574 ns per guest dispatch (-66 ns); thread_cpu per dispatch within run-to-run noise (6137 vs 6240, range 5615-6681). Profile at the base (m3-max-38071, LBR): open copied the 2984-byte core out in its Result (~110 ns) and open_compute again into its box (~98 ns). |
||
|
|
5e3f60d851 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
ac7dffa3fd |
RUNTIME 2488: A spliced shadow's staged heads and tails go back as row copies too, one dispatch each where faster
A spliced copy back out of a staging buffer copied its rows' edges into the arena region (each row's head before its first line boundary and its tail after its last, which the host step then copies into the pages) as one vkCmdCopyBuffer region per edge: 2N regions per copy back. On ANV, which splices every such copy back, and on the RTX 5080 Laptop (DriverFact::RowCopiesDispatchFaster), the driver records each region as an operation of its own. That is the cost row_copies.rs removes. shadow_splice::staged now puts a cut's heads (in `edges`) and its tails (in `tails`) in separate lists. Each takes the region in the same order as before (a row's head, then its tail), so the region's layout, the pieces and the host step are unchanged. For rows of one shape the heads are equal-sized and equally spaced in both buffers, and so are the tails. SplicePlan::place makes each list a RowCopies from the staging buffer into the region (the arena's chunks carry storage usage), beside the whole lines' RowCopies into the truth. record_spliced records all three; the encoder takes their stages and uses (ShadowCopy::spliced_stages and spliced_uses: a texture buffer's shadow is read by every dispatched copy) and retains every set. Tests: - tests::shadow_splice::a_staged_cut_of_equal_rows_is_three_copies_of_rows_of_one_shape_each checks that the cut of the validation test's shape, at three phases, gives whole lines, heads and tails of one dispatchable shape each. - The staged cut's byte test also reads the tails. - runtime_lane::row_copies::a_spliced_shadow_s_lines_heads_and_tails_go_back_as_one_dispatch_each (renamed from ..._whole_lines_go_back_as_one_dispatch) asserts 3 row copies of 96 regions, 3 dispatched where the fact holds. Before this change it was 1 copy of 32. - The unforced test expects 3 copies where its copy back was spliced, else 1. The three row copies live in Splice.rows (clippy's large_enum_variant refused a 600-byte variant of SpliceCopies::Staged; nothing boxed). RUNTIME_VERSION 2488 (2487 is the early pin branch's). Verified: msi m3-max-38042 at 777d9a3412, lavapipe, --cfg m2v_cpu_icd: clippy -p runtime -p validation --all-targets --all-features -D warnings 0; validation 43/43 (a_spliced_shadow_s_lines_heads_and_tails_ go_back_as_one_dispatch_each: spliced 1, row copies 3, regions 96, 3 dispatched where the fact holds; the same scenario measured 1 copy at 869519d69f, m3-max-38028); runtime shadow, splice and row-copy tests 118/118 (a_staged_cut_of_equal_rows_is_three_copies_of_rows_of_one_shape_each: each copy meets RowsDispatch::new's conditions, so ANV and the 5080 dispatch them: expected, not run). Plain and --cfg m2v_gpu clippy and rustdoc in m3-max-38043. |
||
|
|
e3959de823 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
566f2da4f9 |
RUNTIME 2486: A spliced shadow's staged whole lines go back as row copies, one dispatch where faster
RUNTIME 2431 splices a shadow's copy back into host pages where the device's check of those pages failed or has not answered. Its staged form (a copy back out of a staging buffer: a 2D texture whose texels start off their alignment, or a texture buffer) recorded its rows' whole lines as one vkCmdCopyBuffer region a row, bypassing row_copies.rs, which every other copy back out of a staging buffer goes through. So on ANV and the RTX 5080 Laptop (DriverFact::RowCopiesDispatchFaster), and the Iris Xe splices every such copy back, the rows went as N regions again instead of one dispatch, and WorkCounts::row_copies counted none. runtime_lane::row_copies::a_shadow_s_staged_rows_go_back_as_one_dispatch caught it on lavapipe: its device has no record of the check's verdicts, so the copy back is spliced, and the row copies since were (0, 0) where (0, 1) was wanted. SplicePlan::place now makes a staged splice's whole lines a RowCopies from the staging buffer into the truth (counted, one dispatch where the device runs it faster); record_spliced records it; the encoder's splice records it with the copy's stages and uses as that dispatch's (ShadowCopy::spliced_uses: a texture buffer's shadow read by both the dispatch and the edges' copy), retains its set, and notes the host step's write as before. The validation test is split: its clear over the pages is a helper; the original test keeps its contract, and a_spliced_shadow_s_whole_lines_go_back_as_one_dispatch runs it on a device whose check fails (DeviceOptions::fail_in_place_check), asserting the copy back spliced and its whole lines one row copy, dispatched where faster. Cause: shadow_splice.rs `splices` splices a copy back into host pages while the in-place check is failed or pending (RUNTIME 2431, |
||
|
|
3318645457 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
5d96974eca |
RUNTIME 2485: The tiling-cost check's bounds from its device verdicts: linear costly at twice the optimal frame
The check's first measurements put the linear frame at about 5.25 times the optimal one on the Iris Xe of RPL-P under ANV (three runs: 4.685 against 0.890 ms, 2.109 against 0.402, 2.343 against 0.448; the first at a lower clock) and at 1.09 times on lavapipe (3.199 against 2.938 ms). The ratio bound moves from 1.5 to 2, about the middle of the two by ratio, so load on either side moves no verdict; the excess bound stays at 500 us, below the Iris Xe's least excess (1.7 ms) and above lavapipe's (0.26 ms). The record keeps the medians and the verdict is worked out again as it is read, so no CHECK_VERSION bump. The measured medians, the check's wall time (78.2 to 99.3 ms on the Iris Xe, 158.1 ms on lavapipe) and its GPU time go in the module doc and the runtime README. Measured: m3-max-37988 (Iris Xe, main's dispatch of 32787023ca), m3-max-37965 (lavapipe). The 780M, XTX and 2080 runs sat behind the timing queue's exclusive jobs and were cancelled (780M, XTX) or are still queued (2080, m3-max-37989): not measured. MEASURED (2048x1536 BGRA8Unorm, medians of 8 rounds): Iris Xe RPL-P, ANV (m3-max-37988, three runs): linear 4.685 / 2.109 / 2.343 ms against optimal 0.890 / 0.402 / 0.448 ms (5.23-5.26x), download 0.53-1.18 ms, upload 0.21-0.25 ms, the check 78-99 ms; lavapipe (m3-max-37965) 3.199 against 2.938 ms (1.09x). COSTLY_RATIO 1.5 -> 2.0, COSTLY_EXCESS 500 us kept. RUNTIME_VERSION 2485. Verified: m3-max-38017 at 384075907e: clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0; tiling_check unit tests 3/3 (the rule on both sides of each bound); rustdoc -D warnings 0. The 780M, XTX and 2080 verdicts follow. |
||
|
|
c66df8ee5a |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
45ebbdaa5e |
RUNTIME 2484: Copies between a texture's region and a surface's runs of guest RAM
A consumer that keeps an IOSurface's GPU copy as one optimal texture, on a host whose surface path copies by runs of guest RAM (copies_guest_ram: no view of the pages is made), needs the texture forms of the run copies, or its fill, upload and download go back through a view per block or a staging buffer. What: BlitCommandEncoder::copy_texture_from_host_ram(ram, runs, offset, bytes_per_row, size, texture, slice, level, origin) and copy_texture_to_host_ram(texture, slice, level, origin, size, ram, runs, offset, bytes_per_row), runtime extensions (Metal has none). `runs` is the surface's bytes in order (the shape the consumer's run copies pass today); offset and bytes_per_row are Metal's copyFromBuffer layout over those bytes. Each row's texels within a run and a chunk are one vkCmdCopyBufferToImage / vkCmdCopyImageToBuffer region straight on the chunk's import (bufferRowLength and bufferImageHeight 0; bufferOffset a multiple of the texel, VUID-vkCmdCopyImageToBuffer-srcImage-07975; the subresource bounds 07971/07972), with no staging buffer. A first-touch or CPU-only chunk goes through the existing StagedGather / StagedScatter, which now take a buffer or an image target. Hazard tracking, dirty-page reports, imports held to completion and the bytes outside the texels are as the buffer forms keep them. Refused as the buffer forms are, and with Invalid / Problem::HostRam for the texture's own cases (its doc extended); no new RuntimeGap, Degradation kind or WorkCounts field: the direct form shows in host_ram_copy_regions with no staged copy. replay.rs logs the call (HostRamTextureCopy); blit_texture.rs and blit_plan.rs helpers are shared (pub(super)). Runtime README and HOWTO document it; the signature table blessed (+2 methods); REFUSALS regenerated. RUNTIME_VERSION 2484. Verified: msi job m3-max-37991 (lavapipe, --cfg m2v_cpu_icd): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0; nextest host_ram_texture_device + host_ram_copy_device 39 passed. m3-max-37997: "HOST-RAM-TEXTURE llvmpipe: fill regions 250, dispatches 0, staged 0" (a 300x200 BGRA8 Private texture, rows at 1280 bytes from byte 48, one row across a chunk end); the staged test saw exactly one staged gather and one staged scatter. Plain and --cfg m2v_gpu clippy, rustdoc and the 780M and Iris runs follow on development. |
||
|
|
1104b02971 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
d80fe0475f |
RUNTIME 2483: The device's tiling-cost check: linear images in place against optimal ones, once per driver
A consumer that keeps a GPU copy of host pages (as an x86 Mac's GPU keeps one of each IOSurface) needs to know whether a texture in place over those pages costs the GPU more than the copy saves. No Vulkan query answers that: a format's linear and optimal features say what each tiling holds, not what it costs. So the device measures it, once per driver, release and runtime, on a thread of its own, when asked. Device::settle_tiling_cost_check(timeout) starts the check and waits for it; Device::tiling_cost answers TilingCost (a TilingVerdict and four medians) and Device::tiling_cost_check_report says it in words. The check draws, over 2048x1536 BGRA8Unorm images, a full-target fetching pass and a zeroing pass into the runtime's own linear textures in place over host pages and into Private (optimal) textures, and times the copies between the optimal image and the pages both ways: 8 rounds after a warm-up, medians from timestamps. LinearCostly where the linear frame passes the optimal one by more than 500 us and 1.5 times. Unchecked, never fatal, on any refusal. The medians are kept as a record in the shader cache's content directory, as the queue-switch and submission checks keep theirs. The fetch stage is a new module of the translator's check draws (CheckDrawModules::fetch). The check's thread is marked as a device check's, so its textures over host pages take the image in place whatever the in-place check's verdicts; it holds its device through the holds registry (Holder::TilingCheck) and steps aside as the in-place check does. The check's note of mismatched image formats prints their raw values (vk::Format has no Debug in the runtime's ash build); its textures over its pages take the default placement (only the Private ones are placed outside). The signature table is blessed for TilingCost, TilingVerdict and the three Device methods; the runtime README lists them. The bounds are provisional until the device verdicts are in. RUNTIME_VERSION 2483. Verified: m3-max-37966 at 32787023ca (msi): clippy metal2vulkan + runtime --all-targets --all-features -D warnings 0, runtime with no default features 0, translator tests 16/16, rustdoc -D warnings 0. m3-max-37965 (lavapipe): tiling_check tests 4/4, clippy --cfg m2v_cpu_icd 0, the device report LinearCheap (linear 3.199 ms, optimal 2.938 ms, 1.09x; download 1.448 ms, upload 1.435 ms; ran 158.1 ms), a second device reading the same medians from the record. m3-max-37962 at 3be7050e7b: clippy --cfg m2v_gpu 0; m3-max-37959: tiling_check and holds tests 77/77. |
||
|
|
85987cda9d |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
3619e37540 |
RUNTIME 2482: Texture::view_placement answers what a view would be, by the decision its making takes
The consumer will make an IOSurface plane's device cache one optimal Private texture, every texture over the plane a view of it, and needs to know before it makes a view whether the runtime would make it a Vulkan view of the image or a view shadow (which it sends to its own fallback instead). What: `Texture::view_placement(pixel_format)` answers `ViewPlacement` (`Image`, `ImageThroughSwizzle`, `Shadow(ViewShadowReason)`, `OverBytes`), or the error `new_texture_view` would refuse the view with. The decision is factored, not copied: `Texture::checked_view` holds the checks `view_as` ran inline (Metal's rules, rotation, X32, buffer slices, decoded twins), `Texture::view_hold` decides the storage (shared, through a swizzle, the viewed image, a shadow and why, storage over the bytes), and `Device::view_shadow_plan` / `shadow_plan` hold the shadow's refusals `image_shadow` checked while making. `view_as` and the query call the same three. `image_plan::views_missed` replaces `takes_views_of` and names why an image takes no view (another compatibility class, or not in its list); `Device::view_apart` replaces `image_takes_view` and puts the device's missing reinterpretation first; the `shadowed-texture-view` notice's reason now follows that reason (it chose by the texture's PixelFormatView usage before). Tests: `view_placement_device` (runtime, device cfgs) sweeps 10 texture formats x 5 usages x 24 view formats, checks the query moves no count and matches the view made (by `view_shadows`, `views_through_swizzle` and the handed-out image), and names the consumer's cases. `plane_device_cache` (validation lane): a 300x200 BGRA8Unorm Private texture round-trips between no-copy buffers at offset 48 and pitch 1232 with every other byte kept; a clear through its sRGB view then a copy through its own-format view in the next encoder, tracked and untracked with a fence, read the clear with no hazard under synchronization validation, and the unordered control is reported as a read after write. Documented in the runtime README; the signature table blessed (10 rows); REFUSALS regenerated. RUNTIME_VERSION 2482. Verified: msi job m3-max-37961 at c2f0c96d3c: clippy -p metal2vulkan-runtime -p metal2vulkan-validation --all-targets --all-features --cfg m2v_cpu_icd -D warnings 0; the lavapipe tests, plain and --cfg m2v_gpu clippy and rustdoc follow on development. The hazard tracker keys a view's uses on its image (texture.rs view_as shares the Arc<Image>; bound_use/image_use key on image.identity.key), so the order across views needed no fix. |
||
|
|
ae2fcadd20 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
d8b39b12d1 |
SEMANTICS 2141 / RUNTIME 2481: Read short constant windows through uniform texel buffers on the Iris Xe
What: on a device whose profile takes the new cost fact DriverWorkaround::ExternalUniformReadsSkipACache (ANV on the Iris Xe of RPL-P alone), a buffer slot's uniform view whose window the translation bounded to at most TEXEL_WINDOW_BYTES (4 KiB) is declared as a uniform texel buffer (UniformConstant image, Dim Buffer, Sampled 1, u32 texels) and read with OpImageFetch; the plan's form is DescriptorView::UniformTexel, its descriptor UNIFORM_TEXEL_BUFFER, its use class Sampled, its range the uniform view's own under minTexelBufferOffsetAlignment and maxTexelBufferElements. Every other uniform view stays a uniform buffer exactly as before. The runtime makes an R32G32B32A32_UINT view of the planned range for each write, with no cache, holds it until the command buffer completed (State::retain_own, which also keeps an indirect chunk that made one from being kept), and binds whole a draw rebound or carried at such a slot. The zero buffer takes the uniform texel usage, and upload regions align to the texel offset alignment too. ARTIFACT_FORMAT_VERSION 525 (DescriptorView gains a variant); SEMANTICS_VERSION 2141, RUNTIME_VERSION 2481. WorkCounts: uniform_texels_bound; uniform_buffers_bound_to_16k (a bound buffer's uniform view written as a uniform buffer, window at most 16 KiB: on the Iris the 4-16 KiB ones); uniform_buffers_bound_past_16k (longer, or not bounded). Why: ANV gives external memory MOCS 61 on Gen12.0, which loses the HDC L1 that uniform buffer reads go through; the sampler path keeps its cache. On the Iris, a UBO over imported memory ran 2.0-2.5x (and 5.2-5.5x for a divergent index) the time of device memory, a uniform texel buffer 0.98-1.04x (jobs m3-max-37703, 37729). The window sweep (37753, 37780) set B: at 1 and 4 KiB texel-set was no slower than ubo-set on device memory in every pattern; at 16 KiB one row was 3.1% slower; from 32 KiB per-lane patterns 2.8-4.2x. B = 4 KiB covers the consumer's binds only where the kernel's window (its struct size or accessed hull) is at most 4 KiB. The counting walk counted buffer sizes, not windows, so the new counter will tell. The cost of a view per write: vkCreateBufferView+vkDestroyBufferView 0.082 us on the Iris (mean of 4000), vkUpdateDescriptorSets 0.007 us against a uniform buffer's 0.024. A set 0 naming a fresh view is found again by no later command, so such commands lose set-0 reuse. Tests: engine_access (the texel form's module, its interpretation at residuals 0, 4, 16 and 256, the window bound, the slot's plan), the profile fact's carriers, and a lavapipe test whose compile device takes the Iris's identity (cfg(test) DeviceOptions::compile_as): offsets 0, 4, 16, 256, 260, set*Bytes data, bytes written before encoding, after it and by a blit, and a 4100-byte window kept as a uniform buffer, with the counts as evidence. Also: the fixture uniform_texel_windows's AIR companions (job m3-max-37901); a texel form's loop-invariant fetches move out of their loops as a uniform block's loads do (spirv::hoist, with its test); the texel form documented (ARCHITECTURE, FAST-PATHS, view docs, runtime README); the API signatures blessed. Verified: msi job m3-max-37946 at 00121399e7: fmt check 0, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd; --all-targets --all-features -D warnings) 0, rustdoc -D warnings 0. Touched suites running in the same job. Golden table and engine fixture inventory re-bless on development. |
||
|
|
626c8c5767 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
94f09727a9 |
SEMANTICS 2140: Per-lane constant reads keep their storage view where a uniform buffer serializes them
On NVIDIA's driver a uniform-buffer read whose address differs between the lanes that run it together takes many times as long as the same read of a storage buffer. A bare Vulkan sweep (256 workgroups of 64 invocations, 64 and 1024 uvec4 reads of a 1 to 32 KiB device-local window, the uniform block declared at the window's size, median of 15) measured the storage buffer at 0.011 to 0.16 of the uniform buffer's time on the RTX 3090 (Ampere, 620.70.06, job m3-max-37848), 0.026 to 0.18 on the RTX 2080 (Turing, 620.70.06, m3-max-37839) and 0.012 to 0.12 on the RTX 5080 Laptop GPU (Blackwell, 615.71.09, m3-max-37858) for per-lane words and per-lane walks. A uniform texel buffer took 0.37 to 3.1 times the storage buffer's time there. With every lane reading one word the storage buffer took 0.96 to 1.68 times the uniform buffer's, so uniform reads keep the uniform buffer. - DriverWorkaround::UniformBufferPerLaneReadsSerialize, a cost fact keyed on the three GPUs measured (driver_facts rows; NVIDIA_RTX_2080 added). RADV is not listed: AMD has no such fact. - lower::simd::uniform: Uniformity::among_active_lanes, a data-only mode of the analysis (no control divergence, no post-dominator tree; a load divergent only through its pointer). The workgroup analysis makes every loop counter after an early return divergent; this mode keeps it uniform. What it misses (a phi joining uniform values after a divergent branch, a value read after a loop left per lane) errs toward the uniform view, today's choice. - memory::provenance records the pointer of each indexed read of a constant buffer root; memory::plan marks SlotPlan::lane_read on a profile with the fact, for a slot a uniform view could read, running the analysis once and only where such a slot has an indexed read. - lower::access::view_kind keeps a lane-read slot's storage view. The choice is the slot's: its uniform reads pay 0.96 to 1.68 times and lose spirv::hoist (documented there). Every stage takes the rule; compute was measured, the graphics stages are expected, not measured. - No FAST-PATHS row: every view reads the same bytes. No Degradation kind. No runtime change. SEMANTICS_VERSION 2139 -> 2140. Tests: uniform's active-lanes unit tests (an early return's loop counter, per-lane data alone); engine_lane_reads (per-lane table -> Storage, guarded uniform loop and constant offset -> UniformWords on the 5080, 3090 and 2080 identities; RADV keeps UniformWords for all three, the negative control); device profile keying test. api_signatures blessed (one variant added). Verified: msi job m3-max-37911: clippy -p metal2vulkan --all-targets --all-features CLIPPY=0; nextest -p metal2vulkan --all-features over uniform::tests, engine_lane_reads, device::tests::profile, engine_access, memory::plan, memory::provenance: 135 passed. Release translation time and peak, the other clippy configurations, rustdoc and a 2080 runtime A/B follow on development. |
||
|
|
51280732aa |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
c195086369 |
RUNTIME 2480: A dispatch's regions are counted once and walked by count, and its row checks read the pieces
What: Pieces holds the number of chunks its count takes, computed where the axis is cut, so
Regions::len and Regions::iter divide nothing; planning and instantiating a dispatch asked for
each axis's count over its chunk size again at every len() and every walk of the axis.
Why: the regions are numbers since f5b102f317, and an instantiation reads their count and
walks them several times (the product's bound, the emptiness check, the commands' length, the
unit-axes and row checks, the regions' own walk), each time three divisions.
Verified: the bind::dispatch tests in the next msi job.
What: Regions::iter is an iterator of its own (RegionsIter), which counts each axis's piece
from x slowest to z fastest and takes each piece by its number (Pieces::piece), where it was
three nested flat_maps over chained ranges. The unit-axes and row checks (unit_axes,
multi_row) read the widest local size of each axis's pieces (Regions::widest) rather than
walking every region: each piece of an axis is some region's wherever there is a region, so
the answers are the walk's.
Why: msi profile of both binaries in one job (m3-max-37856, taskset -c 0-7, the guest shape):
at the tip of the regions-as-numbers change, unit_axes alone took 122 calling-thread samples
(about 67 ns a dispatch, 1.8% of the dispatch call) and the flat_map walk in instantiate 32
more, where base walked a Vec; the instantiation subtree measured 12.75% of the dispatch call
against base's 12.25%.
Verified (lane instleft): clippy plain 0 and the translator bind::dispatch, bind::plan and bind::graphics tests plus tests::bind 80/80 at 080d04c44a (m3-max-37875). Profile of both binaries in one job (m3-max-37874, msi, taskset -c 0-7, the guest shape), base
|
||
|
|
6bbfc310d3 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
5a0d21cdc5 |
RUNTIME 2479: A reused command buffer state keeps its predication and fold-order room and its compute logs
A command buffer's state, reset at its release for the next command buffer (spare_states.rs), started its command predication's lists (opened, alone, each unit's opened_fresh) and each group's FoldOrder (its map and a Vec of priors per resource) empty, so every 5-encoder command buffer allocated them again over memory another thread freed. And every compute encoder took its log from the device's SpareLogs mutex, which the queue's handler thread takes as releases give logs back. - Predication::reset clears its lists in place. opened_fresh moves from Unit to Predication: one unit is open at a time, and it is cleared as the unit ends. - State.order_room holds the group order the way stash_room holds the stash: Fold::begun takes it, close_fold gives it back cleared (FoldOrder::clear keeps the map's room and moves each resource's emptied list into its boxes, which join reuses). The order's second-encoder build is a join into that room; FoldOrder::after is gone (tests build it with none + join). - The release clears compute logs outside the state lock and keeps up to STATE_LOGS (32) in the state (State::keep_compute_logs). The rest go to the device spares in one give_all. A compute encoder's open takes its log under the state lock it already holds (State::kept_compute_log), and uses the device spares only when the state has none left. - Bounds: Room counts the new lists (entries, for record_lists_grown) and the kept logs' bytes, so the existing caps hold. A state with more than 8 MiB is not kept, and kept states hold at most 16 MiB in total. - Predication::enter no longer moves unit.carried out with mem::take. It drains it instead. Same commands, barriers, predication and fold answers. New tests: tests::spare_states::a_reused_command_buffer_of_five_compute_encoders_grows_no_list_and_takes_no_spare_log (device) and tests::tracker::a_cleared_fold_order_answers_as_a_fresh_one_in_the_room_it_kept (host). With: Predication::enter rebuilds its unit around the bodies it hands on (take_if; no mem::take, no empty value left in a borrowed owner); the cleared fold-order test measures the room the clear kept. Checks at the lane tip b107e56a6c (msi): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings under m2v_cpu_icd 0 (m3-max-37853); at ed6a832c98 the lavapipe spare_states, tracker, fold, rebind, compute, spares and encoder suites 250/251 (m3-max-37842; the one failure, the host test's baseline, is fixed in b107e56a6c). The suites and two negative controls at the tip, and the timing (encopen's estimate ~85 + ~48 ns a guest dispatch), follow on development. |
||
|
|
0f29d6a6e3 |
Instantiation's allocation test runs dispatches of as many regions or fewer
What: instantiating_over_kept_commands_allocates_nothing instantiates the ragged grid twice and then the whole one over the kept commands, each of as many regions as the commands hold or fewer. Its first form ran the ragged grid after the whole one, whose four regions take three regions' keys and push writes anew over commands of one: 12 allocations (m3-max-37844), which the method's contract allows. Verified: in the next msi job. |
||
|
|
a040b06857 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
4de6a8dd92 |
RUNTIME 2478: Compute instantiation over kept commands allocates nothing and searches no constant
What: a dispatch's regions are planned as numbers (dispatch::Regions: each axis's Pieces and
one MultiRegion), so planning makes no Vec<Region> and a ragged grid's fit check no list of its
local sizes; instantiate writes each region straight from them. A region's key takes the
template's fixed constants by walking them in the layout's order, which is the order the
planner lists them in, and searches them only where the next one is another key's. In the
runtime, Variant::keyed_regions zeroes a key's uniform-view RangeAtBindOffset constants in the
key's own bytes (render/residual.rs residual_in_place), over the constant IDs the variant lists
once as it is made (uniform_residual_ids), where it cloned each key into its residual form and
dropped the kept one.
Why: profile at
|
||
|
|
542c74ed91 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
86d7480c92 |
RUNTIME 2477: A part of one command is summarized from its uses, building no map
An ordered encoder's part whose one command waits uncompared (`first`) now keeps that command's tracked uses where they wait, rather than noting them in the part's tracked map: at the encoder's end its summary is made from them (the tracked uses that touch something, a stable sort by key, the uses of one key and range joined into the first), the very list the map read by key would give. A command of at most ENTRIES_PER_KEY uses can merge no key's ranges, so that is the only rule it has to repeat. Anything else that adds to the part, orders after it or splits it (a second command, take_in_first, note_kept, split) puts the waiting uses in the map first, through the same noting. The readers of the map before the end (written, accessed, touched_in, uses_key, written_ranges, tracked_in) read the waiting uses beside it, giving the map's answers. Why: a guest's compute encoders hold one dispatch each. The profile of the guest shape (dispatch_chain --host 400 --only encoders --dispatches 5 --groups 64 --states 3 --binds tex-moved, msi lavapipe, release, pinned) had the part's map at ~60 ns of the dispatch call (hashing each use, the map's allocation) and finish_parts' walk of it at ~104 ns of end_encoding, both for a list the dispatch already had. The encoder's order (inside, first) is untouched, so every barrier inside an encoder is the same; the summary is the identical list, so the fold's join, the batch tracker's barriers and waits and the residency see the same input. Builds with debug assertions also make the map's summary at the end and assert it equal. Tests: tests::tracker::a_part_of_one_command_is_summarized_as_its_map_would_be (the summary against an unordered encoder's map: a key at two ranges, one range twice, an untracked use, a use that touches nothing; no command noted in a map, and both of a part of two), a_part_of_one_command_answers_its_readers_as_its_map_would, and on a device tests::compute_lone_parts (a command buffer of 5 one-dispatch encoders notes no command in a part's map, of 5 two-dispatch encoders 10), counted by the test-only tracker::part_notes. Timings and suite results are in the lane's report. Checks at the lane tip 3495163515 (msi): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings 0 (m3-max-37756); on lavapipe in a debug build, so the map-equality assertion ran in every ordered one-command encoder, tests::tracker (81) plus compute_lone_parts and compute_parked: 91/91 (m3-max-37756). The pinned interleaved timing (m3-max-37764), clippy m2v_gpu and m2v_cpu_icd, rustdoc and the lavapipe suites follow on development; the expected cut is ~150 ns a guest dispatch (the map note ~60 ns in the dispatch call, finish_parts' walk ~104 ns in end_encoding). |
||
|
|
b9eadef0c9 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
cb033efbcf |
RUNTIME 2476: A bind state sets aside 15 pipeline states, so a carry holds 16 kept draws
SET_ASIDE goes from 7 to 15. It bounds both the render bind state's set-aside array (LiveBind) and the compute one's (LiveDispatch), and it bounds a carry to SET_ASIDE + 1 kept draws. In guest walks, WindowServer's desktop steps turn over 25-60 pipeline states a frame. Launchpad's command buffers draw through a median of 12 states each (p90 46). Passes of more than 8 states are 1.2-2.0% of passes but 13-22% of draws in Finder and Launchpad. At 8, a pass of state k after 8 or more others finds no kept draw carried and takes every step. Docs that named 7/8 now name 15/16: live_bind.rs, render/carried.rs, render/draw_again.rs, compute/live.rs. Tests that named the bound: carried_draws' passes-of-states test now runs 16 states and expects 15 carried aside; compute_set_aside's doc says sixteen states and 32 KiB. draw_costs gets 20 plain states, so `--states 16` runs and the default pass1/pass17 shape still carries no kept draw. With 15 set aside, all of the old 12 would carry. No FAST-PATHS row names this bound. Verified (release build, msi lavapipe, encoding thread pinned to the P-cores; jobs m3-max-37724 and m3-max-37730, base and after built in one workspace). Instruction counts are the thread's user-space instructions. draw_costs pass1/pass17, figures per pass (pass1 less the draw that pass17 gives), base -> after: states 2: instructions 75978 -> 76208 (+0.3%), cycles -2.2% states 4: instructions 76278 -> 76478 (+0.3%), cycles -1.0% states 12: instructions 90656 -> 77339 (-14.7%), cycles -17.4% states 16: instructions 89686 -> 77547 (-13.5%), cycles -17.1% pass1's draws_rebound_carried at states 12 went 568 -> 9204 of 9216, and at states 16 0 -> 9200. Counts at states 2 and 4 are equal in both builds. dispatch_chain's guest compute shape (5 encoders of 1 dispatch per command buffer, 3 states, --binds tex), 3 interleaved pairs: instructions per dispatch went 45787 -> 45738 (median, -0.1%), thread CPU 5221 -> 5111 ns. Memory bound. size_of went up, render LiveBind 20808 -> 41224 bytes and compute LiveDispatch 4688 -> 8784. Each is boxed, so encoders move a pointer. Holders, each capped by the runtime: - render: 4 device spares (SPARE_LIVE_BINDS); at most one per uncompleted command buffer (its open render encoder's, or the carry it holds for its next render encoder; an opening takes the carry); at most 16 per queue held past commits (queue::CARRIES). - compute: 4 device spares (SPARE_LIVE_DISPATCHES); at most one per uncompleted command buffer (its open compute encoder's, or the one parked in it). A queue holds at most its max command buffer count of uncompleted command buffers (64 for newCommandQueue). Per queue at that default the inline worst case is: render (64 + 16) x 20808 = 1.59 MiB -> 80 x 41224 = 3.15 MiB compute 64 x 4688 = 293 KiB -> 64 x 8784 = 549 KiB and per device, on top of that, the spares: render 81 -> 161 KiB, compute 18 -> 34 KiB. Beyond size_of, each slot also has its boxed BindState and the lists that use grows; those were not measured. compute_set_aside caps a compute slot plus its BindState at 2 KiB. Unbounded by the runtime, as in Metal: how many queues a program makes and each queue's max command buffer count. Checks at the lane tip d074d4ea47 (msi): clippy -p metal2vulkan-runtime --all-targets --all-features -D warnings plain and m2v_cpu_icd 0 (m3-max-37735), m2v_gpu 0 and rustdoc 0 (m3-max-37736); lavapipe carried_draws, compute_set_aside and draw_again 48/48 (m3-max-37735). The state counts per pass and command buffer are the consumer's Iris walks (passstates, m3-max-37560/37561). |
||
|
|
da80ece1d1 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
8bcaf69f1d |
RUNTIME 2475: Compute dispatches instantiate over the commands their bind state kept
What: BindingPlan::instantiate_dispatch_into writes a dispatch's commands over a kept DispatchCommands, every field set as instantiate_dispatch sets it, the vectors keeping their storage: each region's specialization (spec_key_into, region_specialization_into) and push write's bytes, the argument table's bytes, the ranges, extents, holes and uses. instantiate_dispatch is that method over no commands. The regions a dispatch plans take no list of each axis's pieces (`Pieces`, numbers alone). In the runtime, compute::Instantiated keeps its commands as storage when a value they may read moves, and a direct dispatch that instantiates writes over them where nothing else holds them (the memo entry they were taken into is replaced first: a dispatch that instantiates settled anew); builds with debug assertions instantiate afresh and compare. WorkCounts::dispatches_instantiated_in_place counts them. Why: a guest's compute encoders bind their buffers at moving offsets, one dispatch an encoder, so their kept commands never serve again (reims's Iris walk: 96.6% of dispatches instantiated anew). Profile (msi lavapipe, dispatch_chain --host 400 --only encoders --dispatches 5 --groups 64 --states 3 --binds tex-moved, calling thread): instantiate_dispatch 5.6% of its CPU, about 600 ns a dispatch, of it translator instantiate 3.4%, regions 1.6%, region_specialization 1.1%; about fifteen allocations each instantiation. The commands read the buffer bindings that move, so no memo of them is exact for this shape: the cut is the work of making them. Verified: tests::bind::dispatch's instantiating_over_kept_commands_gives_a_fresh_instantiation (more regions, fewer, none, another state, the key's storage kept); compute_instantiated's encoders_of_moving_offsets_instantiate_over_the_kept_commands (five encoders of one command buffer: 5 instantiated, 4 in place, each writing at its own offset), on lavapipe. Checks at the lane tip d52118ce95 (msi): clippy -D warnings --all-targets --all-features for metal2vulkan and the runtime, plain (m3-max-37686), m2v_cpu_icd (37688) and m2v_gpu (37689), all 0; rustdoc -D warnings 0 (37689); the translator bind::dispatch, plan::compute and graphics tests 42/42 (37686); the runtime compute, dispatch and encoder tests on lavapipe in a debug build, so every in-place instantiation was compared with a fresh one, 244/244 (37688). gem10 lavapipe m3-max-37685: dispatches_instantiated_in_place 0.80 a dispatch on the tex-moved row, every instantiation; that run's timing was unusable (rows the change does not touch moved more than the cut); one interleaved timing run follows. With: dispatch_chain: an encoder's dispatch binds as its command buffer's dispatch index says (aac8651f23): at development the encoders shape never moved offsets or swapped textures. |
||
|
|
ff32d9a89e |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
d4a111c357 |
RUNTIME 2474: Compute dispatches clone no device handle: shadow planning returns early, record borrows
What: a compute dispatch no longer takes a handle of its own of the device. - EncoderCore::plan_shadows returns no copies at once for a command that uses no shadowed texture in an encoder that used none (ShadowSync::is_empty, where Shadows::before changes nothing and plans nothing); where it plans, it reaches the device through the command buffer's handle, borrowed apart from the shadows and leases the merges take. - EncoderCore::shadow_copies returns at once for no copies (nothing recorded, barriered or spliced). - compute::record reaches the device through the command buffer's handle at each use (core.device()) instead of cloning it; the pushed set-zero count is added after command_reaching_pushed rather than inside its closure. Why: every Device clone and drop is two SeqCst read-modify-writes, on the Arc<DeviceShared> strong count and on Holds::program, lines every thread of the device writes. The three clones were ~80 of the ~111 such RMWs per command buffer of 5 compute encoders x 1 dispatch (msi, locked-instruction samples), and two threads encoding at once each pay the other's writes. A probe of exactly these three borrows (msi P-cores, lavapipe, exclusive): thread CPU per dispatch spawned alone 3598 -> 3538 ns, two threads on one queue ~4290 -> 4238, on two queues ~4288 -> 4135. How verified (lane walkshare): msi P-cores, lavapipe, release, exclusive, thread CPU per dispatch (5 dispatches a command buffer), mean of 2 runs, before m3-max-37602 (5126f153ca) and after m3-max-37631 (c55c8666d9): alone on the calling thread 3341 -> 3226 ns (-3.4%), alone spawned 3621 -> 3466 (-4.3%), two threads on one queue 4306 -> 4039 (-6.2%), on two queues 4250 -> 4046 (-4.8%); per command buffer two walks on one queue 21.5 -> 20.2 us. The lavapipe compute, dispatch, encoder and shadow suites 143/143 (m3-max-37603). Clippy plain 0 (m3-max-37644) and m2v_cpu_icd 0 (m3-max-37646) at 06b683f292; m2v_gpu clippy and rustdoc follow on development (m3-max-37645). With: dispatch_chain --queue-each (each encoding thread a queue of its own) and --spawned (one encoding thread started each run, as several run), measurement flags only; shadow planning passes the borrowed device on as it is (clippy needless_borrow). shadow_copies keeps its own device handle on its work path (copies to make, rare), where what it takes from the device lives across calls on the encoder. |
||
|
|
24a0613783 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
ebfc82f564 |
RUNTIME 2473: A dispatch left to its host step holds what its tables bind from its call
A rebind racing a compute encoder whose dispatch is left to its host step
failed the command buffer EncodedUseRebound (the threaded run's host-step
family, intermittently; the consumer's answer table ends the VM on that
kind). The cause: ComputeCommandEncoder::defer_dispatch cloned the encoder's
ArgumentTable into the ArgumentDispatch and never retained it, so the encoder
held none of the buffers the table binds (only the arguments or stage-in
region buffer that copy_arguments copies). At the commit, steps_hold keeps the
command buffer's holds until it completes, which is what the rebind.rs docs
promise ("counts as uncommitted until it completed: a rebind meanwhile is
refused"), but the bound buffer was not among them. The host step's own core
held the buffer only while it recorded (Holds::new at the step's start; the
segment core's Holds drop at end_segment). So a rebind could:
- overlap the step's recording: its hold then found the publish closed past
its start, Taken::raced, and the segment's submission failed;
- or land between end_segment and the segment's batch submission: failing_at
found the pin moved.
Both fail as ReboundAt::Segment(HostStep). 2468's gate covers only the
encoder's own calls, and 2470's hold to submission is the else-branch of
steps_hold, so neither reached it.
The fix: defer_dispatch retains the encoder's table into its core
(ArgumentTable::retain), as a recorded dispatch's record() does. That keeps
the bound keys and holds each buffer over host pages among them, and
steps_hold keeps those holds until completion. So a rebind from the
dispatch's call on is refused (EncodedUses, Unreplaced::Held), never failing
the command buffer later.
- Both defer forms take it. dispatch_resident's Direct form (an indirect
stage-in region set) and dispatch_indirect_resident's Indirect form both
reach defer_dispatch, whose first statement is the retain.
- The hold is taken inside the dispatch's call, which is gated
(ComputeCommandEncoder::logged -> begin_call -> CallGate, every compute
encoder from its open). No rebind's publish overlaps it, so it never finds
a race.
- Cost: nothing for an encoder that leaves no dispatch to its host step. For
one that does, one retain per deferred dispatch, as a recorded dispatch
pays.
Deadlock audit, by lock: ArgumentTable::retain takes the table's `retained`
lock, then retain_into -> touch_keys -> Holds::hold takes rebinds.buffers. That
is table.retained -> buffers, the order record() already takes at every
recorded dispatch (compute.rs, tables.table.retain(core)). The predication
state lock taken just after for the host gate is a temporary, released
before. Nothing waits on the new hold: a rebind finds `pending` and is
refused, so no cycle can form.
Side effect, closer to Metal: the bound resources join the encoder's used
keys from the dispatch's call (used_resources, ended_encoders,
CommandBuffer::used_resources for detach_backing). Before, they were listed
only once the host step recorded. Metal knows a dispatch's resources at the
call. A detached buffer bound to such a dispatch now pins Detached at the
encoder, as a recorded dispatch's binding does.
Control: the previous commit's
a_rebind_while_a_host_step_records_a_dispatch_of_the_buffer_is_refused.
With: Rebinds: a control of a rebind while a host step records a dispatch of the buffer (1b5b6553a6, test only).
Checks at the lane tip 2fed4f8f75: clippy -p metal2vulkan-runtime --all-targets --all-features 0 and the m2v_cpu_icd test build in m3-max-37590 (msi); the control and the rebind, host_step, indirect, predication and pending suites on lavapipe, the threaded test 20 times, the negative control, clippy m2v_gpu/m2v_cpu_icd and rustdoc follow on development.
|
||
|
|
7092110549 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
7055ff84c5 |
RUNTIME 2472: Compute encoders move as one pointer, and a core ends in its box
ComputeCommandEncoder held its whole state (888 bytes) by value, so its open's return, each move by a caller (a consumer that boxes it copies it into the box), and end_encoding's self each copied it whole. Its state now lies in a box of its own (Body), and the encoder is that one pointer, as the render encoder already boxes its lowering. A core's end read the whole core out of its box onto the stack (EncoderCore::unboxed_apart in end_encoding) and passed it by value to end_with_replay, which took it apart again. end_with_replay now takes the boxed core, takes it apart where it ends, and hands its emptied box on: with a compute encoder's bind state to the command buffer's park (compute::Parking, then Parked), else back to the device's spares. The same Vulkan commands; no API change. Verified: tests::encoder_moves asserts the encoder is one pointer (it was 888 bytes against the old bound of 1 KiB). With: Compute encoders: fields through the body box everywhere; end_with_replay over a boxed or held core; end_with_replay: take the held core through one plain reference until it is taken apart. Why: a compute encoder was 888 bytes moved by value through open, the caller's Box::new and end, and its core was read out of its box whole at its end (reims decodecost: large-value memcpy 4.0% of the decoder thread). Now a move copies 8 bytes and the core is taken apart inside its box. Measured (lane encbox, msi lavapipe, dispatch_chain --dispatches 5 --groups 64 --only encoders, release, base/tip alternated twice, m3-max-37522): encode per encoder 4613 -> 4465 ns (-0.15 us), end 1102 -> 1013 ns; thread CPU 6645 -> 6488 ns. Below the 0.3 us bar for a perf claim; kept as a built, structural, measured-positive change. Checks: clippy plain, m2v_cpu_icd, m2v_gpu (-p metal2vulkan-runtime, all targets, all features) 0 in m3-max-37545; tests::encoder_moves asserts the encoder is one pointer; the lavapipe compute/encoder/render/blit suites (m3-max-37547) and rustdoc follow on development. |
||
|
|
db7a122086 |
Re-pin the runtime sources at the landing tip
The landed packet changed a runtime-sources input, so the committed digest no longer described the sources and `the_runtime_sources_are_the_committed_ones` would fail. Recomputed over the same inputs and committed by land-pkt.sh. |
||
|
|
ea9feeb12f |
RUNTIME 2471: A variant refusal is kept in the device's memo: asked once a device, said once in the log
What: the device's memo of compiled pipelines now keeps the compile layer's Unsupported refusal of a function under that function's FunctionCompileKey, the key its compiled function is kept under. Sources::function answers a later ask of the same key from it, translating nothing. A dispatch's variant answered this way gets no pipeline creation log line (Variant::compile asks Sources::refusal_kept), so the log says each such refusal once a device. Only Unsupported is kept, which the translator holds permanent for its input on the device's profile (Error::is_permanent_for). A deadline, a cancellation, a failed allocation or any other error is never kept. The entry sits in the memo's one LRU under its byte and entry bounds, weighed at what it holds, and a recovery's carry_from takes it with the rest. Why: each compute state already remembers its own flat, folded, replay and partial-threadgroups refusals (Program's *_refused flags). But a state made again of the same function starts with clear flags, and the memo kept successes only. So every new state's first indirect or ragged dispatch asked the compile layer for the refused variant again: one declined line and one refused translation per state. A guest that makes many states of one kernel logged the line thousands of times. Which form a dispatch runs, and what it answers, are unchanged: the state still records the refusal and takes the same other form. Test: tests::declined_once (lavapipe or GPU cfgs). A child process with the log on makes 4 states of one threadgroup-barrier kernel, 4 indirect threadgroup dispatches each, and checks every dispatch's words. The parent asserts 1 refused translation (a test-only counter in sources.rs) and 1 declined line. Checks (lane declineonce): lavapipe tests::declined_once in m3-max-37374: 4 states of one kernel, 4 indirect dispatches each, every word checked: 1 translation refused, 1 declined line (the control without the memo follows); clippy -p metal2vulkan-runtime all targets all features 0 plain (m3-max-37377), m2v_cpu_icd (37374), m2v_gpu (37379). Compute pipeline suites (m3-max-37387) and rustdoc follow on development. |
||
|
|
74e0d61851 |
rebind_reach: made_once is unused since the unit test asserts the refusal
m3-max-37369 (msi): clippy under --cfg m2v_cpu_icd and --cfg m2v_gpu at 5bfab2beaa failed on the unused import; rustdoc -D warnings passed. |
||
|
|
6904306929 |
Re-bless at SEMANTICS 2139: golden hashes, the new fixture's rows and printout, the census
m3-max-37348 (M3, at
|