Shaders: a select or carry-in on an untracked mask tests this lane's bit #1084

Open
github-bot wants to merge 1 commit from github-bot/gh-1084 into main AGit
Owner

@⁠undeadhuman37 on GitHub · 2026-11-24 15:36 UTC · original
undeadhuman37:fix/untracked-mask-select → main · +99 −18 · 2 files · 1 commits · open

v_cndmask_b32 and v_*_co_ci_u32 were refused when their scalar mask was not one that structure follows (a plain SGPR number). In compute with console lanes, the lane now tests its own bit of the register (the pair in wave64); inline 0 and -1 masks are constants.

Credit: this is taken from #585 (the mask part only). Its descriptor-dimension hunk is left out; that belongs with the resource work. It overlaps #585, so whichever merges first, the other should drop this hunk.

Measured offline over the shader corpus (26148 programs):

  • "a select on an untracked mask": 288 -> 0, with no new refusal text.
  • Those programs now stop at later refusals (descriptor read as data +205, unknown stride +32, descriptor address/format +33), so compute programs emitted only go 1441 -> 1443.

Tests: a synthetic hardware test fails before the change and passes after (run earlier on a GPU, not re-run for this PR). WARP cannot pin a wave size, so the test skips it. cargo clippy -p victory-shader --all-targets -- -D warnings is clean on this rebase.

No game data. AI-assisted: written with Claude Code (Claude Sonnet 5.5).

🤖 Generated with Claude Code

**@⁠undeadhuman37** on GitHub · 2026-11-24 15:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084) `undeadhuman37:fix/untracked-mask-select` → `main` · +99 −18 · 2 files · 1 commits · open `v_cndmask_b32` and `v_*_co_ci_u32` were refused when their scalar mask was not one that `structure` follows (a plain SGPR number). In compute with console lanes, the lane now tests its own bit of the register (the pair in wave64); inline 0 and -1 masks are constants. **Credit:** this is taken from #585 (the mask part only). Its descriptor-dimension hunk is left out; that belongs with the resource work. It overlaps #585, so whichever merges first, the other should drop this hunk. Measured offline over the shader corpus (26148 programs): - "a select on an untracked mask": 288 -> 0, with no new refusal text. - Those programs now stop at later refusals (descriptor read as data +205, unknown stride +32, descriptor address/format +33), so compute programs emitted only go 1441 -> 1443. Tests: a synthetic hardware test fails before the change and passes after (run earlier on a GPU, not re-run for this PR). WARP cannot pin a wave size, so the test skips it. `cargo clippy -p victory-shader --all-targets -- -D warnings` is clean on this rebase. No game data. AI-assisted: written with Claude Code (Claude Sonnet 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
v_cndmask_b32 and v_*_co_ci_u32 refused when their scalar mask was not one
structure followed (a plain SGPR number). In compute with console lanes the
lane now tests its own bit of the register (pair in wave64); inline 0 and -1
masks are constants. Taken from upstream PR #585 (mask part only; its
descriptor-dimension hunk is left to the resource work).

Offline corpus (26148 programs): "a select on an untracked mask" 288 -> 0, no
new refusal text; those programs now stop at later refusals (descriptor read
as data +205, unknown stride +32, descriptor address/format +33), so compute
programs emitted only 1441 -> 1443. Synthetic test on hardware: fails before,
passes after. WARP cannot pin a wave size, so the test skips it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:19:24 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 16:28 UTC · original

I replayed 105 distinct compute shaders that VIctory had refused during one local RTX 5070 mission-loading trace, after a fence-confirmed texture readback. I matched the local inputs to the logged identifiers and compared the same inputs on ffe310e and 48a41fb. The replay ran the translator offline on Windows.

On main, 47 of the 105 stopped at the untracked-mask select. All 47 advanced on this PR. Their next reported reasons were:

Next translator refusal Distinct shaders
Descriptor read only as data 29
Structured buffer of unknown stride 7
Descriptor address or format read as data 6
Scalar memory read as data 4
Lane mask holding lanes elsewhere read as data 1

