Shader tests: run the 32-lane host form on AMD cards; ds_bpermute reads within its half #363
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/Belobug--VIctory-Belobug-AMD!363
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-363"
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?
@TinkerBell-90 on GitHub · 2026-11-26 22:17 UTC · original
TinkerBell-90:host-wave32-tests→a-publier· +94 −24 · 3 files · 2 commits · openTwo commits.
1.
VICTORY_TEST_HOST_WAVE=32(test builds only). The shader tests translate with no host width, which lowers console wave64 programs as a 64-lane host does. NVIDIA and Intel cards get another form (two host waves per console wave), and today only some tests inwave64_testsandpermlane_testsset that width themselves. An RDNA card runs waves of 32 as well, so with this variable an AMD card runs the whole suite in the form those cards get. It is the test-suite side of whatVICTORY_HOST_WAVEdoes forvictory translate, with the GPU run on top. A test that sets its own width keeps it. Documented indocs/README-fxceless.md, after the validator notes:2.
ds_bpermute_b32reads within the lane's 32-lane half. The first full run in that mode changed one result:a_backward_permute_reads_the_lane_its_address_nameswas refused ("a lane permute across two host waves"). GFX10 runsds_bpermute_b32on each half of a wave of 64 on its own: lane l reads lane(l & 32) | (address / 4 & 31). LLVM hassupportsWaveWideBPermutefalse for GFX10 and GFX11 in wave64, and Mesa's ACO says "ds_bpermute is restricted to 32 lanes on GFX10-GFX11.7". So the refusal was not needed, and on 64-lane hosts the translation read the wrong lane whenever the address named the other half. @God489's #128 makes the same reading onmain, inside a larger change; this is thea-publierversion of that one point. If you would rather take it from #128, I will close this one.Tested on an RX 9070 XT under Linux: Wine 10 + vkd3d-proton 3.1 with DXVK's dxgi, Mesa 26.0.8 RADV. Not Windows, and nothing was run in game. I have not checked which of the title's programs name a lane in the other half.
victory-shader --libVICTORY_TEST_HOST_WAVE=32a-publiercd8dfc0+ commit 1The failure left in every row is
stub_pipeline_is_created(vkd3d-proton accepts the zero-digest DXIL).a_first_lane_read_of_a_wave_alike_sum_under_a_wave_alike_loopcrashes RADV's compiler on this machine, so it was skipped in every row.a_backward_permute_reads_within_the_lanes_half: lane t names lane t ^ 33 and must read t ^ 1, for 64 and 128 threads, on host waves of 64 and of 32. All four shapes ran on the card and pass.VICTORY_TEST_HOST_WAVE=32the translation is refused again.cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-gnu -- -D warningsis clean; rustfmt reports nothing on the changed lines.ds_permute_b32(the forward permute) is not touched.AI-assisted.
GFX10 runs ds_bpermute_b32 on each half of a wave of 64 on its own: lane l reads lane (l & 32) | (address / 4 & 31). LLVM says so (supportsWaveWideBPermute is false for GFX10 and GFX11 in wave64), and so does Mesa's ACO ("ds_bpermute is restricted to 32 lanes on GFX10-GFX11.7"). The translation read lane (address / 4 & 63): on 64-lane hosts a lane naming the other half read it, and on 32-lane hosts the program was refused as a permute across two host waves. It now reads within the half in both forms, and ds_bpermute no longer makes a console wave64 program exchange between its host waves.@MamaLeVrai on GitHub · 2026-11-26 23:36 UTC · original
Tested on Windows with an RDNA 2 card, to complement your Linux/RADV run: RX 6950 XT (waves 32 to 64), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release, at
184da29,cargo test -p victory-shader --lib -- --test-threads=1:VICTORY_TEST_HOST_WAVE(64-lane form): 303 passed, 0 failed, 4 ignored;VICTORY_TEST_HOST_WAVE=32(the form NVIDIA and Intel cards get): 303 passed, 0 failed, 4 ignored,a_backward_permute_reads_the_lane_its_address_namesincluded.So the whole suite in the 32-lane form also passes on the native D3D12 driver.
AI-assisted (Claude Code); no game data.
@lvndrpup on GitHub · 2026-11-27 03:52 UTC · original · reviewed
A native NVIDIA data point, beside the Linux/RADV and Windows RX 6950 XT runs: RTX 3060 Ti 8 GB (Ampere, waves of 32 lanes only), driver 610.88, Ryzen 5 5600X, 32 GB, Windows 11 build 26300, Rust 1.98.1, debug. This PR (
184da29) was merged into the currenta-publier(4eb6cfd), which it merges into cleanly. Command:victory-shader --lib -- --test-threads=1.a-publier4eb6cfdVICTORY_TEST_HOST_WAVE=32a_backward_permute_reads_the_lane_its_address_namesand the newa_backward_permute_reads_within_the_lanes_halfpass in both forms. So the whole suite in the 32-lane form also passes on a card whose hardware waves are 32 lanes.@adrianmjim on GitHub · 2026-11-27 06:49 UTC · original
Tested on an RX 7900 XT (RDNA3), driver 32.0.32029.2010, Windows 11 26300, Rust 1.98.1, release. This PR (
184da29) was merged onto a-publier4eb6cfdand compared with4eb6cfd.Negative control on the native Windows driver. I reverted the ds_bpermute lowering change in lower.rs and kept the new test:
a_backward_permute_reads_within_the_lanes_halffails 3/3 at "64 threads, host waves of 64", with and withoutVICTORY_TEST_HOST_WAVE=32. Lane t reads lane t ^ 33 instead of t ^ 1.Lib suite on this card (
--test-threads=1): the same counts as the runs above.4eb6cfd: 303 passed. This PR: 304 passed, at the default wave and withVICTORY_TEST_HOST_WAVE=32. 0 failed and 4 ignored in every case.Which of the title's programs this affects. I ran a whole-archive
translate --validate, at the default wave and withVICTORY_HOST_WAVE=32, and compared it with4eb6cfd:CS_ComputeStickyLipsand 4 shadowmask checkerboard generators (CS_GenerateShadowMasks_Checkerboard,_Checkerboard_NoHair,_RaytracedCheckerboard,CS_GenerateShadowMasksCheckerboard_SampleHairScreenSpace).WaveSize(32)). For each one, the output at the default wave is the same as at host wave 32. In a wave of 32 the addedlane & 32term is always 0, so these 5 read the same lanes as before.ds_bpermute_b32would change at the default wave, so none of the emitted programs runs a wave64 backward permute. The 195 geometry programs refused before emission are not covered.--pipelinesover those 5 programs creates all 5 pipelines, with this PR and with4eb6cfd, at host waves of 64 and 32.Not tested: WARP; in game.
@WellyngtonSantos on GitHub · 2026-11-27 13:08 UTC · original
Tested on a host that runs 64-lane waves only: RX 580 2048SP (Polaris / GCN4), AMD legacy driver 31.0.21925.1001, Windows 11 26200. Cross-compiled with the pinned 1.98.1 toolchain (
cargo xwin test -p victory-shader --release --target x86_64-pc-windows-msvc --no-run), run from the crate directory with--test-threads=1.victory-shadera-publier4eb6cfd4eb6cfd184da29alonea-publier, nothing fails. The extra test is the newa_backward_permute_reads_within_the_lanes_half. On this card it runs the 64-lane host form on the hardware and matches, with 64 and with 128 threads (ran on the hardware device (threads, host wave): [(64, 64), (128, 64)]). The device refuses the 32-lane form, and the test skips it (the hardware device does not take this program; not run) instead of failing.WaveSize(32)pipelines a 64-lane-only device can't make:ds_min_max_f32_…,v_permlane16_and_x16_…,whole_wave_f64_sum_and_cvt_f32_f64andpartial_dispatch_with_a_cross_half_wave_op_runs_in_32_lane_waves. The branch is based oncd8dfc0, before #290 made them skip on such a host. Merging cleanly intoa-publierpicks that up; a rebase would make the PR's own CI show it.So the new
ds_bpermute_b32lowering is checked on real wave64 hardware, not only on a 32-lane host.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.