Repository navigation
Conversation
How one console wave64 runs as two 32-lane host waves under our per-lane structurisation, what has to cross halves, why exchanges need uniform regions, how to test on a machine with both GPU kinds, and the order of the remaining steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A compute shader that reads other lanes declares the console's wave size. NVIDIA runs waves of 32 lanes only (D3D12 reports 32..32), so a console wave64 program of that kind was refused at pipeline creation and its dispatches were dropped without saying why. The host's wave range (D3D12 options 1) now goes into translation as `emit::Target`. A shader that needs a wave size the host does not run stops there with the reason, the shader cache keys entries by the range, and the run logs the range once with a warning when 64-lane waves are missing. `victory translate --host-lanes 32-32` counts these shaders without a GPU. This is the first step towards running these programs as two 32-lane waves on such hosts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`emit::host::Host::on(name)` and `VICTORY_ADAPTER` choose a hardware adapter by part of its description, and `adapters()` lists them, so a machine with an AMD and an NVIDIA GPU can run a test on each: the native wave64 form as the reference on the one with 64-lane waves, the 32-lane form on the other. A new test checks on every adapter that a wave64 program reading other lanes translates exactly when the adapter runs 64-lane waves, and that the adapter then takes it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On a host without 64-lane waves (NVIDIA), a console wave64 compute program whose lanes read only their own 32-lane half (DPP, ds_swizzle) now declares WaveSize(32) instead of failing to translate. It must read no mask whole, test no bit of a mask held as a number, have no whole-wave sections and use no LDS. Every other wave64 program that depends on the lane layout still stops with the reason from the previous step. Mask ballots, wave reductions and lane-bit tests refuse the split form as a safety net. New GPU tests run hand-assembled programs on every hardware adapter and check each lane against the console's layout. On an RTX 5070 the split form is exact for 1-D groups of 32, 64 and 128 threads and for 3-D groups up to 8x8x4. A Radeon iGPU runs the same programs natively as the reference, and a read across halves (v_readlane 40) still needs 64-lane waves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A console wave64 program that reads masks whole or lanes of the other
half now runs on a host without 64-lane waves when its group is one
console wave (64 threads or fewer, no LDS). It runs as the console
does ("console flow"):
- `structure::structure_console` never resolves mask joins from what
the lanes arriving know (every lane arrives); `Structured::execs`
gives each vector instruction's EXEC bit.
- Vector instructions are guarded by EXEC. Branches are the console's
s_cbranch_*: EXEC, VCC and mask-operation SCC tests are the console
wave's, from both halves' ballots exchanged through group-shared
memory between group barriers, which every thread reaches since both
halves branch alike.
- Masks read whole are the exchanged ballots. v_readlane and
v_readfirstlane read the owning half; v_writelane, v_mbcnt and mask
bit tests use the console lane.
The per-lane form is tried first; a program that needs the console
flow is lowered again from the console structure.
GPU tests on an RTX 5070 are exact against the console: s_bcnt1 over
both halves (64, 48 and 32 threads), v_readlane 40, an exchange inside
a branch only the lower half takes, and a loop the halves leave at
different iterations with a lane read in each. The last one shows that
the per-lane form, which hosts with 64-lane waves get, is wrong for it
(on a Radeon iGPU): noted in docs/wave64-on-wave32.md, not changed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A wave64 program split over two 32-lane waves took the DPP row index from the host lane, so the upper half (console rows 2 and 3) read row_mask bits 0 and 1. The row now comes from the console lane there. New test: v_mov_b32_dpp with row_mask:0x3 writes lanes 0 to 31 only, exact on an RTX 5070 (split) and a Radeon iGPU (native). Found in review against Marvisak#189 and Marvisak#192, which both get this right. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
v_readfirstlane reads the console wave's first lane. A wave64 program with DPP or ds_swizzle and a v_readfirstlane was split into two 32-lane waves, where the upper half read its own first lane: with all 64 lanes active, lanes 32 to 63 got lane 32's value where the console gives lane 0's (measured on an RTX 5070). Such programs now take the console flow, which reads the first lane in EXEC of the whole console wave (groups of at most 64 threads, no LDS), or stop with the reason as they did before the split existed. New test, exact on an RTX 5070 and a Radeon iGPU. Found by running the same program against Marvisak#192, which has the same result on both adapters. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…the console flow On the console v_readlane and v_writelane ignore EXEC, and a wave runs a loop while any of its lanes does. The per-lane form runs branches and loops per lane, so a lane that left a loop or skipped a branch is not there to be read or written, and never sees the scalars set inside (Marvisak#225): - a loop lane t runs t times, reading lane L in each iteration: 12 of 32 lanes wrong in waves of 32 (RTX 5070, Radeon iGPU), 24 of 64 in waves of 64 (Radeon); - v_writelane to lane 40 inside a branch only lanes below 20 take: lane 40 was never written. A compute program with v_readlane or v_writelane, a branch that is not uniform, no ds_(b)permute and no whole-wave sections now runs in the console flow on every host. Where the host runs the console's wave size, one host wave is the console wave: ballots are the wave's own and nothing is exchanged, so any group size and LDS are fine. A program the console flow cannot lower keeps the per-lane form (`Parts::per_lane_only`), so nothing that translated before is refused. Both cases are now exact on an RTX 5070 (wave32 natively, wave64 in two halves) and on a Radeon iGPU (both natively). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The loop form compilers emit keeps the lanes that are done in an exit mask that starts as 0 (s_mov_b64 s[2:3], 0; in the loop s_or_b64 s[2:3], vcc, s[2:3] and s_andn2_b64 exec, exec, s[2:3]). In the console flow every mask join is a phi, and its incoming values had to be masks derived from EXEC or a VALU result, so such a loop stopped with "a lane-mask join of an untracked mask". `Structured::others` gives the lane's bit of the other values read as masks (constants, uniform selects, opaque ones), and the console flow's mask joins take them. The per-lane form is unchanged. New test: a loop in that form with a lane read in every iteration and the exit mask counted afterwards. It was refused on an RTX 5070 before and is exact there (in two halves) and on a Radeon iGPU now. Found through the test report on Marvisak#233 that tried Marvisak#269's programs. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Drivers create pipelines from some modules the DXIL validator refuses (D3D12 checks only the container hash we write). The hand-assembled split and console-flow programs now go through dxil.dll's validator before pipeline creation, where one is installed. All of them pass. Prompted by a report on Marvisak#233 of pipelines created from modules that fail validation. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
On the console one wave shares LDS without s_barrier, because it runs an instruction in all 64 lanes before the next. A wave64 program of one console wave per group that uses LDS stopped on hosts without 64-lane waves (`a wave64 group sharing LDS without barriers`), and so did such a program with cross-lane reads. Both now take the console flow there. The halves reach every LDS access together, and a group barrier before each access puts it after every earlier one, whichever half made it. What still stops says why: a group of more than 64 threads, ds_permute across the halves, or a whole-wave section. Two new tests (LDS written and read across the halves, one with the lower half kept busy first) are exact on an RTX 5070 and a Radeon iGPU. They also pass on the RTX 5070 with the barrier left out, so they check the result, not that the barrier is needed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The validator's message for an operation the stage or the entry's
properties do not allow ("Entry function performs some operation that
is incompatible with the shader stage or other entry properties") names
neither the operation nor the property, and it is the only message when
the call is in the entry function itself.
`victory translate --validate` now adds to each validator failure what
our own module declares and calls: its thread-group size, its wave size
and its dx.op operations (`emit::last_module_summary`, kept per thread
when a module is finished). Nothing of the console program is in it, so
a report of counts per reason is enough to see what the refused modules
have in common.
Prompted by a report on Marvisak#233: modules that fail validation with that
message and still create pipelines, 20 of them new with Marvisak#320, which I
cannot reproduce with hand-assembled programs.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The scan test of the previous commit goes through the carry of a prefix sum only. These cover the other branch, where each half's reduction is exchanged and combined: the sum of the lane ids, their maximum (in the upper half), their minimum (in the lower half) and their bitwise or, and a sum over a mask of lanes below 40, which straddles the halves. A group with a partial upper half, or none, still stops with the section's reason. All exact on an RTX 5070 (two halves) and a Radeon iGPU (native). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
One console wave with no s_barrier whose LDS write and read sit in different exec-masked blocks: every lane (or, after a 4096-iteration loop, only lanes 32..63) writes dword t, then lanes 0..31 read dword t + 32. A third case has the same masks with no branch around either access. Hand-assembled; exact on an RTX 5070 (two 32-lane waves, console flow) and a Radeon iGPU (one 64-lane wave). The pattern is the one a reviewer measured stale reads for on Marvisak#189. The console flow orders the first two cases twice: a branch on EXEC is decided by both halves through an exchange (a group barrier), and each LDS access has a group barrier before it, so they also pass with the second left out. The third has no branch, and with the barrier before each LDS access left out the lower half of the RTX 5070 reads 0 in 20 of 20 runs (exact in 20 of 20 with it): the first test here that fails without that barrier. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The startup warning on hosts without 64-lane waves still said every console wave64 compute program that reads other lanes is dropped, and its literal carried a run of spaces from a lost line continuation. It now says such programs run as two 32-lane waves where there is a form for them, and that the rest do not translate. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Cases for the ds_bpermute_b32 lowering of the commit before, each lane checked on an RTX 5070 (two 32-lane waves) and a Radeon iGPU (one 64-lane wave): EXEC over part of each half, two console waves per group, groups of 48 and 32 threads (a source lane that is not there reads 0), and beside a v_readlane across the halves, which takes the console flow on a host without 64-lane waves. Also formats that commit's new lines for this crate's line width, and the plan now lists ds_bpermute as an in-half read; ds_permute stays open. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
In the console flow on a host without 64-lane waves, a whole-wave section that leaves a float sum, minimum or maximum stopped with "a floating-point whole-wave operation across 32-lane halves". Each half's result now crosses as its bits, like the integer ones: minimum and maximum through FMin / FMax, a sum as the two halves' sums added last, and a prefix sum in the upper half adds the lower half's total. Groups of exactly 64 threads, as for integers. A sum's additions are in one more order than the console's and the host wave's own, so its last bits may differ, as they already may in one host wave. Tests (hand-assembled, each lane checked on an RTX 5070 and a Radeon iGPU): the lane ids as floats, their sum, maximum (in the upper half) and minimum (in the lower half) with identities 0.0, -inf and +inf, a sum over a mask that straddles the halves, and an inclusive prefix sum. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The wave64 plan had per-console-wave arrival counters with a bounded wait for groups of more than 64 threads. A wait is met only if the partner half runs meanwhile, which D3D12 does not promise and an RTX 5070 does not do in the LDS tests, so that plan is dropped. For programs without LDS, each console wave becomes a host group of its own (64 threads, the dispatch's x count multiplied), which is the console flow as it is. Groups that share LDS stay open, with the candidates named. The group sizes and counts come from an offline translate over a local copy of the title's shaders; no program content is in the document. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A v_cndmask_b32 whose selector derives from neither EXEC nor a compare (a constant, a number built from scalars) stopped with "a select on an untracked mask". In compute the lane can test its own bit of such a mask by its console lane, as guards on such masks already do: the select now takes the lane's bit from the structure's other masks, and a program with such a select declares the console's wave size like the ones that guard on them. Other stages are unchanged. The high dword of a wave64 mask held as a number was found only when one instruction wrote both dwords; written by two (s_mov_b32 each), lanes 32 to 63 tested the low dword's bits. The structure pass now records the pair a mask's reader takes, and that is used where no single writer exists. This applied to guards on such masks too. Test (hand-assembled, each lane checked on an RTX 5070 and a Radeon iGPU): a select on a mask of two constants and on one with a bit that depends on the group, as a wave64 and as a wave32 program, in groups of 64 and 32 threads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A loop-carried EXEC phi can depend on a latch phi that is not otherwise used. Discover deferred inputs before emitting mask phis, including inputs discovered while walking the deferred worklist. Extend the authored lane-read loop fixture by adding a second predecessor of the latch.
The test of the commit before dispatched on WARP only, which has no 32-lane waves, so it checked emission alone. It now runs like the other lane-read loop test: emitted for each hardware adapter's waves, validated, dispatched, and every lane compared (lane t stores t + 40). Exact on an RTX 5070 (two 32-lane waves) and a Radeon iGPU; without the structure change it stops with "a lane-mask join of an untracked mask". Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d masks Two defects found with a contributor's fixture (a waterfall loop over lane classes with a whole-wave section inside, reported on Marvisak#439). A mask copied dword by dword (EXEC restored with two s_mov_b32) is held as a number, and that number is known only as the mask's own dword. In the console flow the lowering followed that in a circle until the stack ran out, which takes the process with it. It now stops with "an opaque lane mask". On a host that runs the console's wave size, a program with a lane read in a divergent branch took the console flow only if it had no whole-wave section, so one with both stopped with "a lane mask holding lanes elsewhere read as data" there while a 32-lane host ran it. The rule counted the lane reads sections make themselves; it now looks for a lane read or write outside the sections and lets sections be, which the console flow lowers as wave operations like the per-lane form. Such programs fall back to the per-lane form as before if the console flow cannot lower them. Tests (hand-assembled): a lane read in a branch beside a whole-wave sum, each lane checked on an RTX 5070 and a Radeon iGPU; and a mask copied dword by dword, which overflowed the stack before and stops now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A compute program with a numeric select declared the console's wave size whether or not anything read the select's result. On a host without 64-lane waves that refused a wave64 program in a group of more than 64 threads only for a select nothing consumes, where it translated before selects on numeric masks were lowered. The ordinary lowering now runs first. Only when it stops on a select with an untracked mask is the program lowered again with numeric selects counted among the masks held as numbers. From r4tedx#5 (MichaelSmithAI). Picked onto shader/console-flow-lds by r4.: the selector scan iterates every instruction here (the tester tree's `live()` filter is another PR's), and the new lines are formatted for this crate.
The in-half form cannot read the high word of a numeric mask. Let an unused select drop out and use the existing full-wave retry when its result is needed. Exercise both cases alongside a live swizzle and DPP read.
Keep the host wave target and console-flow lowering while bringing in per-lane waterfall resource tracking. Use the structured program for resource tracking in translation and tests, and prefer proved per-lane descriptor reads before the general console read-first-lane path.
…th waterfall descriptors
…s with waterfall descriptors
* eval/overlap2: GPU: with overlap, a present waits behind the work its queue holds GPU: a present list does not hold the back buffer; completions are flagged once done GPU: the frame line counts every reason held work is released by GPU: a present's submission does not wait for the frame to clear read marks GPU: overlap only with VICTORY_GPU_OVERLAP=1; read marks cleared with none marking in flight GPU: a present keeps its frame's textures; read marks taken atomically; held work runs after any completion GPU: eviction takes read marks of submissions in flight first GPU: marks of views read alone let submissions overlap; three swap chain buffers GPU: the title's submissions return before the host GPU has run them
* eval/2461: GPU and shaders: a host's reported view heap size is the limit, before any heap is tried Revert "GPU: preserve title slots on capped view heaps" GPU: preserve title slots on capped view heaps Shader tests: the heap-buffer null-view test translates after the host's probe Shaders: the shader crate's own host lowers the view limit on a device that caps its heaps GPU and shaders: a host that caps its view heaps gets heaps at its cap, and shaders clamp to it
…into eval/perf Conflicts were the moved shader host helpers, the PR's `mod tests` file layout and the `Target` paths in the test files.
* eval/2634: victory-gpu: say once, not per slot, that the title's heap outgrew the host's
Unions: `pipeline.rs` keeps the BVH builder's `held_back` and the new `feeds`/`shown` helpers; `draw.rs`'s indirect drop checks `held_back` first and notes `not_made(kind == DISPATCH)`; `make.rs` is the same resolution as eval/2309-hurry's (sides identical there).
Conflict: the GPU timing guard in `Host::submit`. Kept Marvisak#3120's counter (`submitted.value`) and took the PR's `if timing()` guard in place of `if groups.len() > 1`.
Review of Marvisak#3378 (fuzeofficlal): three bugs in the hooks that note what a frame's passes read and write. State::not_made read a table UAV with `table + offset * 4` computed directly and handed to crate::descriptor::view, unlike table_entry and tables, which check self.heap_of first: a title binding a null root table (Root::Table(0)) with a non-zero table offset dereferenced a bogus address and crashed the child with 0xC0000005. The handle is now a checked_add that a bound heap must hold, so a null, stale or out-of-heap table names nothing. A null descriptor names nothing either. A null view (resource 0) made a phantom hub: a pass that bound a null SRV joined every pass that bound a null UAV, so an unrelated dropped pass whose writes nothing presented reads was pulled to the head of the queue. `feeds` now ignores 0 in reads, writes and targets, at the pass and in the graph. Graph::ran noted a pass that wrote nothing, which no walk can reach: its reads grew past NOTES_MAX while notes stayed put (10,000 writeless passes, notes 0), for a title that stops presenting while pipelines are queued. It now returns at once, as Graph::dropped did, and excludes null descriptors from its counts.
* fix/hurry-feeders: GPU: a dropped pass reads only descriptors a bound heap holds
Review of Marvisak#3378 (fuzeofficlal): three bugs in the hooks that note what a frame's passes read and write. State::not_made read a table UAV with `table + offset * 4` computed directly and handed to crate::descriptor::view, unlike table_entry and tables, which check self.heap_of first: a title binding a null root table (Root::Table(0)) with a non-zero table offset dereferenced a bogus address and crashed the child with 0xC0000005. The handle is now a checked_add that a bound heap must hold, so a null, stale or out-of-heap table names nothing. A null descriptor names nothing either. A null view (resource 0) made a phantom hub: a pass that bound a null SRV joined every pass that bound a null UAV, so an unrelated dropped pass whose writes nothing presented reads was pulled to the head of the queue. `feeds` now ignores 0 in reads, writes and targets, at the pass and in the graph. Graph::ran noted a pass that wrote nothing, which no walk can reach: its reads grew past NOTES_MAX while notes stayed put (10,000 writeless passes, notes 0), for a title that stops presenting while pipelines are queued. It now returns at once, as Graph::dropped did, and excludes null descriptors from its counts.
The Marvisak#2309 merge gave `heap_direct_texture_reads_mark_their_heap_index`'s `Parts` the `target`/`console_cf`/`per_lane_only` fields twice (its side and the PR's, both edited around Marvisak#2958's `view_marks: true`); the test target did not compile until they were one.
`feeds::Graph::ran` counts its notes without collecting the filtered reads and writes; the amended commit replaces the version merged from a123c31, so its side is taken whole.
PR head fc39e73 (survey head fc39e73, unchanged). Conflicts: host.rs (2), shadow.rs (1), all resolved keeping both intents: * host.rs `Deferred`: our `held` (keep_until_reset) and the PR's `vram_bitmaps`/`vram_probes` are separate fields; both kept. * host.rs `Host::run`: our removal check ("lists timed on their own ran here") and the PR's VRAM readback block are separate work; both kept, ours first. The PR's trailing `let gpu = prepared.elapsed()` is dropped: our tree moved that timing into `finish()` (`record.prepared.elapsed()`), so the binding would be unused. * shadow.rs: our `read_marks` and the PR's `has_vram_bitmaps`, `sync_bitmaps_pre/post`, `vram_marked_reads` are separate items; both kept. Adaptation git could not see: the PR's `upload_vram_copies` / `readback_vram_copies` / `run_copy_list` thread a `&mut u64` ahead of our `Submitted` struct (Marvisak#3120 overlap), and the value they bumped was only ever passed as `Some(_)`; `run_copy_list` now takes `wait: bool` and the counters are gone, so the copy lists never touch the title fence's `Submitted::value`. Semantic conflict: the PR's two new memory.rs tests (written against the older one-argument `pipeline(source)`) now call the four-argument helper as `pipeline(WRITE, D3D12_DESCRIPTOR_RANGE_TYPE_UAV, 2, 5)`, the same shape as the existing WRITE tests. No new switches: VRAM placement is unconditional when the device is not UMA.
…py-back) PR head cb7347b (survey head cb7347b, unchanged). One conflict in shadow.rs, two new tests appended at the same spot before the shared `unregister(p, p as u64); }` tail: Marvisak#3312's `vram_marked_view_writes_go_back_to_title` (ours) and the PR's `overlapping_snapshots_never_recopy_and_cross_segment_copy_back`. Both kept, each with its own closing brace; the shared tail closes the PR's test. No semantic change: they exercise different paths (VRAM readback on Host::execute vs. `writing`/`copy_back` bookkeeping). No new switches.
… without Marvisak#2848 PR head 586102f. One conflict, the shadow.rs test block: our Marvisak#3312 `vram_marked_view_writes_go_back_to_title` and Marvisak#3318 `overlapping_snapshots_never_recopy_and_cross_segment_copy_back` sit where the PR appends `parallel_marked_pages_go_back_and_retake_guards`. All three kept (our two take their own closing brace, the shared tail closes the PR's). The code side merges clean: the PR turns `copy_back_marked_with`'s own `vec![0u8; n]` per page into a borrow of the caller's buffer, and `copy_back_marks` keeps one pooled PAGE buffer per worker. Without Marvisak#2848 there is no `Back`, so this is where the per-page allocation goes away for good rather than being replaced twice.
PR head c673921. Same five conflicts and the same resolutions as the A-chain and B2-chain steps; `host.rs` and `indirect.rs` are byte-identical to `eval/perfE`'s after the merge, and `draw.rs` differs from it only by Marvisak#2848's stack user data, which this chain does not carry (verified with `git diff eval/perfE eval/perfE3`).
Marvisak#2472's batch clamp read its budget through RWByteAddressBuffer::Load and declared its root signature in a [RootSignature] attribute. Wine's D3DCompile refuses the first (E5005) and ignores the second, so on Wine batch_clamp() was None and every hoisted clamp fell back to a single one ('no batched argument clamp: falling back to inline'). As crate::compute (Marvisak#2969, after Marvisak#1279): the budget is a RWStructuredBuffer<uint> and the root signature is made in Rust (make_with), as record_prelude binds it. Test: every_clamp_compiles_without_a_root_signature_attribute (no device).
…amp-windows PR head 0c997d4 (with bdc4167's shared mesh group rule and dff6c00's test). Conflicts in draw.rs, external.rs, host.rs, indirect.rs; copystat.rs merged cleanly. Resolution, in `execute_indirect`: Marvisak#2472's hoist first (a draw in the list's non-writing prefix goes to the prelude); otherwise, with the switch on and a pipeline that does not store, the draw joins or opens a window; otherwise the single clamp, `bound(.., spread)`, which ends any open window first. `HoistedClamps::kept` replaces the window branch's `hoisted`. The single clamp keeps E3's Rust-built root signature (`make_with`) and its spread flag; the PR's `mesh_groups!` rule is shared by it and the window. The window shader is left as the PR has it (`[RootSignature]`, budget through `RWByteAddressBuffer::Load`), built by the PR's `compile`, now over `crate::compute::compile`. Wine's compiler rejects it; the next commit fixes that.
Marvisak#3197's window pass had the batched clamp's two Wine problems (5262259): its budget read through `RWByteAddressBuffer::Load`, which Wine's D3DCompile (vkd3d-shader) rejects with E5005, and its root signature in a `[RootSignature]` attribute Wine's ignores. So `window_clamp()` returned `None` there and every windowed draw fell back to a single clamp. The budget is a `RWStructuredBuffer<uint>`, as in the single and batched clamps, and the root signature is built in Rust (`make_with`) in the order `open` binds: t0..t3 the sources, t4 the table, u1 the budget, u0 the records. The tests' store shader is ported the same way, and the PR's root-signature-from-blob `compile` goes, unused. `every_clamp_compiles_without_a_root_signature_attribute` now covers the window shader too (D3DCompile only, no device; passes under Wine).
A draw joined Marvisak#2472's hoisted prefix or Marvisak#3197's window only if its pipeline had no view marks at all (`marks`, `view_marks`). But marks come in two kinds. A write mark is set beside a store or atomic through an unordered buffer view from the heap, and such a view is a table's, the heap's own or a root UAV's, so a stage that writes marks has one of those write flags anyway. A read mark is a bit in our own bitmap (u1 in the memory space), a host buffer that is never title memory and so never an argument or count buffer. The G-buffer's pixel shaders read-mark the textures they take from the heap and store nothing, yet every one of their indirect draws was clamped on its own. One predicate, `may_write_arguments`, decides both batches, from each stage's write flags: table UAVs (`used`), heap UAVs (`heap_writes`), root UAVs as root descriptors or as their heap views (`ROOT_UAV_VIEW`), and title memory (`memory`, `memory_writes`, the page table and its bitmap). It replaces `pipeline_writes_uav` and `may_store`; marks are no longer among them. `clamp_route` is that rule's one decision for an indirect execution: a dispatch or a writer is clamped on its own whatever the prelude has room for and whatever the window switch says, and its own clamp ends any open window first; anything else is hoisted if the prelude takes it, and otherwise joins a window. Diagnostics: the clamp line of the copy report is logged whatever the window switch, with the indirect draws hoisted to preludes and those of the hoisted and windowed that have read marks (the ones this rule lets in). Tests (CPU, no device): a_stage_that_only_read_marks_may_join_a_clamp_batch, a_table_uav_store_ends_a_clamp_batch, a_heap_store_ends_a_clamp_batch, a_root_uav_ends_a_clamp_batch, title_memory_ends_a_clamp_batch, a_read_marking_draw_may_join_a_window_and_the_writer_ends_it.
|
The CI failure is WARP's wave size, not the change. Your head
The fix is the same one let (mut ran, mut wave_skipped) = (0, false);
// ...
if !host.target().runs(32) {
eprintln!("{label}: no 32-lane waves; skipped");
wave_skipped = true;
continue;
}
// ...
assert!(ran > 0 || wave_skipped, "neither hardware nor WARP SM 6.6 device available");AI use: Claude Code (Claude Opus 5.5). |
WARP and 64-lane-only hardware skip the test for their wave size; the final assert now accepts that skip instead of reporting no device (suggested by @ColorMeBoom).
|
@ColorMeBoom thanks, that's exactly it, and thanks for running it on RDNA1 hardware. Taken as you proposed in For reviewers: this test isn't part of the read-mark rule. It comes from the stack this draft sits on (#2958's coalesced marks, compared with per-lane marks), which is why it shows up in this PR's diff against AI-assisted (Claude); measured on my machine, no game data shared. |
|
@neonbyte1 confirmed at
AI use: Claude Code (Claude Opus 5.5). |
Stacked on #2472 and #3197 (plus the Wine compile fix Slay326 is taking into #3197), so this is a draft until they land. The change to review is the last commit,
d4e44ed5(draw.rs,copystat.rs). Follow-up to #3197 as Slay326 asked there.What's wrong
#2472's hoist and #3197's window both refuse every pipeline that has view marks at all
(
pipeline_writes_uavtestedp.marks.is_some(),may_storetestsmarksandview_marks). Nearly every pixel shader in the title read-marks the textures it takes fromthe heap, so the hoisted prefix ends at the first G-buffer draw and almost every G-buffer
draw is clamped on its own. On my stack (RTX 5090, Wine + vkd3d-proton) that is 4,909
single clamps a frame, 35.4 ms of GPU command time; with the rule 1,133 clamps and 9.7 ms
(155.4 → 64.8 ms of command time a frame, 398 → 311 ms a frame in game).
The rule, and why it is safe
Marks come in two kinds, and only one of them can write an argument.
the heap.
mark_view_writeonly marks handles inview_index, and onlyheap_handle(heap-made views) puts them there; such a view is a table's, the heap's own, or a root
UAV's view, so a stage that writes marks has one of those write flags anyway. The page
table's write handle was removed from
view_index, and title-memory writes go throughmemory.u1(VIEW_WRITES) inMEMORY_SPACE. Thatbuffer is host-owned and is never title memory, so it can never be an argument or count
buffer.
So a stage with marks and none of the write flags only sets read marks, and a draw or
dispatch whose only extra write is that bitmap cannot change what any later execution
reads as arguments. The DXIL of the census shaders agrees: the G-buffer pixel shaders
(
43e24028,94d28115,62f761fb) and the mesh shaders (b7a81f5b,df4b2c77) have nostore op at all, and the one handle they write through is
createHandleFromBinding(.. [1, 1, 2, i8 1]), props4107(a typed buffer), written onlyby read-mark atomics (7, 29, 29, 1, 4 of them); every other handle they make is read.
43fba464(one store) and5ad3a82b(ten) also store through a heap texture UAV, and theystill clamp on their own.
What changes
One predicate, one decision.
draw::may_write_arguments(withdraw::stage_may_write_arguments) replacespipeline_writes_uavandmay_storeand testsonly the write flags: table UAVs (
used), heap writes (heap_writes), root UAVs as rootdescriptors or as their heap views (
ROOT_UAV_VIEW), and title memory (memory,memory_writes, and the stage'smemory/memory_dirty).marksandview_marksare notamong them.
draw::clamp_routeis that rule's decision, andexecute_indirectasks it once:the prelude has room for and whatever the window switch says;
window when
VICTORY_CLAMP_WINDOW=1(GPU: clamp consecutive indirect draws in one pass (VICTORY_CLAMP_WINDOW, opt-in) #3197), else clamped on its own.bindends the hoisted prefix with the same predicate when a command writes. A draw thatmay write and is clamped on its own goes through
crate::indirect::bound, which callsend_windowfirst, so the writer always ends the window: no later record can be clampedby a pass that runs after the writer's stores, and the writer's own clamp is not moved
before the window's earlier draws' reads.
Titles are unaffected: nothing about which draws run, in which order, or what they read
changes. Only the record clamp of an indirect draw moves, from its own pass into a pass
that runs before the same draw. Diagnostics:
clamps per frame:is now logged whateverthe switch and splits passes into singles and windows, with draws per window, draws
hoisted to preludes, the hoisted/windowed ones this rule let in (
ClampReadMarked), andthe ones left alone as they may write arguments (
ClampStoring).Tests (CPU, no device)
draw::tests::a_stage_that_only_read_marks_may_join_a_clamp_batchdraw::tests::a_table_uav_store_ends_a_clamp_batchdraw::tests::a_heap_store_ends_a_clamp_batchdraw::tests::a_root_uav_ends_a_clamp_batch(root descriptor, stage facts,ROOT_UAV_VIEW; aROOT_SRV_VIEWdoes not disqualify)draw::tests::title_memory_ends_a_clamp_batch(shader flags, stagememoryandmemory_dirty)draw::tests::a_read_marking_draw_may_join_a_window_and_the_writer_ends_it: aread-marking draw joins a window, the argument-writing draw after it is clamped alone
(which ends the window) and the next read-marking draw opens a new one; the writer is not
hoisted even with a free prelude, a dispatch is never hoisted or windowed.
indirect::tests::every_clamp_compiles_without_a_root_signature_attributestill coversthe single, batched and window shaders.
Measured share of the rule (perf stack, #2472 + #3197 + the Wine fix)
Same tree (
perf/best2), same binary but for this commit reverted, same switches(
VICTORY_GPU_OVERLAP=1 VICTORY_CLAMP_WINDOW=1 VICTORY_LOG=info), 420 s runs, medians of thelast 30 heavy reports; RTX 5090, Wine + vkd3d-proton:
on the GPUOverlap
Because the rule gates both, this branch is stacked: GPU: clamp consecutive indirect draws in one pass (VICTORY_CLAMP_WINDOW, opt-in) #3197's head
0c997d40merged ontoGPU: hoist and batch indirect argument clamps into the list prelude #2472 as
055b5c89, the Wine compile fix916655cc(Slay326 is taking that into GPU: clamp consecutive indirect draws in one pass (VICTORY_CLAMP_WINDOW, opt-in) #3197with my authorship), then the rule as one commit. Against
0c997d40the branch thereforealso shows GPU: hoist and batch indirect argument clamps into the list prelude #2472 and our fork's history (59 files); the change to review is
d4e44ed5alone —
git diff 916655cc d4e44ed5,draw.rsandcopystat.rs— or rebased onto yourhead once GPU: hoist and batch indirect argument clamps into the list prelude #2472 and
916655ccare in.storing draw join a window as its last member and end the window right after it is
recorded, mine widens which draws may be ordinary members. Both go through
indirect::windowedand both end the window before anything that follows can beclamped. His next step (track written table UAVs instead of every table UAV,
stores()counts
used, not written) would narrow the predicate further; I keepusedbecause atable's UAV is not classified read or written here yet.
VICTORY_CLAMP_WINDOWstays off by default, as you asked. The rule helps with theswitch either way: without windows it extends the hoisted prefix, with them it fills the
windows.
AI-assisted (Claude); measured on my machine, no game data shared.