Both builds still refused all 105 inputs before producing DXIL. This confirms the specific lowering change reaches this mission’s shaders and identifies which refusal appears next. The replay did not execute any of these shaders or measure frame time. AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-24 16:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084#issuecomment-7137724648) I replayed 105 distinct compute shaders that VIctory had refused during one local RTX 5070 mission-loading trace, after a fence-confirmed texture readback. I matched the local inputs to the logged identifiers and compared the same inputs on `ffe310e` and `48a41fb`. The replay ran the translator offline on Windows. On main, 47 of the 105 stopped at the untracked-mask select. All 47 advanced on this PR. Their next reported reasons were: | Next translator refusal | Distinct shaders | | --- | ---: | | Descriptor read only as data | 29 | | Structured buffer of unknown stride | 7 | | Descriptor address or format read as data | 6 | | Scalar memory read as data | 4 | | Lane mask holding lanes elsewhere read as data | 1 | Both builds still refused all 105 inputs before producing DXIL. This confirms the specific lowering change reaches this mission’s shaders and identifies which refusal appears next. The replay did not execute any of these shaders or measure frame time. AI-assisted.
Author
Owner

@⁠Zipettte on GitHub · 2026-11-24 16:29 UTC · original

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 48a41fb: cargo test -p victory-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

**@⁠Zipettte** on GitHub · 2026-11-24 16:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084#issuecomment-7137755226) Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at 48a41fb: `cargo test -p victory-shader` passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed). _Tested with AI assistance (Claude)._
Author
Owner

@⁠jtrudeau1530 on GitHub · 2026-11-24 17:14 UTC · original

Tested a local adaptation of 48a41fb together with #660 on an RX 7900 XT under Wine/vkd3d-proton. The adaptation reads the wave64 high word from the consuming instruction, requires it before the tracked-mask shortcut, and uses the exact low/high pair for that shortcut. Missing high-word metadata remains refused rather than becoming zero.

Synthetic GPU readbacks pass for all 128 threads with native wave32 and wave64 for v_cndmask_b32, v_add_co_ci_u32, v_sub_co_ci_u32, and v_subrev_co_ci_u32. The tests use unequal low/high words, rewrite only the high word between two uses, and cover inline 0/-1, root-driven uniform s_cselect, and tracked compares. Numeric masks alone must enable WAVE_OPS and pin the native wave size; no indexing instruction accidentally enables that path. Microsoft DXIL validation is mandatory. The same all-lane fixture on the unchanged parent fails at the original untracked-mask refusal.

Missing-high, rewritten-mask and divergent-carry negatives also remain refused. The latter now propagates the existing lane-mask-as-data refusal at the consuming store; its assertion checks the exact Unsupported location and reason. Hardware tests are explicitly invoked and fail if the physical adapter or validator is unavailable. This is compute-path validation of the adaptation, not a game-rendering or frame-time result, and does not resolve the later refusal groups reported above.

**@⁠jtrudeau1530** on GitHub · 2026-11-24 17:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084#issuecomment-7138896787) Tested a local adaptation of `48a41fb` together with #660 on an RX 7900 XT under Wine/vkd3d-proton. The adaptation reads the wave64 high word from the consuming instruction, requires it before the tracked-mask shortcut, and uses the exact low/high pair for that shortcut. Missing high-word metadata remains refused rather than becoming zero. Synthetic GPU readbacks pass for all 128 threads with native wave32 and wave64 for `v_cndmask_b32`, `v_add_co_ci_u32`, `v_sub_co_ci_u32`, and `v_subrev_co_ci_u32`. The tests use unequal low/high words, rewrite only the high word between two uses, and cover inline 0/-1, root-driven uniform `s_cselect`, and tracked compares. Numeric masks alone must enable WAVE_OPS and pin the native wave size; no indexing instruction accidentally enables that path. Microsoft DXIL validation is mandatory. The same all-lane fixture on the unchanged parent fails at the original untracked-mask refusal. Missing-high, rewritten-mask and divergent-carry negatives also remain refused. The latter now propagates the existing lane-mask-as-data refusal at the consuming store; its assertion checks the exact Unsupported location and reason. Hardware tests are explicitly invoked and fail if the physical adapter or validator is unavailable. This is compute-path validation of the adaptation, not a game-rendering or frame-time result, and does not resolve the later refusal groups reported above.
Author
Owner

