Shaders: read both ballot halves for wave32 host-wave mask ops #145
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!145
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-145"
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?
@7ROBE on GitHub · 2026-11-24 00:57 UTC · original
7ROBE:fix/host-wave-mask-high-half→main· +299 −75 · 2 files · 1 commits · openFixes #131, #125.
What is in it
Under
MaskData::Host(pixel and vertex programs),s.wave_sizeisNoneandmask_ballottakes a ballot over the host wave, producing a(lo, hi)pair viawaveActiveBallot. Previously, the 32-bit mask-reading sites in wave32 console programs only readloand droppedhi, losing lanes 32-63 when a driver runs the stage 64-wide (e.g., AMD RDNA):s_bcnt1_i32_b32/s_ff1_i32_b32: factoredbcnt1_64andff1_64helpers (shared withs_bcnt1_i32_b64/s_ff1_i32_b64) and use both ballot halves when the operand is a tracked wave32 host mask.s_cmp_eq_u32/s_cmp_lg_u32: compare both(lo, hi)ballot halves when comparing two tracked host masks or comparing a tracked host mask against0.v_mbcnt_lo_u32_b32:-1(all-lanes mask) in a wave32 host-mask program, lower directly towaveGetLaneIndex() + src1instead of clamping to 32 atlane >= 32.laneacross bothloandhiusing a sharedbelow_maskhelper andbcnt1_64.#[cfg(test)] Module::uses_ofincrates/victory-shader/src/emit/bitcode.rsand synthetic wave32 pixel shader testhost_wave32_mask_ops_use_both_ballot_halvesincrates/victory-shader/src/emit/lower.rs(no game data).Tested
rustfmt --check --edition 2024 crates/victory-shader/src/emit/bitcode.rs crates/victory-shader/src/emit/lower.rs: passedcargo xtask policy:asset policy: 151 files okcargo clippy -p victory-shader --all-targets -- -D warnings: passed (0 warnings)cargo test -p victory-shader:70 passed; 0 failed(including GPU diff tests on RX 9060 XT + new synthetic test)cargo test --workspace --exclude victory-gpu --lib --tests: all passed (note:victory-gputest build onmain9aef3d9has a pre-existing duplicatemod testsinhost.rs:1974)AI use
AI-assisted (Antigravity / Gemini 3.1 Pro) on Windows 11, Intel i5-14600KF, AMD Radeon RX 9060 XT (Adrenalin 26.11.2). No game data was used.
@DaviTostes on GitHub · 2026-11-24 01:05 UTC · original
Tested
ecc4eb6on Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 57 passed, 0 failed (2 test binaries), including the test this PR adds.victory-gpuE0425.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
@TheHoracio on GitHub · 2026-11-24 01:19 UTC · original
GPU check of this PR on an RX 7800 XT (RDNA3, 64-lane pixel waves): a synthetic wave32 pixel program drawn through
lower+Host::drawpasses onecc4eb6. All 64 lanes are counted, andv_mbcnt_lo(-1)gives lane indices 0-63. The same test fails onmain. Details, table and test code: #125AI use: Claude Code (Claude Opus 5.5) wrote and ran the test.
@Luislariosss on GitHub · 2026-11-24 01:31 UTC · original
Independent check on an AMD RDNA4 Windows machine, and the reason the workspace was red for you:
The
E0428/victory-gpufailure is the base, not this PR. Your headecc4eb668predates the merge of #129 (d2a4bae, "rename the second test module in host.rs"), so the duplicate#[cfg(test)] mod testsis still inhost.rson your branch. Merging currentmain(d2a4bae) into it is clean, and then the whole workspace compiles.What I ran
Machine: Windows 11 build 26200, AMD Radeon RX 9060 XT (RDNA4, gfx1200), Adrenalin 26.10.1 / Windows driver
32.0.32015.7029, Rust1.98.1fromrust-toolchain.toml, MSVC from VS Build Tools 2022.victory-shaderon its own, on your unmerged head:So the fix and its test are green on this card, and the workspace is only blocked by the base. A rebase onto
mainshould turn your CI-equivalent run green without touching the change.Scope note, since #145 and #147 were opened 12 seconds apart with the same fix (
mask_ballothere,ballot_pairthere): #147 is closed, so this is the one to land. The reproduction that fails onmainbefore any fix is on the fork branchverify/wave32-mask(7004dfe3b, test-only) if you want a red-first check that does not depend on how the fix is written.AI-assisted.
@DarX-Oren on GitHub · 2026-11-24 02:39 UTC · original
Independent RDNA2 hardware validation — RX 6700 XT
Reproduced the host-wave mask issue using the public synthetic pixel shader test from #125.
Hardware:
d2a4baeThe tested local branch (
b22541a) applies the changes from #145 to main.Four additional tests reported success but internally skipped comparisons because the console compiler was unavailable.
This confirms the pixel-shader mask count and prefix behavior on RDNA2. Vertex shaders and other affected mask operations were not independently verified.
No commercial game data was used. Raw logs and pixel readbacks are available if needed.
AI use: OpenAI Codex assisted with compilation, testing and analysis on physical hardware.
@qntic on GitHub · 2026-11-24 07:49 UTC · original
Tested this branch on an RX 6600 XT (RDNA 2), which runs pixel shaders in wave64, with hardware regression tests that check every pixel against wave32 semantics. Details and the full results: #599
With this change,
s_bcnt1_i32_b32of a wave32 pixel program's EXEC returns 64 instead of 32. The count covers both console waves in the host wave, so lanes 0-31 become wrong as well (4096 of 4096 pixels wrong, against 2048 onmain). The same happens for av_cmpmask's count and for EXEC counts in a loop.A wave32 mask read should only use its own half of the ballot, as #434 does. With #434 + #599, all 11 tests pass on this GPU.
@Marvisak on GitHub · 2026-11-25 00:17 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-shader/src/emit/lower.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.