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.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.