shader: support 32-lane host wave execution for console wave64 comput… #3301
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3301
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3301"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AdvaitPalve11 on GitHub · 2026-11-26 16:25 UTC · original
AdvaitPalve11:feat/shader-wave32-compatibility→main· +5 −5 · 4 files · 1 commits · open…e shaders
Xbox Series X|S consoles (AMD RDNA 2) frequently run compute shaders in Wave64 mode (wave64: true). In the host DXIL container emission:
On PC hardware with 32-lane execution units (NVIDIA GeForce RTX 20/30/40/50 series and Intel Arc), D3D12 CreateComputePipelineState unconditionally rejects pipelines requiring WaveSize(64) with 0x80070057 (E_INVALIDARG) because WaveLaneCountMax is 32.
Fix this by:
@AurumCarlos on GitHub · 2026-11-26 16:57 UTC · original · reviewed
This makes the pipelines get created, but I don't think the shaders stay correct.
wave_size = 64are lowered with console-lane semantics (console_lanes: 64-lane EXEC/VCC masks, ballots and cross-lane reads, andthread_idbuilt fromwaveReadLaneFirst+ lane index). DeclaringWaveSize(32)lets the driver split each console wave into two independent host waves, so every cross-lane op sees only half the wave, silently. That's why 64-lane programs are refused on 32-lane hosts today, and why the wave64-on-32 work (#3179, #189/#192, issue #2688) pairs or widens waves instead. Clampingthread_id's stride hides the symptom in one place but not in the masks.[32, 64]while tag 11 says exactly 32. The test only got a comment change, so nothing checks a wave64 program's results on a 32-lane adapter.@Dukestar69 on GitHub · 2026-11-26 17:30 UTC · original · reviewed
Ran local verification on Windows 11 x64 (RTX 5090 +
dxil.dllvalidator):cargo test -p victory-shader --lib emit::synthetic_tests:: -- --test-threads=1 --skip gathers_at_a_level_match_the_hardware: 8 passed, 2 failed — both Wave64 permute tests fail DXIL validation:emit::synthetic_tests::wave64_permutes_check_exec_within_each_halfemit::synthetic_tests::wave64_permutes_stay_within_each_32_lane_halfDXIL container mismatch for 'PSVRuntimeInfo' between 'PSV0' part (WaveSize=32) and DXIL module (MinimumExpectedWaveLaneCount: 32, MaximumExpectedWaveLaneCount: 64)—container.rswrites(min=32, max=64)intoPSV0whileshader.rswrites single-valueWaveSize(32)into DXIL metadata (note: wave-size ranges[WaveSize(min, max)]require SM 6.8dx.entryPointstag 23, not SM 6.6 tag 11).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@andrewpozdnakov7-jpg on GitHub · 2026-11-26 18:00 UTC · original
I tested exact
fbbca42and63bcca43with a synthetic console Wave64 shader that broadcasts the thread ID from lane 8 and lane 40. Each dispatch stores a result for all 64 threads. Verified app-local Agility 1.620.2/WARP 1.0.22 anddxil.dll1.9.2609.5, three fresh runs per revision.63bcca43: 64/64 correct for each lane in all three runs.PSVRuntimeInfomismatch in all three runs. Microsoft SM 6.6 wave-size metadataThe opt-in regression
96c7b78is the test alone on this PR. The metadata-only control is local. To preserve guest Wave64 behavior on a Wave32 device, the lowering needs to share values across the two halves or decline the shaders that require that exchange. #1890 contains a related split-wave path and independent Wave32 hardware evidence. Strict shader Clippy and policy passed for the regression code.Please retain the test's Git author if you reuse it, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding it into another commit. AI-assisted with Codex.@zed6000 on GitHub · 2026-11-26 19:35 UTC · original
The same mismatch shows up on the title's own shaders. Census of the whole
shaders.rpf(victory translate --validate --list, the Windows SDK 10.0.26100dxil.dll), this PR merged ontomain63bcca4, compared program by program:mainfail on this PR, all withDXIL container mismatch for 'PSVRuntimeInfo' between 'PSV0' part. No program goes the other way.lower.rsgives aWaveSizebecause they depend on the console's lane layout (console_lanes), or because they are one wave with LDS. So a 32-lane host wave would also change their results, as the 32-of-64 control above shows.AMD RDNA hosts run 64-lane waves, so there the clamp only removes programs that
mainalready handles.The repository's own tests on an RX 7900 XTX (driver 32.0.32029.2010):
cargo test -p victory-shader --libon this PR merged ontomaingives 299 passed, 3 failed. The failures areds_bpermute_wave64_preserves_32_lane_half,wave64_permutes_check_exec_within_each_halfandwave64_permutes_stay_within_each_32_lane_half, each with the samePSVRuntimeInfomismatch (WaveSize=32against an expected lane count of 32 to 64). Onmain(with only #2936 merged, which does not touch this code) all 302 pass.@fuzeofficlal on GitHub · 2026-11-26 21:02 UTC · original · requested changes
Requesting changes based on static audit and local verification against
origin/main(63bcca43) on Windows x64 (RTX 5090 +dxil.dlland WARP):Blocking issues
PSV0wave-size bounds contradict each other (fails DXIL validation):crates/victory-shader/src/emit/container.rs:199writesPSV0MinimumWaveLaneCount/MaximumWaveLaneCountas(32.min(n), n)((32, 64)forwave_size = 64), whereascrates/victory-shader/src/emit/shader.rs:885writes SM 6.6 entry-point tag 11 (kDxilWaveSizeTag) with a single scalar32.min(n)(32).VICTORY_WARP=0andVICTORY_WARP=1failsdxil.dllvalidation (0 passed, 3 failed):emit::lower::tests::ds_bpermute_wave64_preserves_32_lane_halfemit::synthetic_tests::wave64_permutes_check_exec_within_each_halfemit::synthetic_tests::wave64_permutes_stay_within_each_32_lane_halfDXIL container mismatch for 'PSVRuntimeInfo' between 'PSV0' part:('... WaveSize=32 ...') and DXIL module:('... MinimumExpectedWaveLaneCount: 32\n MaximumExpectedWaveLaneCount: 64 ...').32forces Wave64-capable hardware onto split 32-lane waves as well.thread_idstride does not preserve Wave64 guest semantics across split 32-lane host waves:PSV0and DXIL metadata both declared 32 lanes, only adjustingthread_idincrates/victory-shader/src/emit/lower.rs:2937leaves cross-lane and 64-lane mask operations operating only on a single 32-lane physical wave:lane_bit(lower.rs:2644), numericEXEC/VCCmasks (lower.rs:1843),s_bcnt1_i32_b64(lower.rs:3720),v_mbcnt_lo/v_mbcnt_hi(lower.rs:7794),v_readfirstlane_b32(lower.rs:6650),v_readlane_b32/v_writelane_b32(lower.rs:6688),wave::sectionsreductions/prefix sums (wave.rs:131,lower.rs:1245), and barrier-free intra-wave LDS communication between lanes0..31and32..63(lower.rs:566,3380,3436,3531).Additional note
crates/victory-shader/src/emit/synthetic_tests.rs:407silently skips anyhost.compute_pipeline(&shader)failure, and the existingwave64_permutes_*tests only verify intra-half behavior rather than cross-half (0..31<->32..63) communication on 32-lane devices.Synthetic tests only; no game data used.
@Aniseto on GitHub · 2026-11-26 21:14 UTC · original
Ran the victory-shader library suite at
fbbca42on an NVIDIA Blackwell desktop part:System
rust-toolchain.toml), MSVC 14.44.35207, DXC 1.9.2609.5 (shared env)VICTORY_D3D12_ADAPTER=NVIDIAResults
cargo test -p victory-shader --lib -- --test-threads=1: aborted with0xc0000005 STATUS_ACCESS_VIOLATIONinemit::memory_tests::heap_direct_texture_reads_mark_their_heap_index, before anytest result:line.cargo test -p victory-shader --lib -- --test-threads=1 --skip heap_direct_texture_reads_mark_their_heap_index: 298 passed, 3 failed, 3 ignored, 1 filtered out (exit 101). The three failures werea_heap_buffer_read_by_element_takes_the_views_stride,a_heap_buffer_read_where_no_buffer_view_is_reads_zerosandgathers_at_a_level_match_the_hardware.What this adds
The thread has a synthetic Wave64 broadcast test on this PR head and a title-wide census, but no report from an RTX 5070 Ti. The crashing test is the one documented in issue #2571 as killing the process on a real GPU. I re-ran the three failing tests individually on unmodified
main63bcca4with the same adapter and all three fail there too (0 passed, 1 failed each), so I do not attribute them to this PR. The Wave64 compute PSO path itself was not exercised by these tests.Not tested
The synthetic Wave64 broadcast and title shaders from the thread's reports, a paired smoke run, the full workspace suite, AMD and Intel GPUs, native wave64 hosts, Wine, release profile, game data.
AI-assisted (OpenCode), model: DeepSeek V4.1 Flash Free - checked out the PR's head commit in a detached worktree, built it, ran the tests, wrote this report; the worktree was not modified; no game data was used.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.