Repository navigation
GPU+shader: translate wave64 programs for 32-lane host waves when WaveLaneCountMax < 64 - #2176
n-romanovich wants to merge 3 commits into
Conversation
|
Correction. My original The original PSO result stands. RTX 5080, driver 617.14, Windows 11 Pro build 26200.9974, PR head I also independently reproduced @Dathinel's actual Corrected test report · Synthetic fixtures OpenAI Codex (GPT-6) ran the RTX 5080 tests and drafted this correction. |
|
The cross-half issue also affects scalar
All three pipelines dispatched successfully. This tests scalar Fixture words (hex), raw UAV at heap index 0: Control with lane 5: changing only the source lane from 32 to 5 produced 5 for threads 0–31 and 37 for threads 32–63 on this PR. On #189 and #439 all 64 threads returned 5. A guard that only rejects indices above 31 would miss this case. AI-assisted; synthetic inputs only. |
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):
cargo test -p victory-gpu --lib shader_cache::— 3 passed, 0 failedcargo test -p victory-shader --lib emit::lower::tests::— 21 passed, 0 failedcargo clippy -p victory-gpu -p victory-shader --all-targets— 0 warningscargo xtask policy— ok (183 files ok)
Clean host-wave32 translation path and cache-key inclusion for wave64 programs on hosts with WaveLaneCountMax < 64. Looks good.
AI-assisted (Gemini 4 Neon).
|
Update for Overlap note: #189 (alfycs) and #233 / #320 / #439 (r4tedx) also run wave64 programs on 32-lane hosts, and they emulate the operations that cross the halves. This PR runs each half as its own 32-lane wave, and
Programs without cross-half operations run correctly this way, which matches iGoldenNinja's 3/3 PSOs. For the rest, #233 refuses by name what it can't emulate yet. Taking this as a fallback only for programs with no cross-half operation, or building on #233's split, would avoid silently wrong lanes. AI-assisted (Claude Code); source read only. |
catminou4
left a comment
There was a problem hiding this comment.
Tested locally: macOS arm64, rustc 1.98.1, PR head merged into main 940d32f, cargo test -p victory-shader --locked (shader half; the GPU half is Windows-only).
144 passed / 0 failed / 2 ignored. Wave64 programs translated for 32-lane host waves — wave64→wave32 translation; relates to #189/#233/#1960's wave64 cluster. Shader side green; GPU execution path needs Windows hardware validation.
Offline measurement on a retail dumpResult: no count change against I merged head 3feadc6 onto No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code). |
RTX 4060 Laptop: the PR takes compute PSO refusals from 115 to 0, and the world still fails on the descriptor heapIndependent check on a card not yet reported: RTX 4060 Laptop (Ada), driver The detection works here: The PR does what it says for pipeline creationCounted from a
So on this machine every one of the 115 wave64 compute pipelines that What it does not change: the world still dies on the capped descriptor heapSame two runs, the counters that matter for reaching the world:
So on this card the two failures are independent, and fixing the wave side does not get the world up. That may be worth stating plainly in the PR body: this PR removes the Agreement with @sinan-cmyk's offline resultTheir Not tested / not claimed
Logs and the failing-test detail available if useful. |
|
Automated triage for the maintainers. Needs work. The rebased head Two points still hold it back:
On your reply: the move to Generated by Claude Code |
…eLaneCountMax < 64
3feadc6 to
b2ea86a
Compare
|
@Marvisak, updated
|
RTX 4060 Laptop, in the world: wave64 mesh draws without a hang; BVH-builder programs hang; other wave64 compute makes GPU frames ~80× longer (both heads)Machine: RTX 4060 Laptop 8 GB (driver 617.14), i7-13650HX, 32 GB RAM, Windows 11 26300. The log shows Tree: Offline, whole retail set (25,985 containers):
What I read from it:
Edit (after a ninth run): I first wrote that run 8's long frames were pipeline compilation. They were my own captures. If it helps, I can name the programs that hit the limit: One run per row. Counts, hashes and messages only, no game data. AI-assisted (Claude Code). |
…-lane waves What was wrong: a console wave64 compute program that needs the console's lanes (cross-lane reads, masks as numbers, LDS one wave shares) declares WaveSize(64). NVIDIA and Intel run waves of 32 lanes at most (WaveLaneCountMax 32) and refuse it: on an RTX 3070 Ti (driver 32.0.16.2124) the debug layer gives "Shader wants wave lane count of 64 but maximum wave lane count for device is 32" (id 622), and every such pipeline is refused with E_INVALIDARG. A Series S run to the loading screen refused 100 compute pipelines, 95 of them for this. What changed: on such a host, a wave64 program that needs the console's lanes is translated for waves of 32 (`emit::Options::host_wave32`; `emit::lower::halves`). The thread relabelling gives each host wave a 32-aligned run of thread ids, so host wave 2w + h is console wave w's lanes 32h..32h + 31. What a lane reads within its half is exact: DPP rows, ds_swizzle, and ds_bpermute_b32, which the console's wave64 permutes within each half on its own (RDNA2 ISA; measured in Marvisak#573). A lane's bit of a mask held as a number, v_writelane_b32 and v_mbcnt take the console lane. Reads across the halves have no host form and are refused where they are lowered, with a reason that names the host: ballots (masks read as data), v_readlane_b32 of a lane that may be in the other half, whole-wave reductions and prefix sums; one a program never uses costs nothing (the lowering's retry with the value missing). A group of 33 to 64 threads with LDS, which the console compiler orders without barriers as one wave, is refused too. v_readfirstlane_b32 reads the host wave's first lane, as it already does in every program without console lanes (marked as that shortcut). victory-gpu asks the device once (OPTIONS1) and translates for it; the shader cache keys on it, so entries made for 64-lane hosts are not read. `victory translate --wave32` translates for such a host offline; with --pipelines it follows the GPU that makes them. Approach after DexNom's fork (DexNom/Victory 5f4c3df: the host's wave width and the relabelling into halves) and Marvisak#2176 (n-romanovich: the setting in the cache key); here the setting is a translation option, and cross-half reads are refused at the sites that make them instead of by instruction name, which keeps programs whose crossing value is unused. Evidence, `translate --list --pipelines` over shaders.rpf, the executable, XboxBvhBuilder.dll and the FidelityFX DLL, RTX 3070 Ti: | | main 67e8ae1 | this | |---|---|---| | compute programs emitted | 2,733 | 2,372 | | compute pipelines made | 2,328 | 2,372 | | refused by the driver | 405 | 0 | No program that made a pipeline on main fails to now (25,347 pipelines, all kept). In the title (Series S mode, diagnostics build, to the loading screen, 2.5 min): no pipeline refused, against 100 on main; the 113 programs that do not translate say why (51 LDS, the rest mostly ballots). The 44 new ones include the depth pyramids (occlusion), the sky and atmosphere gathers (scattering_transmittance_system), shader binning and the mipmap generators. The 361 still refused now say why: 192 LDS in a one-wave group, 107 ballots, 48 lane reads across halves, 20 reductions (those need an exchange between the two host waves, a change of its own). Tests (halves_tests): one wave64 program (DPP, ds_swizzle, ds_bpermute, v_mbcnt, v_writelane to lane 40, a constant mask's high dword) runs on every hardware adapter, in halves and, where the adapter has 64-lane waves, as one wave64: all 64 lanes give the console's results on the RTX 3070 Ti (halves) and the Radeon iGPU of a Ryzen 9 7900X (RDNA2: halves and wave64). The refusals and the LDS rule each have an offline test; the hand-encoded words are checked against the disassembler. Found on the way, not changed here: a wave64 mask built by two s_mov_b32 (low and high dword written apart) reads its low dword for all 64 lanes (`Lower::pair_high` looks for the high dword in the instruction that wrote the low one); the same with and without this change, on AMD's own wave64 too. Co-Authored-By: Claude Opus 5.5
…-lane waves What was wrong: a console wave64 compute program that needs the console's lanes (cross-lane reads, masks as numbers, LDS one wave shares) declares WaveSize(64). NVIDIA and Intel run waves of 32 lanes at most (WaveLaneCountMax 32) and refuse it: on an RTX 3070 Ti (driver 32.0.16.2124) the debug layer gives "Shader wants wave lane count of 64 but maximum wave lane count for device is 32" (id 622), and every such pipeline is refused with E_INVALIDARG. A Series S run to the loading screen refused 100 compute pipelines, 95 of them for this. What changed: on such a host, a wave64 program that needs the console's lanes is translated for waves of 32 (`emit::Options::host_wave32`; `emit::lower::halves`). The thread relabelling gives each host wave a 32-aligned run of thread ids, so host wave 2w + h is console wave w's lanes 32h..32h + 31. What a lane reads within its half is exact: DPP rows, ds_swizzle, and ds_bpermute_b32, which the console's wave64 permutes within each half on its own (RDNA2 ISA; measured in Marvisak#573). A lane's bit of a mask held as a number, v_writelane_b32 and v_mbcnt take the console lane. Reads across the halves have no host form and are refused where they are lowered, with a reason that names the host: ballots (masks read as data), v_readlane_b32 of a lane that may be in the other half, whole-wave reductions and prefix sums; one a program never uses costs nothing (the lowering's retry with the value missing). A group of 33 to 64 threads with LDS, which the console compiler orders without barriers as one wave, is refused too. v_readfirstlane_b32 reads the host wave's first lane, as it already does in every program without console lanes (marked as that shortcut). victory-gpu asks the device once (OPTIONS1) and translates for it; the shader cache keys on it, so entries made for 64-lane hosts are not read. `victory translate --wave32` translates for such a host offline; with --pipelines it follows the GPU that makes them. Approach after DexNom's fork (DexNom/Victory 5f4c3df: the host's wave width and the relabelling into halves) and Marvisak#2176 (n-romanovich: the setting in the cache key); here the setting is a translation option, and cross-half reads are refused at the sites that make them instead of by instruction name, which keeps programs whose crossing value is unused. Evidence, `translate --list --pipelines` over shaders.rpf, the executable, XboxBvhBuilder.dll and the FidelityFX DLL, RTX 3070 Ti: | | main 67e8ae1 | this | |---|---|---| | compute programs emitted | 2,733 | 2,372 | | compute pipelines made | 2,328 | 2,372 | | refused by the driver | 405 | 0 | No program that made a pipeline on main fails to now (25,347 pipelines, all kept). In the title (Series S mode, diagnostics build, to the loading screen, 2.5 min): no pipeline refused, against 100 on main; the 113 programs that do not translate say why (51 LDS, the rest mostly ballots). The 44 new ones include the depth pyramids (occlusion), the sky and atmosphere gathers (scattering_transmittance_system), shader binning and the mipmap generators. The 361 still refused now say why: 192 LDS in a one-wave group, 107 ballots, 48 lane reads across halves, 20 reductions (those need an exchange between the two host waves, a change of its own). Tests (halves_tests): one wave64 program (DPP, ds_swizzle, ds_bpermute, v_mbcnt, v_writelane to lane 40, a constant mask's high dword) runs on every hardware adapter, in halves and, where the adapter has 64-lane waves, as one wave64: all 64 lanes give the console's results on the RTX 3070 Ti (halves) and the Radeon iGPU of a Ryzen 9 7900X (RDNA2: halves and wave64). The refusals and the LDS rule each have an offline test; the hand-encoded words are checked against the disassembler. Found on the way, not changed here: a wave64 mask built by two s_mov_b32 (low and high dword written apart) reads its low dword for all 64 lanes (`Lower::pair_high` looks for the high dword in the instruction that wrote the low one); the same with and without this change, on AMD's own wave64 too. Co-Authored-By: Claude Opus 5.5
|
Tested on an RTX 4070 SUPER (driver 32.0.16.1742, Windows 11 26300), title 1.0.2.1, Series X profile, diag build, 6-minute runs with scripted Enter presses. Base stack:
Of the 118 programs this PR leaves untranslated here, 80 fail with - if self.host_wave() < self.wave() {
+ if self.host_wave() < self.wave() && !super::wave32_approx() {
return Err("a cross-half wave scan on a 32-lane host");
...
- if self.host_wave() < self.wave() {
+ if self.host_wave() < self.wave() && !super::wave32_approx() {
return Err("a 64-bit wave mask read as data on a 32-lane host");
...
- if !quad && self.host_wave() < self.wave() {
+ if !quad && self.host_wave() < self.wave() && !super::wave32_approx() {
return Err("a cross-half operation on a 32-lane host");Everything translates then, but the BVH builder ( - let open = all_made(&states);
+ let open = all_made(&states) && !victory_shader::emit::host_wave32();The builder then stays off on NVIDIA, as it does on AI-assisted (Claude Code); runs done on my machine. |
|
RTX 5080 (Blackwell), driver 621.40, this PR ( Setup: NVIDIA GeForce RTX 5080 16 GB (driver 621.40), Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 26200. Title 1.0.2.1, Series X profile, Trees: "stack" =
In the title (one 600 s run each):
Reasons for the 166 compute programs: 80 The pixel and mesh refusals carry the same two messages. Without this PR those programs translate and the host takes them, so it looks like the new Not tested: more than one run per tree; @moe-miau's AI use: Claude Code (Claude Opus 5.5) merged the trees, resolved the conflicts, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report. |
|
Follow-up on the RTX 5080 (621.40): @moe-miau's Tree: the stack from #2464 + this PR (
In the title (one 600 s run each):
80 of the 84 compute programs still dropped are Not tested: more than one run; the changes one at a time; Series S profile. AI use: Claude Code (Claude Opus 5.5) merged the tree, applied the changes from the comment, ran the title on my machine (sandboxed at Low integrity, game folder read-only), read the logs and frame captures, and wrote this report. |
|
RTX 3070 on Windows 10: Setup: RTX 3070 8 GB, driver 621.14, Windows 10 22H2 (19045),
Where For comparison on the same new base: with #189 ( On the stack where the world draws on NVIDIA (
So on this card the clearer picture and the speed come from #2118; adding this PR changes which programs don't run (refused by D3D12 before, refused by the translator now) without changing the picture or the frame rate, and with no removal. Merging with #2628: both add a field to Not tested: a second run of any of these; No game data attached. I'm testing with Claude's help, and Claude drafted this comment. |
Triage asked for Marvisak#2176's refusals to stay the default: lifting them makes programs that combine work across the two halves silently approximate (Venom2054's ballot test counts 128 where the console counts 138). The three refusals (cross-half lane operations, 64-bit wave masks read as data, cross-half scans) are back unless emit::Options::wave32_approx is set; the GPU sets it with VICTORY_WAVE32_APPROX=1 on a 32-lane host, and the shader cache key includes it. The test checks both: refused by default, translated when approximate. The BVH builder stays held back on such hosts either way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
For the test the triage asks for (a wave64 pixel program that should still translate with
Once
|
|
@n-romanovich a small follow-up on this PR's 32-lane path, as #3115 (stacked on AI use: Claude Code (Claude Opus 5.5) wrote the change and this note. |
…osts On a host of 32-lane waves (Marvisak#2176) every cross-lane operation that is not quad-local was refused as "a cross-half operation", but DPP rows (16 lanes), DPP8 (8 lanes), ds_swizzle_b32 in its group-of-32 mode and ds_bpermute_b32 (each 32-lane half on its own, RDNA2 ISA 10.4.4) only read lanes of their own half, which one host wave holds whole (FIND-7 in Marvisak#1633). cross_lane now takes how far an operation reaches. A DPP row write mask numbers the wave's four rows, so a row operation stays in its half only when the mask has the same bits for both halves (0xF, 0x5, 0xA, 0x0). Offline `translate --list` of the title's shader pack as a 32-lane host: "a cross-half operation on a 32-lane host" 69 -> 51 programs; compute programs emitted 2291 -> 2309 (the 2D and array mip-chain programs of levels 2-3, a cascade-shadow min/max and a trail-map mip program). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Summary
NVIDIA and Intel GPUs only execute 32-lane compute waves (
WaveLaneCountMax < 64) and reject pipelines declaringWaveSize(64).This adds Wave32 host translation mode so wave64 console programs run as two 32-lane host waves instead of failing pipeline creation:
D3D12_FEATURE_DATA_D3D12_OPTIONS1invictory-gpu(host_wave32(), overridable viaVICTORY_HOST_WAVE32).set_host_wave32/host_wave32invictory_shader::emitand emitWaveSize(32)when enabled, masking wave lane indices inread_lane,ds_bpermute, andcross_laneviahost_wave()/host_lane().victory-gpu::shader_cache::keyso Wave32 and Wave64 shader caches stay isolated.Verification
Tested on NVIDIA GeForce RTX 5060 Ti:
cargo test --release -p victory-shader --lib -- diff_tests valu_tests:33 passed; 0 failedcargo test --release -p victory-gpu --lib -- shader_cache:3 passed; 0 failed