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

Open
kais7654 wants to merge 2 commits from upstream-pr/2539 into main
kais7654 commented 2026-11-25 15:30:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-25T15:30:20Z.


Rebases #1084 by @undeadhuman37 onto main (940d32f), with the authorship
preserved. Its merge had grown conflicts with the stride-heap work and the
lane-aware mask detection main already carries; this picks the commit onto
main and resolves them per the integration discussed on the PR.

What it does: v_cndmask_b32 and v_add_co_ci_u32 / v_sub_co_ci_u32 /
v_subrev_co_ci_u32 were refused when their scalar mask was not one
structure followed (a plain SGPR number — "a select on an untracked
mask", "a carry-in from an untracked mask"). In compute with console
lanes, the lane now tests its own bit of the mask register (the high pair
in wave64). Inline 0 and -1 masks are constants. The detection main
already has for these opcodes now leads to accepted lowering instead of a
refusal. Kept from #585's mask part (closed in favor of #1084); the
descriptor-dimension hunk stays with the resource work.

Offline corpus (per the original PR, 26148 programs): "a select on an
untracked mask" 288 -> 0, no new refusal text; those programs stop at
later refusals, and compute programs emitted 1441 -> 1443. The synthetic
test runs and passes on hardware (WARP cannot pin a wave size, so the
test skips it): fails before, passes after.

Local check on this rebase: clippy clean with -D warnings, and the
victory-shader suite passes the mask test on an RTX.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5494322949 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2539). Originally posted by [kais7654](https://github.com/kais7654) on 2026-11-25T15:30:20Z. --- Rebases #1084 by @undeadhuman37 onto main (940d32f), with the authorship preserved. Its merge had grown conflicts with the stride-heap work and the lane-aware mask detection main already carries; this picks the commit onto main and resolves them per the integration discussed on the PR. What it does: `v_cndmask_b32` and `v_add_co_ci_u32` / `v_sub_co_ci_u32` / `v_subrev_co_ci_u32` were refused when their scalar mask was not one `structure` followed (a plain SGPR number — "a select on an untracked mask", "a carry-in from an untracked mask"). In compute with console lanes, the lane now tests its own bit of the mask register (the high pair in wave64). Inline 0 and -1 masks are constants. The detection main already has for these opcodes now leads to accepted lowering instead of a refusal. Kept from #585's mask part (closed in favor of #1084); the descriptor-dimension hunk stays with the resource work. Offline corpus (per the original PR, 26148 programs): "a select on an untracked mask" 288 -> 0, no new refusal text; those programs stop at later refusals, and compute programs emitted 1441 -> 1443. The synthetic test runs and passes on hardware (WARP cannot pin a wave size, so the test skips it): fails before, passes after. Local check on this rebase: clippy clean with -D warnings, and the victory-shader suite passes the mask test on an RTX.
fyernald commented 2026-11-25 17:33:28 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fyernald on 2026-11-25T17:33:28Z.

Review: COMMENTED


Test results from RTX 3080 (617.42), Windows 10 (19045) plus WARP, main 67e8ae1 + #486 + #2596 (the suite crashes on NVIDIA without #2596, #2571). cargo test -p victory-shader --lib --locked -- --test-threads=1: 268 passed, 3 failed (the #1835 ones, also on the base). v_cndmask_on_an_untracked_mask_tests_this_lanes_bit passes on both adapters.

I checked the results on hardware but haven't gone through the new gating in structure in depth, so this is data, not an approval.

<!-- greyfinch-sync:Marvisak/VIctory:review:6062138046 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2539#pullrequestreview-6062138046). Originally posted by [fyernald](https://github.com/fyernald) on 2026-11-25T17:33:28Z. **Review:** COMMENTED --- Test results from **RTX 3080 (617.42), Windows 10 (19045)** plus WARP, `main` `67e8ae1` + #486 + #2596 (the suite crashes on NVIDIA without #2596, #2571). `cargo test -p victory-shader --lib --locked -- --test-threads=1`: 268 passed, 3 failed (the #1835 ones, also on the base). `v_cndmask_on_an_untracked_mask_tests_this_lanes_bit` passes on both adapters. I checked the results on hardware but haven't gone through the new gating in `structure` in depth, so this is data, not an approval.
Marvisak commented 2026-11-25 19:06:23 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:33:28Z.


Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: green CI, agree with #1084 which PR carries the change, use the same mask lookup in console_lanes and mask_cond, refuse a missing high dword in wave64, and test several lanes with differing mask bits.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171071271 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2539#issuecomment-7171071271). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T18:33:28Z. --- <!-- victory-triage v1 head=caa4f495112c835d98d1e15806f8f938d38322e7 verdict=needs-rebase at=2026-11-25T22:33:35Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-shader/src/emit/valu_tests.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: green CI, agree with #1084 which PR carries the change, use the same mask lookup in `console_lanes` and `mask_cond`, refuse a missing high dword in wave64, and test several lanes with differing mask bits. --- _Generated by [Claude Code](https://claude.ai/code)_
borosf commented 2026-11-27 17:12:22 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by borosf on 2026-11-27T17:12:22Z.


Coordination note: same title as #1084 by @undeadhuman37, opened earlier (+99/−18 vs +124/−42). If this is the same fix, one of them should close; if yours covers more, say what.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7224146297 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2539#issuecomment-7224146297). Originally posted by [borosf](https://github.com/borosf) on 2026-11-27T17:12:22Z. --- Coordination note: same title as #1084 by @undeadhuman37, opened earlier (+99/−18 vs +124/−42). If this is the same fix, one of them should close; if yours covers more, say what.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2539:upstream-pr/2539'
git switch 'upstream-pr/2539'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2539'
git switch 'upstream-pr/2539'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2539'
git switch 'upstream-pr/2539'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2539'
git switch 'main'
git merge --squash 'upstream-pr/2539'
git switch 'main'
git merge --ff-only 'upstream-pr/2539'
git switch 'main'
git merge 'upstream-pr/2539'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!2537
No description provided.