@⁠justlovett0 on GitHub · 2026-11-24 18:48 UTC · original

Verified + integrated, with a runtime caveat. Stack: main ffe310e + #175/#994/#747/#302/#193/#704/#309/#953/#1067/#986/#1260/#1267/#1254/#1276/#189 (wave64 emulation), RTX 3080 10 GB / Win10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124). Re-census of captured runtime containers; world stable ~9 min, 0 device removals.

Merged cleanly. Note: the offline untracked-mask gain did not transfer to our captured runtime containers — the "a lane mask read as data" (7) and "a lane mask holding lanes elsewhere read as data" (6) classes persist on the runtime "Wrapped" containers. The fix works on the offline archive; our runtime masks differ (likely loaded from memory rather than the spill/select patterns). Flagging so the offline count isn't read as a runtime guarantee.

AI use: Qwen Code; local measurements. No game data posted.

**@⁠justlovett0** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084#issuecomment-7141179241) **Verified + integrated**, with a runtime caveat. Stack: main `ffe310e` + #175/#994/#747/#302/#193/#704/#309/#953/#1067/#986/#1260/#1267/#1254/#1276/#189 (wave64 emulation), RTX 3080 10 GB / Win10 21H2 (19044.7846) / driver 621.24 (32.0.16.2124). Re-census of captured runtime containers; world stable ~9 min, 0 device removals. Merged cleanly. Note: the offline untracked-mask gain did **not** transfer to our captured *runtime* containers — the "a lane mask read as data" (7) and "a lane mask holding lanes elsewhere read as data" (6) classes persist on the runtime "Wrapped" containers. The fix works on the offline archive; our runtime masks differ (likely loaded from memory rather than the spill/select patterns). Flagging so the offline count isn't read as a runtime guarantee. AI use: Qwen Code; local measurements. No game data posted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:34 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, crates/victory-shader/src/emit/valu_tests.rs.

The content has not been reviewed yet; it will be once the branch is rebased onto main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084#issuecomment-7148650635) <!-- victory-triage v1 head=48a41fb850ac37e4cdabfd94524fa11c595c0dcc verdict=needs-rebase at=2026-11-25T00:13:20Z --> 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`, `crates/victory-shader/src/emit/valu_tests.rs`. The content has not been reviewed yet; it will be once the branch is rebased onto `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠kais7654 on GitHub · 2026-11-25 15:30 UTC · original

Picking this up: rebased your commit 48a41fb onto current main (940d32f),
authorship preserved — https://github.com/Marvisak/VIctory/compare/main...kais7654:VIctory:shader/untracked-mask-lane-bit

The merge conflicts were with the stride-heap and lane-detection work
that landed since; I resolved them along the lines discussed above
(lane_bit sets WAVE_OPS itself, so the mask path needs no separate
flag), and the test now runs through main's single-threaded GPU harness.
Clippy clean with -D warnings; the mask test passes on hardware.

**@⁠kais7654** on GitHub · 2026-11-25 15:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1084#issuecomment-7166960124) Picking this up: rebased your commit 48a41fb onto current main (940d32f), authorship preserved — https://github.com/Marvisak/VIctory/compare/main...kais7654:VIctory:shader/untracked-mask-lane-bit The merge conflicts were with the stride-heap and lane-detection work that landed since; I resolved them along the lines discussed above (`lane_bit` sets `WAVE_OPS` itself, so the mask path needs no separate flag), and the test now runs through main's single-threaded GPU harness. Clippy clean with -D warnings; the mask test passes on hardware.
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/valu_tests.rs
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.
git fetch -u origin '+refs/pull/1084/head:github-bot/gh-1084'
git switch 'github-bot/gh-1084'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1084'
git switch 'github-bot/gh-1084'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1084'
git switch 'github-bot/gh-1084'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1084'
git switch 'main'
git merge --squash 'github-bot/gh-1084'
git switch 'main'
git merge --ff-only 'github-bot/gh-1084'
git switch 'main'
git merge 'github-bot/gh-1084'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1084
No description provided.