Shaders: do not require a fixed WaveSize for 1-thread LDS compute shaders #78
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!78
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-78"
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?
@vicennpacheco on GitHub · 2026-11-24 21:17 UTC · original
vicennpacheco:fix/single-thread-lds-wave-size→main· +50 −6 · 2 files · 1 commits · openProblem
In
crates/victory-shader/src/emit/lower.rs,one_wavewas computed asgroup <= wave, so a 1-thread compute shader ([1, 1, 1]) that allocates LDS still emittedWaveSize(32)even whenconsole_lanesis false.A single-thread group has no other threads sharing LDS without barriers, so requiring a fixed
WaveSize(32)is unnecessary and causesCreateComputePipelineStateto fail withE_INVALIDARGon:gfx90c, whereWaveLaneCountMin = WaveLaneCountMax = 64), makingemit::valu_tests::ds_min_max_f32_order_floats_and_return_the_old_valuefail on hardware.run_cases_on(..., &[("hardware", false)])).Fix
crates/victory-shader/src/emit/lower.rs: changeone_wavetogroup > 1 && group <= wave. Multi-thread single-wave LDS shaders (2..=wave) and any shader withconsole_lanes == truekeep the exact sameWaveSizemetadata as before.crates/victory-shader/src/emit/lower.rs: add unit testemit::lower::tests::single_thread_lds_omits_wave_sizeverifyingwave_size == Noneforthreads = [1, 1, 1]andwave_size == Some(32)forthreads = [2, 1, 1].crates/victory-shader/src/emit/valu_tests.rs: runds_min_max_f32_order_floats_and_return_the_old_valueviarun_caseson both hardware and WARP now that neither rejects it.Tested
Setup: Windows 11, Ryzen 7 5825U, AMD Radeon Vega 8 iGPU (GCN 5 /
gfx90c, PCI1002:15E7, AMD Windows driver31.0.21921.13001), Rust1.98.1(x86_64-pc-windows-msvc), MSVC19.44.35230.0, Windows SDK10.0.26100.0. No game files.main4e17478):ds_min_max_f32_order_floats_and_return_the_old_valuefailed on hardware (compute_pipeline failed: E_INVALIDARG) and did not run on WARP.cargo test -p victory-shader --lib -- ds_min_max_f32: 2/2 passed (both hardware Vega 8 and WARP).cargo test -p victory-shader --lib -- single_thread_lds_omits_wave_size: 1/1 passed.cargo clippy -p victory-shader --tests -- -D warnings: clean (0 warnings).cargo test --workspace --no-fail-fast -j 2: 496 passed, 1 failed, 7 ignored (+2 passed vs baseline 494/2: the fixedds_min_max_f32test and the new unit test; the 1 remaining failure is the unrelated pre-existing GCN 5waterfall_tests::lanes_load_from_the_buffer_their_nested_arms_chosehardware mismatch).AI-assisted.
@arminkhaleghirod on GitHub · 2026-11-24 21:42 UTC · original
Merged onto main
90228a7and ranvictory translate --validateover the full title (26,148 programs) on Windows 11 / RTX 4080. Changes against main, by failure reason:No change: every failure count is the same as main, and no new reason appears. So no regression in translation. What this PR changes at run time isn't covered by this check.
@adriaespii on GitHub · 2026-11-24 21:43 UTC · original
Independent test run on commit
39350ca(AMD RDNA4):x86_64-pc-windows-msvc)cargo clippy --workspace --all-targets -- -D warnings: 0 warningscargo test --workspace: 497 passed, 0 failed, 7 ignored (victory-shader: 211 passed, 0 failed, 2 ignored;victory-gpu: 110 passed, 0 failed, 1 ignored)AI use: Antigravity (Gemini 4 Neon) ran clippy/tests locally and wrote this report.
@GeaorgeAyvazov on GitHub · 2026-11-24 21:58 UTC · original
Hardware compatibility check for the proposed change on Intel Iris Xe (30.0.101.1029) and RTX 3070 Ti Laptop (32.0.15.9186). I compiled a standalone cs_6_6 one-thread shader using DXC, with and without [WaveSize(32)]. The shader initialized a groupshared uint from UAV input 3, synchronized, executed InterlockedMax with UAV input 5, then wrote both the old and final value to the UAV. All four dispatches succeeded and returned (3,5). This checks the hardware behavior relevant to dropping the attribute on these two drivers. It is a standalone DXIL probe; the PR-specific emitter tests were not run here. Tested with Codex assistance.
test result: FAILED. 204 passed; 6 failed; 2 ignored; 0 measured; 0 filtered out; finished in 6.90s#356View 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.