ac7dffa3fdbf940c149d1539697265cfb3604e2a
6268
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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
|
||
|
|
cda5fd8f02 |
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. |
||
|
|
3a3d31c374 |
RUNTIME 2470: Rebinds: a rebind before the submission of an encoder no rebind encodes again is refused
A rebind between a command buffer's commit and the submission of its last event group, of a buffer an encoder of it named that keeps no log (a compute encoder its unit of command predication reaches past, a loop's laying, a render encoder opened while no buffer over host pages existed), failed that submission EncodedUseRebound: the commit let go of its holds, and nothing encodes the encoder again. The consumer's answer table ends the VM on that kind. Now the rebind is refused instead (EncodedUses), and the command buffer runs over the pages it was encoded over. - State::keep_replays also answers whether an encoder that keeps no log (not one its commit fails, which runs nothing) named a buffer over host pages, by its own commands or by work it left for later not recorded on the GPU alone (State::unlogged_names_a_pin). - Where so, the commit keeps the command buffer's holds (State::held_to_submission) instead of letting them go: Holds::hold_to_submission moves each from Entry::pending to a new Entry::unsubmitted under one lock of `buffers`, so no rebind falls between. They go as the last event group's first batch is submitted (State::first_submission, State::later_group), or at completion; a rebind after that keeps the old pages for the submitted work, as before. - replace and the rebind's first check refuse while `unsubmitted > 0`, counted as their own reason: WorkCounts::rebinds_refused_unsubmitted. - Cost: nothing new for a command buffer whose encoders a rebind encodes again (one pass over its ended encoders' flags at the commit, inside keep_replays). A host-step command buffer keeps holding to completion (steps_hold), unchanged. Deadlock audit, by lock: - Commit: hold_to_submission takes `buffers` under the command buffer's `state` lock: state -> buffers, the order encode_moved's Submitting and the commit's own clear of its holds already take. - Submission: the holds go under the scheduler's lock and `state`, after the `Submitting` guard (`buffers`) was dropped; each Holds' drop takes `buffers` alone: scheduler -> state -> buffers, the order the submission's judging already takes. Never under `buffers` itself. - Completion: moved out of `state` and dropped after its lock, with the submitted holds. - Nothing waits on them: a rebind finds `unsubmitted` and is refused; no wait is added anywhere, so no cycle can form. Tests (lavapipe): rebind_races gains a control (the predicated family committed behind an unsignaled shared-event wait, rebound before the signal: refused, completes over the old page, refused-unsubmitted 1), and the threaded run asserts no command buffer fails EncodedUseRebound. Tests that asserted the old outcome of such a rebind now assert the refusal and a completion over the old pages: pending_rebind, rebind_loop_check's rebind before the laying's submission, tile_rebind_making_wait's unlogged tile pass, and validation's rebind_reach test of a unit's encoder that laid its first step. The validation lane no longer has a test that announces encoded-use-rebound (degrade_notices says so). Docs: rebind.rs module docs (ordering rule, a predicated loop's laying), Buffer::rebind_bytes_no_copy, RebindProblem::EncodedUses, the encoded-use-rebound catalogue entry and its declaration, runtime README; api_signatures blessed. Follow-ups in the same landing: Rebinds: a state's reset takes held_to_submission fresh too; Rebinds: clippy (append, take) in the hold-to-submission moves. Checks (lane rebindsafe2): clippy plain (runtime, validation) 0 at 5bfab2beaa in m3-max-37364; lavapipe runtime tests 356/356 at a0fc57f283 (m3-max-37354: rebind, detach, host_page, host_step, indirect, predication, pending, holds, encoder_fold, deferred_calls), the new control refused with refused-unsubmitted 1 and the threaded run asserting 0 EncodedUseRebound. Validation lavapipe (m3-max-37365), rustdoc and the cfg clippy runs follow on development. |
||
|
|
4806a79c68 |
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. |
||
|
|
c8484ddf0f |
SEMANTICS 2139: An attribute read only into a gated-off output is not read
What: canon's unobserved_code kept every value-only instruction that a surviving
one reads. The returned struct's insertvalue chain stays because the return reads
it, so an insert into the field of an output a function constant gates off (or of a
field a later insert sets again) kept its inserted value alive, and with it the
value's whole computation and the parameter it read. Such an insert now inserts
`undef` in place of a value the observation does not observe (unread_inserts), and
kept_reads follows only its aggregate, so the computation and the parameter's read
go. lower::users::params_used, and with it pipeline::compile::declared_attributes,
then leave out a vertex attribute that reaches only a gated-off varying, and the
vertex projection no longer refuses a descriptor without it.
Why: a render pipeline was refused InvalidDescriptor(VertexAttribute { attribute: 1 }).
Its vertex function reads attribute 1 through one phi into a varying whose
air.function_constant predicate is false in the pipeline's constants. Metal reports
that attribute inactive and makes the pipeline from a descriptor without it. A live
attribute the descriptor lacks stays refused, as Metal refuses it.
Oracle (m3-max-37322, Apple M3 Max, macOS 27.0.1, validation layer off and on), the
new owned fixture fca_vertex_unread_attribute: constant false: attribute 1 active 0,
a descriptor of attribute 0 alone makes the pipeline, texel (64, 128, 191, 255);
constant true: attribute 1 active 1, that descriptor is refused ("Vertex attribute
color(1) is missing from the vertex descriptor"), both attributes draw
(191, 64, 64, 191).
Tests: tests::engine_unread_attribute (six committed profiles: gated off links
with attribute 0 alone and every stage passes L3; gated on refuses
VertexAttribute{1} without it and links with both); the runtime device test
tests::unread_attribute (the same three states, drawn, pixels compared with
Metal's). The lane's job reports and its negative control are in the tip report.
With 9a15486547: Owned fixture: an ungated vertex attribute that reaches only a gated-off varying.
Checks (lane deadattr): clippy plain (-p metal2vulkan-air -p metal2vulkan -p metal2vulkan-runtime, all targets, all features) 0 in m3-max-37340. Oracle m3-max-37322 (M3 Max, macOS 27.0.1, validation off and on): constant off, attribute 1 inactive and a descriptor of attribute 0 alone makes the pipeline; constant on, that descriptor is refused ("Vertex attribute color(1) is missing"). The air and translator suites, the negative control and the lavapipe draw (m3-max-37341) follow on development; golden and census re-bless on development.
|
||
|
|
e2922ae77c |
rebind_races: the two RUNTIME 2465 controls race blits, as compute calls are gated now
With compute calls gated, the hold control's dispatch refuses the rebind (its call is under way) and the publish control's dispatch waits for the held publish to close, which the test itself holds: both hung in m3-max-37299 (lavapipe, msi), the hold one because the expect panicked inside the scope before letting the paused thread go. They now run blits, which log every call and are encoded again after a race: a copy from the buffer held at its hold, and a copy from the texture over the buffer during the held publish. The hold control lets the paused thread go before it checks the rebind's answer, so a failure fails instead of hanging. Verified: m3-max-37299 at ec3cbb49c7, 313 of 315 filtered lavapipe tests passed (rebind, detach, host pages, host step, indirect, predication, pending, holds), the new gated control and the six-family threaded run among them; the two hung are these. The next job runs them. Why now: on development since RUNTIME 2468 both controls hang (m3-max-37299: the hold control's dispatch refused the rebind and its expect panicked inside the thread scope while the paused thread waited; the publish control's dispatch waited for a publish the test itself held). Verified (lane rebindsafe2): m3-max-37319 (msi lavapipe) all 4 rebind_races tests pass, the gated control refused EncodedUses, the six-family threaded run 0 wrong outputs; m3-max-37318 clippy m2v_cpu_icd and m2v_gpu cfgs 0. Test code only: no RUNTIME bump. |
||
|
|
4db18374c0 |
Re-bless the authored compile census at SEMANTICS 2138
The census (m3-max-37276, at
|
||
|
|
f10ecb62cf |
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. |
||
|
|
08e584e114 |
RUNTIME 2469: Scheduler: undo the burst linger (cut 2 of RUNTIME 2467); passing holds stay
What: removes the scheduler thread's stay-awake through a burst of commit_and_submit calls
(Burst, BURST_WINDOW, Inbox::pass_each's linger, the wake within a burst), its docs in
CommandBuffer::commit_and_submit, the runtime README and the scheduler and inbox module docs,
and its tests (tests::inbox's lingering-pass test, tests::commit_and_submit's back-to-back burst
test, and tests::scheduler_wakes' sleep of BURST_WINDOW between isolated commits). The
scheduler, the inbox and those tests are again as they were before RUNTIME 2467. Kept from
2467: the passing holds' signal only where a making waits (resource_ids.rs) and dispatch_chain's
latency, busy and idle lines.
Why: the hand-off misses its condition, that commit -> submission inside a burst gets no worse
at p99. Commit-call time per command buffer fell (RADV PHOENIX 34.4 -> 14.7 us, msi lavapipe
9.1-10.0 -> 4.3-6.3 us). But commit -> kernel start inside a burst rose at p99: msi lavapipe
11-12 -> 20-28 us (steady state 7.6-8.2 -> 9.9-14.3 us); RADV PHOENIX under
CompletionPolicy::Grouped 34 us -> 1.06 ms and commit -> GPU start 181 us -> 1.25 ms, where the
thread's passes kept burst batches in groups that the committer's would have sent alone; and
with two committing threads on an oversubscribed host (gem10, load 22 on 16 threads) 96 us ->
1.45 ms, where a lingering thread that is preempted while counted holds every commit left to
it.
Verified: the lane's potluck job (build, clippy, the touched lavapipe tests), named in its report.
Why undone: RUNTIME 2467 cut the commit call 34.4 -> 14.7 us per command buffer on RADV PHOENIX, but raised commit-to-GPU-start p99 there from 181 us to 1.25 ms (the scheduler thread's own passes held burst batches in groups under Grouped), and two-thread p99 under host oversubscription from 96 us to 1.45 ms (a lingering thread preempted while counted holds every commit left to it). Cut 1 (passing holds) and the bench stay.
Verified (lane walkcpu): m3-max-37306 (msi): build 0, clippy plain 0, lavapipe touched suites 71/71 (commit_and_submit, scheduler_wakes, inbox, left, resource_ids, passing_holds, waiter_submits, submission_turns). The seven files are identical to
|
||
|
|
3271b20cf8 |
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. |
||
|
|
5acd27cd0d |
RUNTIME 2468: Rebinds: a call of an encoder the runtime cannot encode again never races a rebind
After RUNTIME 2465 a rebind racing an encoder call on another thread is detected and the encoder encoded again; one the runtime cannot encode again (a compute encoder its predication unit reaches past, one that left a GPU-written indirect dispatch to its host step, a render encoder that keeps no log) failed EncodedUseRebound at submission instead, which a consumer's answer table treats as fatal. The protocol: those encoders' calls are gated, so no publish overlaps one. - Rebinds gains `calls` (gated calls under way). A gated call begins (`Holds::begin_call` -> `CallGate::enter`): calls += 1, then reads `open`; where a publish is open it backs off and waits for it to close (`wait_published`), before it reads anything of a buffer over host pages. - A rebind's publish now opens before its replace (`Rebinds::quiet_calls`): open += 1, then reads `calls`; where a call is under way it waits for the calls to end (`drain`/`drained`), up to CALLS_DRAIN (2 ms), and is refused past it (EncodedUses, Unreplaced::Calls), never failing the encoder later. The four accesses are SeqCst (a store-buffering handshake: of a rebind and a call that meet, at least one reads the other's rise), so each gated call reads the buffer wholly before the publish (holding it, which refuses a rebind until its commit) or wholly after its close. Chosen over the registry lock: the call side costs two atomics and takes no lock. - Which encoders: every compute encoder, and a render encoder that opened with no log. A compute encoder can become unreplayable mid-encoding (the call that records predication, a loop's record, an unbalanced record that leaves work out, a later encoder of its unit that lays a loop, a dispatch left to its host step), after earlier calls ran: a gate that started at that transition would leave those earlier calls racing. So the gate covers a compute encoder from its open. Blit encoders always log, and render encoders with a log, stay re-encodable and pay nothing new. A device with no buffer over host pages pays one Relaxed load per gated call (`any`). - Nesting: a thread-local depth, so a call an encoder's call makes of its own public calls (a blit's unlogged calls, a loop's copies) never waits. - WorkCounts: rebinds_refused_calls_in_flight (the retry rate), encoder_calls_held_by_rebind, and encoders_raced_unreplayable (raced encoders committed with no log: each fails EncodedUseRebound; zero now). Deadlock audit, extending 2465's, by lock: - `drain`: taken by a rebind waiting for the calls (no other runtime lock held: rebind_host_pages holds no lock across replace) and by a gated call's end, which holds none of the runtime's at its end. Nothing is taken under it. - `buffers`: `unopen` takes it alone to lower `open` and notify `closed` (so a waiter between its check and its wait cannot miss it); a gated call's back-off waits on `closed` under it, holding at most its render deferral's `lowerer` lock (lowerer -> buffers is the order holds already take). No publish step takes `lowerer`; the rebind's `lower_all` runs before the publish opens. - The rebind's wait for calls is bounded (2 ms), so a gated call under way that waits on a thread held at a gated begin (a render end waiting for its lowering) ends in a refusal, not a deadlock. A gated call waits only as it begins, never under way, and the publish waits for nothing an encoder holds (2465's audit), so every begin's wait ends when the open publishes close. Docs: the Safety text of Buffer::rebind_bytes_no_copy and Heap::rebind_bytes_no_copy, the rebind.rs **Other threads** bullet and RebindProblem::EncodedUses state the new outcome: refused, never failed later, for the gated kinds. api_signatures.tsv gains the three fields. Tests (src/tests/rebind_races.rs): a pause-point control (a predicated dispatch, Unlogged::Predicated, held at its hold while the main thread rebinds: the rebind refused, the command buffer completes over the old page, refused-for-calls 1); the threaded run gains a predicated family and a host-step family (an indirect stage-in region, Unlogged::Segments), and asserts encoders_raced_unreplayable == 0. Follow-up in the same landing (cc0b4592a3): Rebinds: the refusal reason carries no pages (clippy: field never read). Unreplaced::Held and Unreplaced::Calls no longer give the new pages back: replace drops them once the registry's lock went (unopen drops the guard first), as the caller's map_err dropped them before. Also the docs of the encoded-use-rebound notice (degradation.rs, docs/API.md) and the runtime README say which encoders still fail it after a race (a blit or logged render encoder whose commit failed it, or whose encoding again a call that answers otherwise refused) and that gated calls never race. Verified: m3-max-37298 (msi) clippy at ec3cbb49c7 failed on exactly these two fields; the next job checks this commit. Checks (lane rebindsafe2): clippy plain (runtime, all targets, all features) 0 at cc0b4592a3 in m3-max-37302; lavapipe rebind/detach/host-page/host-step/indirect/predication/pending/holds suites with the gated control and the six-family threaded run in m3-max-37299 (ec3cbb49c7, same library code), the gate-off negative control, clippy GPU/CPU-ICD cfgs and rustdoc follow on development. |
||
|
|
80d1e277d0 |
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. |
||
|
|
e016e264c6 |
host_residency: the excess release loop lints clean where parked images are not built
Excess has its Parked variant on unix alone (RUNTIME 2464). Off unix the
release loop's let group = match excess { Excess::Group(group) => group }
is a single infallible arm, which clippy's infallible_destructuring_match
refuses under -D warnings: the runtime crate's clippy failed on Windows
(host_residency.rs:1200, job m3-max-37264 on the UHD 630 node, native
gnullvm, --cfg m2v_gpu --all-targets --all-features), as CI's clippy for the
Windows targets does.
A parked image is now released by a cfg(unix) if-let before the group is
taken, and Excess::group gives the group (None for a parked image), so the
loop is the same code on every target and unchanged in behaviour on unix.
Verified: Windows clippy in the job named in the lane's report.
Checks (lane d32s8): Windows clippy (runtime, all targets, all features, GPU cfg, x86_64-pc-windows-gnullvm) 0 in m3-max-37272 (it failed at development in m3-max-37264); msi m3-max-37281: Linux clippy plain 0, lavapipe host_residency and dma_buf_parked_images 10/10. Unix behaviour unchanged, so no RUNTIME bump.
|