Repository navigation
Shaders: twin descriptor loads and quad gradients for compute samples - #180
permadiego wants to merge 3 commits into
Conversation
A descriptor reloaded in each waterfall loop of a non-uniform index is read for its size bits by one load and used by another, so the first had no resource use and the program stopped. Its view kind now comes from a twin load: same opcode and offset, same base values, and the same register offset or a v_readfirstlane_b32 of the same VGPR value. image_sample and image_sample_b outside pixel shaders were emitted as sample/sampleBias, which validator 1.6 rejects there. The console takes the level from each quad of lanes, so they become sampleGrad with coarse gradients from the quad (a bias scales them by 2^bias). Over shaders.rpf: compute validated 1,662 -> 1,758 of 2,581, vertex and pixel 12,172 -> 12,183, none lost. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Tested
No game data used. |
|
Confirmed the twin-load fix on Windows with an RTX 3080 Ti (Wave32, driver 617.14) and the 10.0.26100 DXIL validator. I replayed 311 shader containers from a world-loading run, comparing the same inputs before and after integrating this PR, with #48 and #69 already present and without #136. All 60 shaders previously stopped by I also dispatched a synthetic compute shader which loads the same buffer descriptor twice, uses one load as the store handle, and reads dword 2 of the other as data. Binding raw UAVs of 28 and 76 bytes returned 28 and 76 respectively on both the hardware GPU and WARP. This is an integration test. The local port used physical wave lane indices for quad reads on the split-Wave64 path and restricted the twin lookup to the defining block. The title shaders were validated and had their pipelines created offline. Frame rendering and sampled texture values are still unverified. I also tested all 428 unique archive shaders whose baseline error was Further local follow-up on the remaining shaders in that descriptor cohort: after integrating #136, 41 still stopped at a lane-mask join and one still needed a descriptor-only read. Fixing spilled/numeric Wave32 mask joins and recognizing an exactly bound structured buffer from the original PSV0 resource declarations made all 42 validate and create D3D12 compute pipelines. The last shader was |
A join of registers that held a descriptor on one edge and data on
another failed the whole program ("a scalar memory read as data" or "a
descriptor read only as data"): the dwords now enter the phi as undef on
the descriptor edge. An eight-dword descriptor whose only reads are its
size bits, with no access in the program, is taken as a 2D texture for
getDimensions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the test run. The 36 that still said "a descriptor read only as data" were almost all
Full
🤖 Generated with Claude Code |
…nts for compute samples) into the integration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
|
An independent confirmation of the second cause in the description, and a note on how this meets #233. Confirmed. A whole-title
Why it matters beyond validation: one of those modules is the pipeline an older NVIDIA driver refuses after its shader compiler raises a first-chance exception. D3D12 does not validate what we sign, so these reach the driver as they are. With #233. The two conflict in one place in No game data used. AI-assisted. |
|
I checked the compute sampling change in
All 32 lanes matched on both an RTX 5090 and AMD Radeon Graphics. With the same fixture and pre-PR lowering from This covers the native Wave32 path with point sampling. The split-wave path and title rendering are outside the test. |
|
Follow-up to my note above: I have now built and run this PR together with the wave64 stack, where before I had only read the merge. Tested
On For testers: the combination is pushed as No game data used. AI-assisted. |
|
I extended the mip readback to the shared integration commit
The same four cases also passed with an LDS exchange. Each lane used the value from lane This is native D3D12 coverage of the synthetic point-sampling and LDS paths. Tested integration commit |
|
Measured
Translation only; I have not checked these programs' output in a game run. AI-assisted. |
…ads; classify quad derivatives within wave halves
…pute gradient lowering too
…pute gradient lowering too
…64 stack For testers: the wave64 stack (Marvisak#223, Marvisak#233, Marvisak#320, Marvisak#439) with Marvisak#180, whose sampleGrad form makes compute programs that sample with implicit derivatives pass dxil.dll validation. One conflict, in emit/lower.rs, where a compute program is found to need the console's lanes: Marvisak#180's quad gradients read within four lanes, so they go with DPP and ds_swizzle among the reads that stay inside a 32-lane half, and such a program runs on a 32-lane host in two halves. Checked on an RTX 5070 and a Radeon iGPU: cargo test --workspace passes, and a hand-assembled compute image_sample validates and samples the right value in groups of 64x1x1, 8x8x1, 32x1x1, 128x1x1 and 4x4x2.
…73d66, and Marvisak#180) The wave64 stack (Marvisak#223, Marvisak#233, Marvisak#320, Marvisak#439, with Peter Bonanni's whole-wave sections across the halves, 9b73d66) merged with Marvisak#180 (twin descriptor loads and quad gradients for compute samples), at 24b3bcc. That commit has one parent (e49302a); Marvisak#180's changes come in without its commits. Marvisak#233 is in this tree as 1eb9995, the same tree as 3098672, so each file was merged with 3098672 as the base instead of the e0865d2 git chooses. Conflict resolutions: - emit/wave.rs, v_permlane16/x16 in whole-wave sections: Marvisak#98's "every lane active" and 9b73d66's "or fi set" are both kept, for both instructions. - emit/lower.rs, Lower::new: Marvisak#320's test for lane reads and writes in divergent programs counts live instructions only, as Marvisak#233's does with Marvisak#309 (dead SGPR-spill lane instructions are no lane reads). Marvisak#307's waterfall arm of v_readfirstlane still comes before the console-flow arm; Marvisak#320 adds no arm of its own. - Compute samples with implicit derivatives (Marvisak#160, Marvisak#180, Marvisak#306): Marvisak#180 decides plain and biased samples, all of Marvisak#160's forms of them (implicit_derivatives from sample_form: _o, _cl, cube, a16), with Marvisak#160's bias address (bias_at) and level clamp; Marvisak#306's validator 1.8 is now declared only for what still uses the host's derivatives in compute (comparison samples, op 64). The Marvisak#306 test of image_sample now asserts no 1.8 (48-byte PSV0) and still validates and creates the pipeline; a twin test with image_sample_c asserts 1.8. - sgpr_spill test (Marvisak#309): without forwarding, the per-lane form still stops with "a lane mask holding lanes elsewhere read as data", but emit now takes the console flow (Marvisak#320); the test checks both, and that forwarded spills do not ask for the console flow. - Mechanical: per_lane_only in two hand-built Parts in emit/lower.rs tests; emit/mod.rs module order (split_tests before threading). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Marvisak#320 and Marvisak#439 (with peter-bonanni's 9b73d66) are in, with Marvisak#180, whose quad gradients fix the compute samples that failed validation. Records the in-title measurement by testers and this merge's resolutions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head
|
|
I compared 105 distinct compute shaders that VIctory refused in one RTX 5070 mission-loading trace after a fence-confirmed readback. I replayed the same local inputs on
The last row includes all seven accepted by #180 alone. The other 26 previously stopped at the untracked-mask select. With #1084 and the descriptor-only change from #1130 in its own PR ( On a physical RTX 5070 (driver 621.01), I also used the shader crate's host helper to create a compute pipeline for the smallest, median and largest of the 33 by input size. All three succeeded. The full pipeline batch exceeded its 180-second limit, so I only have individual driver results for those three. No command lists were submitted in this check. Rendered output, mission progression and frame timing remain untested on this combination. AI-assisted. |
|
Independent verification on Windows 11, RTX 5070 Ti (driver
AI-assisted verification on local RTX 5070 Ti + WARP; no game data. |
|
In-world addendum for the #1084 + #180 combination (RDNA4 host, diagnostics + debug-layer build; same title-memory lifetime stack as our earlier in-world measurement, both PRs merged onto it cleanly):
AI-assisted (Hermes Agent) |
The tester tree (upstream main ffe310e plus its PRs, update 8; see its INTEGRATION.md) ran 11-25 minutes in the world on an RTX 5070 without a device removal. Where both sides carry the same PR (the wave64 stack #223/#233/#320 with #439 and #180, #454, #336, #259, #331 and others), the tester tree's newer head is taken; our own work and the PRs only we merged are kept. Conflicts, file by file: - descriptor/host.rs: the tester layout (`spare`, the guard slot after the dynamic slots, `free_table`, the capped sampler heap). A capped view heap keeps `capped_reserve()` dynamic slots, now 2^18 by default (the tester measurement, and our 91fed158), still `VICTORY_DYNAMIC_SLOTS` in diagnostics builds; uncapped hosts keep our 2^19. Our slot statistics (TAKEN/PEAK/SHORT), the bindless plan cache (`CommittedRegions`, `timed_valid_title_address`, `timed_find`, `title_bounds`) and the revision triple are kept beside the tester's `guard_slot`. - Buffer states: the tester tree's buffer-state tracker (#334: every list moves host copies of title memory between GENERIC_READ and UNORDERED_ACCESS and back to common before it closes) and depth twins (#469) are taken. #40's enhanced/legacy indirect barriers (the indirect prelude, `use_indirect_buffers`, the title buffer handoff mirrored in `host_barrier`) cannot share buffers with that tracker and are dropped; #40's argument checks (`byte_len`, exact spans, overflow-safe clamp shader, aligned counts) stay. `indirect::bound` and #282's `rectangles` go through `buffer_state`, and `indirect::execute` (#334) replaces `done`. #178's DXC fallback compiles both of our passes. Our segments (#387: `close` ends the segment, `close_native` closes a native list) carry the tracker: each native list returns its buffers to common and its twins to their depth targets, and each prelude also holds our texture uploads. - shadow.rs: our write flow (`queue_write`, one `snapshot` after the batch's refreshes, `finish_writes`, the unchanged-page cache) with #261's copy-back that also gives the snapshot the title's bytes; its tests run through our flow. - pipeline/make.rs: #275's per-frame budget and per-pipeline wake pair, with our compute waits (a dispatch waits for its pipeline, up to 20 s). - pipeline/library.rs: the tester version (#347, #275's saver thread); our concurrent-write test kept. shader_cache.rs: our byte-returning cache API with #358's "translated, only not kept". - draw.rs: #493's root SRV tables; where no table can stand in, our drop of a draw whose root view is unset or outside title buffers. Our refusal of a table offset past the capped heap stays. - resource.rs: `HostTexture` has both our `staged` generation and the depth twin. - Shaders: the tester's lower.rs for the wave64 stack, #160's image sampling (it covers our #73 and #136 sample forms) and #453/#587; kept from our side: #136's preference for an image or buffer use of a descriptor read as data and its `s_buffer_` arm, #422's nearest-even narrowing (also for #169's d16 loads and #453's interpolation), #452's spin-wait limit, #391's LDS limit, #302's spilled root arguments (now in `NativeProgram::translation_ir`), #136's PSV0 interpolation beside the tester's row harmonisation. split_tests.rs, lane_read_loop_tests.rs and docs/wave64-on-wave32.md are the tester versions (the same PRs at newer heads). - Tests: #483's heap guard dwords filled in our GPU tests of #200 (v_div_scale) and #437 (scalar loads from a raw view), which read through the guard slot otherwise; #334's debug-layer test passes an offset to our `indirect::bound`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…only measured
Port of the first half of VIctory #180 (commits c78056c, 5ff639e:
descriptors read as data), adapted by hand to the split lowering
(smem.rs, flow.rs). Its second half (quad gradients for compute samples,
c78056c's image hunk and aa69258) is in image.rs, which the shader-images
task ports with #160.
- A descriptor reloaded in each waterfall loop of a non-uniform index is
read for its size bits by one load and used by another; the first had
no resource use and the program stopped ("a descriptor read only as
data"). Its view kind now comes from a twin load: same opcode and
immediate offset, base read from the same values, and the same
register offset or a v_readfirstlane_b32 of the same VGPR value.
- A join of registers that held a descriptor's dwords on one edge and
data on the other stopped the program. The dword enters the phi
undefined on the descriptor edge (the console compiler's phi of a
value defined on one edge only).
shortcut: wrong if a program read those dwords as data after the join.
- An eight-dword descriptor the program only measures (its size bits,
no access) is taken as a 2D texture for getDimensions.
shortcut: a 3D or array image reads depth or layers 1.
XTP, after review:
- A load whose register offset is a waterfall loop's first-lane read
(each lane's own value) but which is not one of that waterfall's loads
(a twin) gets a non-uniform handle; upstream's took a uniform one with
a per-lane index.
- The measured-only image is refused where the table's resource entry
says another kind or a four-dword descriptor (two buffer descriptors
loaded at once); upstream checked the kind only.
- The undefined join dword is an i32 only (an SCC is no descriptor
dword); the lookups go through the lowering's def_block instead of a
scan of every instruction.
- Tests (no device): the twin load (and not a load of another entry),
the measured-only image (and not a UAV or four-dword entry), the
descriptor dword at a join read only after the data edge.
Upstream measured over shaders.rpf: compute validated 1,662 -> 1,758 of
2,581, vertex and pixel 12,172 -> 12,183, none lost (with the quad
gradients).
Co-authored-by: permadiego <339870573+permadiego@users.noreply.github.com>
Ported from Marvisak/VIctory#180 (head aa692580ed69e4fa20b8312df55027108fe8d7c7) by permadiego
image_sample and image_sample_b outside pixel shaders were emitted as
sample/sampleBias, which validator 1.6 rejects there (35 compute
programs of the pack). The console takes the level from each quad of
lanes, so they become sampleGrad with coarse gradients from the quad:
lane 1 minus lane 0 across, lane 2 minus lane 0 down; a bias scales
them by 2^bias, the same level for isotropic filtering. A quad's four
lanes share a host wave of any size, so this asks for neither the
console's wave size nor its lane order beyond the quad (upstream's
second commit: the first declared WaveSize(64) for wave64 programs,
which a 32-lane host refuses). Vertex and mesh programs with these
samples are refused with their reason (none in the pack).
This is the second half of VIctory #180 (commits c78056c, aa69258);
its first half, descriptors read through a twin load, is ported with
the descriptor work.
XTP adaptation: in emit/lower/image.rs, on top of #160's sample forms,
so the texel offsets, the level clamp and the a16 bias of those forms
come with it. Review: upstream read the quad's lanes with waveReadLaneAt
at a lane index that differs between lanes (a wave-wide shuffle, whose
non-uniform index the HLSL documentation does not promise); here they
are quadReadLaneAt of lanes 0, 1 and 2, D3D's own quad (lanes 4n to
4n + 3) at constant indices, as XTP's quad swizzles already read in
mesh programs. Left as a
shortcut: a quad lane the program left inactive gives what the host
reads there (the console's derivative reads that lane's stale value).
Tests: #160's GPU tests of implicit samples in compute quads (levels 0
to 2 by quad, bias, clamp, offsets) now run these gradients on WARP and
pass, and those translations now pass the validator with no exception
(only comparison samples with implicit derivatives keep one: SM 6.6 has
no SampleCmpGrad); a new test checks the forms become sampleGrad with
quad reads and no wave size.
Survey (shaders.rpf, any host, every translation validated): 23,472
translated before and after; the 35 compute programs dxil.dll rejected
("operation that is incompatible with the shader stage") change and are
all accepted now (23,283 -> 23,318 accepted); no other translation
changes, none lost.
Ported from Marvisak/VIctory#180 (head aa692580ed69e4fa20b8312df55027108fe8d7c7) by permadiego
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
I ran an offline A/B comparison of #1423 ( 94 of the 219 compute shaders passed DXIL validation. All 219 cleared Across the full archive, validated shaders increased from 21,724 to 22,365 (+641), with zero validation losses. The gains were 427 compute, 129 pixel, 2 vertex, and 83 mesh shaders. The combined build also validated all five compute shaders that first emitted DXIL on #1423 and were rejected by the validator for stage incompatibility. I ran For the synthetic check, I ran the same twin-load fixture from #1130 in separate test worktrees and added an assertion against the same SDK validator. One load supplies the structured buffer view and the other supplies its record count. #1423 reproduced the descriptor error. With #180, the fixture lowered successfully and its DXIL validated. The combined shader library suite had 121 passes and one ignored test, and AI use : Assisted by GPT 6.2 Sol. |
… for compute samples
… for compute samples
…sak#704 + Marvisak#1511 Conflicts in crates/victory-shader/src/emit/lower.rs, resolved by hand: 1. descriptor_data: the bundle (Marvisak#953 s_buffer_load uses, Marvisak#1067 "read only as data" from the table's range) and Marvisak#180 (twin loads of the same dwords) both rewrote how the view's kind is found. Kept Marvisak#180's lookup (own uses, else a twin load's) and the bundle's handling of the use and of the unused case, plus the one case Marvisak#180 accepted that the bundle did not: an 8-dword load outside a table/heap range, taken as a 2D image (Marvisak#180's "image the program only measures"). Where both accepted a descriptor they built the same view. 2. phi joins: the bundle's arm (Marvisak#1073, a mask dword joined by ballot) and Marvisak#180's arm (a descriptor dword at a data join is undef) were inserted at the same place. Both kept, bundle first; the first needs a tracked lane mask, which a descriptor dword is not, so they do not overlap. 3. No textual conflict, did not compile: the bundle (Marvisak#306) gave `addr_val` a start position (`addr_val(l, start, k)`); Marvisak#180's compute image_sample_b arm read the bias with the old form at dword 0 through `as_float`. It now reads it as the bundle's sampleBias does: after the offset word when there is one, an f16 with a16 (`to_float`). This is the bias half of the Marvisak#160/Marvisak#180 interaction described in Marvisak#160 (comment) , which the bundle's offset forms already expose.
Marvisak#704 + Marvisak#1511 - emit/mod.rs: the bundle structures the program before tracking resources (resource::track takes the structure since the bundle); Marvisak#309 forwards spilled SGPRs, which rewrites the IR. Order kept: forward, then structure, then track. - emit/wave.rs: no conflict on this Marvisak#1511 head. On the previous bundle (which carried Marvisak#98's v_permlane16 tests) both sides added tests at the end of the module and the bundle's side was closed before Marvisak#309's tests; without Marvisak#98 git merges the two test lists itself, with Marvisak#309's tests as separate items of `mod tests` (not nested). - sgpr_spill.rs (new in Marvisak#309, no textual conflict): its test helper called resource::track with the old 3-argument signature; adapted to the bundle's (structure first, passed to track). Test-only change.
…ge samples) onto Marvisak#309 + Marvisak#180 + Marvisak#704 + Marvisak#1511 PR Marvisak#160 head 5ce85c5, merged onto integ/next-v3 (0bb7335). The bundle (Marvisak#1511) already carries Marvisak#306 (a16 bias as f16, a16 derivatives 32-bit), 10ac6ce (cube gradient samples, image_sample_d_cl) and cbc8c33 (image_get_lod on cubes); Marvisak#180 adds compute image_sample/_b as sampleGrad with quad gradients. Where Marvisak#160 and the bundle implement the same thing, they read the same address layout: offset, bias and reference a full dword each (a16 bias an f16 in the low half), derivatives 32-bit unless _g16, a16 packing only coordinates and level or clamp. The bundle's Marvisak#306 layout is kept as the base and Marvisak#160's forms are added to it. gfx10/fields.rs (image_addr_dwords): both sides size derivatives by _g16 and pack only coordinates and levels with a16. Kept the bundle's Marvisak#306 version (a g16 token rather than Marvisak#160's ends_with("_g16"), which gives the same count for every opcode name) together with its a16_keeps_derivatives_32bit_outside_g16 test. emit/host.rs (1 hunk): Marvisak#160 adds a test-host arm for Levels/CubeLevels/Depth SRVs; the bundle (Marvisak#704) extended the UAV arm to BufferUav with a stride column. Both arms kept: Marvisak#160's arm first, then the bundle's UAV arm unchanged. emit/lower.rs: 1. Free functions after half_outputs: the bundle added half_inputs and Marvisak#160 added SampleForm/sample_form/GATHER_AT_LEVEL in the same place. Kept both. 2. Opcode match: the bundle added "image_sample_d" | "image_sample_d_cl" to the fixed list, and Marvisak#160 replaced the list with the parsed form (_ if form.is_some()). Took Marvisak#160's. d_cl is the form {d, cl}, so it still lowers to SampleGrad with its clamp. 3-4. Address layout: the bundle had (Marvisak#306) first = offset + bias + cmp full dwords, 32-bit derivatives (2 per direction on a cube, 10ac6ce), and `at` = first + grads, from which the a16-packed coordinates and level start. Marvisak#160 had the same layout as whole/per_direction/first, plus _g16 derivatives and _cl. Kept the bundle's names and layout (first, graded, at, addr_dword) and put Marvisak#160's pieces on them: first is now o + b + c from the form (it was offset_word + (name == image_sample_b) + cmp); per_direction halves the derivative dwords for _g16 only; grad_at, coord_at, bias_at, float and known (Marvisak#160) read through the bundle's addr_dword in place of Marvisak#160's duplicate `raw`. Marvisak#306's to_float/addr_val pair for coordinates and Marvisak#160's float(coord_at(k)) compute the same thing; the latter is kept because the level, clamp and known checks use it. The a16 refusal of comparisons in the bundle's code is dropped, as in Marvisak#160 (the reference is a full dword). Also, without a textual conflict: Marvisak#160 refused level queries on cubes ("... or a level query"), but the bundle lowers image_get_lod on cubes (cbc8c33). That refusal is dropped and only texel coordinates (both sides) and texel offsets (Marvisak#160) are refused on cubes. The bundle's `face` variable is kept in place of Marvisak#160's `cube_face`. 5. sample (60): the bundle's constant-offset code is the base code with addr_dword. Marvisak#160 moved offsets before the match (immediates in -8..7, otherwise a coordinate shift at a level known here) and added the clamp. Took Marvisak#160's version, reading the word with addr_dword. 6. sampleBias (61): bundle addr_val(offset_word, 0) + to_float, Marvisak#160 float(bias_at). Both read the same position, an f16 low half with a16. Kept the bundle's comment and Marvisak#160's reader, plus Marvisak#160's clamp. 7. sampleGrad (63): the bundle reads `graded` 32-bit derivatives per direction, turns cube face derivatives into direction derivatives after reading, and reads its own _cl clamp. Marvisak#160 reads through grad_at (g16 too) with a per-face branch. Kept the bundle's structure (loop over `graded`, then the cube conversion) reading through Marvisak#160's grad_at, so _g16 works. The bundle's inner clamp is dropped for Marvisak#160's clamp, which comes from the same position (coordinate `coords`) and now covers every _cl form. Marvisak#160's `_cd` shortcut comment is kept. 8. sampleCmp/LevelZero (64/65): the bundle reads addr_dword(first - 1) and Marvisak#160 reads float((o + b, None)). These are the same dword, since first = o + b + c and c is set. Kept the bundle's line. Marvisak#160's clamp is pushed for SampleCmp. 9. sampleLevel (62): bundle name == "image_sample_l" with addr_val(at, coords), Marvisak#160 f.l with float(coord_at(coords)). These are the same position. Took the form test so that _l_o and the others are covered. 10. gather (default arm): the bundle's checks and per-lane offsets are the base code with addr_dword. Marvisak#160 moved the checks into the op choice (level 0, comparison gathers, GATHER_AT_LEVEL) and the offsets ahead of the match. Took Marvisak#160's. Duplicate method: 10ac6ce (bundle) and Marvisak#160 both add Lower::cube_gradient with the same table (u, v move by 2 ds, 2 dt, the major axis by 0). With no conflict git kept both. Kept Marvisak#160's, which shares by_face with cube_direction, and removed the bundle's. Marvisak#180 interaction (integration fix from Marvisak#160 (comment), r4tedx): Marvisak#180's compute image_sample/_b arm (sampleGrad from quad gradients) dropped the level clamp, and before 5703405 it also read the bias at dword 0. With Marvisak#160, _b_o, _cl and _b_cl_o reach that arm. The arm now reads the bias with float(self, bias_at) (after the offset word, an f16 with a16; this is the same position 5703405's addr_val(offset_word, 0) + to_float read) and pushes Marvisak#160's level clamp instead of undef. Marvisak#160 x Marvisak#306 interaction (no textual conflict; emit/shader.rs, lower.rs): Marvisak#306 declares dx.valver 1.8 for a compute module with an implicit-derivative sample (cs_derivatives, which Marvisak#180's sampleGrad arm also sets). Validator 1.8 counts a sample's level clamp (a non-undef clamp operand) as TiledResources use, and 1.6 does not. Marvisak#160's _cl forms in compute (Marvisak#180's arm with the clamp above, and SampleCmp for _c_cl) therefore failed "Flags must match usage" in sample_and_gather_forms_lower_to_valid_dxil, comparisons_and_comparison_gathers_ match_per_texel_comparisons and texel_offsets_and_levels_sample_the_texels_they_name (declared and actual flags differ by exactly 1 << 12). Marvisak#160 alone declares 1.6, where this does not apply. Added flags::TILED_RESOURCES (bit 12, SFI0 0x100). It is set when a sample takes a level clamp (Shader::lod_clamp) and the module declares valver 1.8. Still needed on this Marvisak#1511 head: its Marvisak#1402 (119b763) only skips two of Marvisak#306's own tests when dxil.dll is older than validator 1.8 and does not change what Marvisak#306 declares. Checked (on the previous Marvisak#1511 head, 289f241, which also carried Marvisak#98; this replay was checked with cargo check --workspace --all-targets --all-features and the full suite at the end of the line): cargo build --workspace --all-targets, clippy -D warnings, xtask policy. cargo test --workspace on an RTX: 427 passed, 0 failed, 6 ignored. With VICTORY_WARP=1 --no-fail-fast: 426 passed, 1 failed (valu_tests:: v_cndmask_on_an_untracked_mask_tests_this_lanes_bit, which also fails on the base), 6 ignored. #[test] count: base 424 + 8 from Marvisak#160 = 432 in the tree; the victory-shader lib lists all 204 of its own. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, Marvisak#320, Marvisak#439) onto Marvisak#160 + Marvisak#309 + Marvisak#180 + Marvisak#704 + Marvisak#1511 PR Marvisak#439 head 28aca3b (46 commits over main: Marvisak#223 wave-range targets, Marvisak#233 split halves and the console flow, Marvisak#320 lane reads where lanes branch, Marvisak#439 LDS in one console wave, whole-wave sections across the halves, ds_bpermute, numeric selects), merged onto the Marvisak#160 merge (b821b31), as the wave64 line of integ/next-v3. emit/wave.rs: no conflict on this Marvisak#1511 head. The previous head carried Marvisak#98 (f468457, v_permlane16 modelled next to v_permlanex16, only with every lane active), which conflicted with Marvisak#439's a31c82e (an inactive lane also accepted when fi, opsel bit 0, is set). Marvisak#98 is no longer in the bundle, so the whole-wave simulation is Marvisak#439's: v_permlanex16 only, under `exec == all || v.opsel & 1 != 0`. structure.rs (1 hunk): the bundle only reformatted `paired_masks`; Marvisak#439 moved it after the new `execs`/`others`/`pairs` fields because `pairs` borrows `self.masks` before `paired_masks` moves it. Kept Marvisak#439's order with the bundle's formatting. emit/waterfall_tests.rs (3 hunks): 1-2. The bundle split `build` into `build_with(words, buffers, nonuniform)` (a program with no per-lane handle, whose first-lane read is a wave operation); Marvisak#439 split the same function into `native`, `lower_as` (per-lane or console flow) and `host_shader`. Kept Marvisak#439's helpers and the bundle's `build_with` on top of them (lower_as(.., false), the bundle's two asserts, host_shader). host_shader keeps the stride_table field (Marvisak#704), which git merged outside the hunk. 3. Tests at the end of the file: the bundle's side ends inside the `for` loop of a_descriptor_only_read_as_data_gives_its_views_size, Marvisak#439's inside the `for target` loop of its last test. The bundle's test is closed before Marvisak#439's tests, so none is nested in another. emit/lower.rs (6 hunks): 1, 3. Lower fields and their initializers: the bundle's `mask_scc` (Marvisak#309, SCC of a mask operation read as data) and Marvisak#439's `opaque_open` (stops the recursion of a mask copied dword by dword). Both kept. 2. Which compute programs need the console's lanes. The bundle (Marvisak#309) counts only live instructions (`sgpr_spill::dead`: lane moves forwarding left unread are not lowered); Marvisak#439 split the test into in-half reads, whole reads and masks held as numbers and added the split/console-flow choice. Kept Marvisak#439's structure, reading `live()` for reads_whole and in_half, and for lane_access_outside_sections (the console-flow trigger for lane reads where lanes branch differently). 1ca87f7 (in Marvisak#439) notes that the tester tree's `live()` filter belongs here once Marvisak#309 is in. 4-5. Selects on masks the structure does not follow. The bundle (48a41fb, from Marvisak#585) added `mask_cond` for v_cndmask_b32 and the v_*_co_ci_u32 carry-ins: inline 0/-1 constants, the tracked boolean, else with console lanes this lane's bit of the register's number (pair in wave64). Marvisak#439 (e461457, 1ca87f7, ccd9c44) takes, for v_cndmask only, the structure's boolean for masks held as numbers (`Structured::others`, which also finds the high word written by another instruction), only where the host lane is the console lane (not split in halves without the console flow), and declares console lanes for them only on a second lowering after the first stops on such a select (`lower`). Combined in `mask_cond`: tracked boolean, then Marvisak#439's `others` boolean, then the bundle's register number, both under Marvisak#439's condition (console lanes and not split without the console flow; the bundle's number path called lane_bit, which is wrong in a split program, where Marvisak#439 asserts it is never called). Both instructions use it; v_cndmask now also takes the bundle's inline constants. Without a textual conflict git had also kept the bundle's unconditional rule (any untracked select or carry-in declares console lanes) inside Marvisak#439's masks_held, which undid 1ca87f7 (a select nothing reads made a wave64 program in a group of more than 64 threads untranslatable on a 32-lane host). The rule now counts live instructions and applies only on Marvisak#439's second lowering, which now also follows an untracked carry-in ("a carry-in from an untracked mask", UNTRACKED_CARRY). It covers every untracked selector, not only Marvisak#439's held masks with an opaque or constant atom, since the bundle's number path needs console lanes for selectors outside `others` too; on the first lowering nothing changes. 6. lower.rs test helper: Marvisak#439's three new Parts fields with the bundle's formatting. Not textual, did not compile (test code only): Marvisak#439 gives `emit` a Target and `lower::Parts` target/console_cf/per_lane_only. Tests that came with the bundle, Marvisak#704, Marvisak#309 and Marvisak#160 used the old forms: image_tests.rs `lower`, emit/mod.rs (3 emit calls, the stride-table Parts), lower.rs (2 Parts in the int64 atomics tests), root_view_tests.rs, sgpr_spill.rs tests and victory-gpu raw_view_tests.rs. They pass Target::ANY, console_cf false and per_lane_only false, as Marvisak#439 did for the upstream tests. Not textual, test-only (split_tests.rs): with Marvisak#309 a v_readlane whose result nothing reads is dead (not lowered and, above, not counted). saveexec_scc_tests_new_exec_not_saved_exec and loops_leave_on_the_new_exec_of_saveexec used `v_readlane_b32 s14, v0, 10` with s14 unread only to take the console flow. After the merge the loop test failed on the RTX (per-lane form, lane t counted t + 1 iterations where the console counts 64; it passes on Marvisak#439 alone), and the saveexec test passed without taking the console flow (its per-lane result is also 42). Both now read s14 once (`s_mov_b32 s15, s14`, the branch over the body +4), and a first lowering of each was checked to ask for the console flow again on a 32..32 target. Marvisak#180 interaction: r4tedx's integration (24b3bcc, from Marvisak#180 5ff639e) put `implicit_derivatives` among the in-half reads that make a program need console lanes. The Marvisak#180 merged here is aa69258, whose last commit takes quad gradients out of the console-lanes test altogether ("a quad's four lanes share a host wave of any size"), so there is no such term to place. The quad reads stay inside one host wave in both Marvisak#439 forms (each half is a host wave in the split and in the console flow, and in the console flow samples run in every lane and are kept by a select on EXEC). Checked on the previous Marvisak#1511 head (289f241, with Marvisak#98; this replay was checked with cargo check --workspace --all-targets --all-features and the full suite at the end of the line), on an RTX 4060 Laptop (32..32): cargo test --workspace --locked: 468 passed, 0 failed, 6 ignored (base 427 + 41). The 41 tests Marvisak#439 adds all pass; the GPU ones ran on the RTX in two 32-lane halves ("split true"). VICTORY_WARP=1: 467 passed, 1 failed, 6 ignored; the failure is valu_tests::v_cndmask_on_an_untracked_mask_tests_this_lanes_bit, which fails on the base too (a fixed-WaveSize pipeline on WARP). victory-shader lib tests listed: 204 -> 244 (Marvisak#439 adds 40 there and 1 in victory-gpu). cargo clippy --workspace --all-targets -D warnings and cargo xtask policy clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…IL validator failures) into the integration Its fixes are already here (a16 biased samples from Marvisak#138/Marvisak#160, the centroid position under conservative depth, one interpolation mode per packed row, signature parts in the validator's order), and compute samples take quad gradients (Marvisak#180) instead of validator 1.8. The code stays ours; three of the PR's tests are taken (conservative depth, signature order within a row, the a16 biased sample) and pass. Its tests of harmonize_row_interp and of dx.valver 1.8 test code that is not taken. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
What changed
Two causes that stop compute programs, mostly the hundreds of
CS_RaytracingResolvematerial variants:Descriptors read as data through a twin load. With a non-uniform index, the console compiler reloads an image descriptor in each waterfall loop: one loop reads its size bits (
v_alignbit_b32of dwords 1-2 for the width,s_bfe_u32of dword 3 for the base level), a later one uses it forimage_load. The first load had no resource use of its own, sodescriptor_datafailed with "a descriptor read only as data". It now takes the view's kind from a twin load: same opcode and immediate offset, base read from the same values, and the same register offset or av_readfirstlane_b32of the same VGPR value. The handle is still built from the data load's own address.Implicit-derivative samples outside pixel shaders.
image_sampleandimage_sample_bin compute were emitted assample/sampleBias, which validator 1.6 (and 1.7) rejects outside pixel shaders ("Function uses features incompatible with the shader stage (cs)"; checked with dxc 10.0.26100: 1.8 accepts it). The console takes the level from each quad of lanes there too, so these now becomesampleGradwith coarse gradients from the quad (lane 1 minus lane 0 across, lane 2 minus lane 0 down, throughwaveReadLaneAtwith console lanes). A bias scales the gradients by 2^bias, the same level for isotropic filtering. Mesh and vertex programs still refuse them ("a cross-lane operation ...") as before.Measured
victory translate --validateover the title'sshaders.rpf(26,084 programs),main35b054e against this branch:No program that validated on
mainfails now. With #48 and #69 merged as well, compute goes 1,663 → 2,018 (mostCS_RaytracingResolvealso need those): "a descriptor read only as data" 356 → 1, and the stage-incompatible validator error 41 → 0.cargo test -p victory-shader57 passed; clippy clean.Overlap
#160 notes that implicit-derivative samples in compute fail the 1.6 validator and leaves that open; this is that piece, for
image_sampleandimage_sample_b. The_clforms from #73/#160 can use the samequad_gradientsonce those land.Not verified
No run on a GPU here: rendering of these programs is untested. Anisotropic filtering with a bias can pick a slightly different footprint than the console's.
🤖 Generated with Claude Code