Test Wave32 spilled lane masks at control-flow joins #1784

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

@⁠rezioliver-collab on GitHub · 2026-11-24 22:30 UTC · original
talleyrand222:test/wave32-spilled-mask-join-main → main · +106 −2 · 1 files · 1 commits · open

main already tracks a Wave32 lane mask spilled to a VGPR lane and read back. Its unit test checks the restored mask in the structuring pass. This PR adds a Windows D3D12 regression for what happens when a uniform branch chooses between that restored mask and a different mask computed on the other path. Existing spill-tracking test on main

The synthetic shader dispatches one 64-thread group spanning two Wave32 waves. The restored mask selects thread IDs below 40. The direct mask selects IDs below 24. Each selected thread writes 5 and every other thread writes 1 to its own slot in a zeroed buffer, so the readback catches a wrong mask or a missing store.

Verification

  • After the rebase onto 940d32f, the Windows SDK DXIL validator (1.8.2502.11) accepted the shader. An RTX 5080 returned all 64 expected values for each selector. The local WARP adapter reported no Wave32 support and skipped dispatch.
  • In a separate checkout, disabling the restored-mask lookup made this test fail during lowering with a lane-mask join of an untracked mask, the same error seen on ffe310e before spill tracking landed.
  • Both workspace Clippy configurations and the asset-policy check passed locally. GitHub CI passed on the rebased commit. CI run
Full local Windows workspace tests

The unmodified main run had 696 passing tests, 5 failures and 10 ignored tests. The rebased branch had 697 passing tests, the same 5 failures and 10 ignored tests. The added pass was wave32_spilled_mask_at_join.

  • descriptor::host::tests::dynamic_slots_are_held_until_released
  • emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride
  • emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros
  • emit::synthetic_tests::gathers_at_a_level_match_the_hardware
  • memory::tests::lists_share_a_table_and_copies_keep_their_views

AI-assisted with OpenAI Codex.

**@⁠rezioliver-collab** on GitHub · 2026-11-24 22:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/1784) `talleyrand222:test/wave32-spilled-mask-join-main` → `main` · +106 −2 · 1 files · 1 commits · open `main` already tracks a Wave32 lane mask spilled to a VGPR lane and read back. Its unit test checks the restored mask in the structuring pass. This PR adds a Windows D3D12 regression for what happens when a uniform branch chooses between that restored mask and a different mask computed on the other path. [Existing spill-tracking test on `main`](https://github.com/Marvisak/VIctory/blob/940d32f69b22265690a0b5a15d6ded572ba33baf/crates/victory-shader/src/structure.rs#L1470) The synthetic shader dispatches one 64-thread group spanning two Wave32 waves. The restored mask selects thread IDs below 40. The direct mask selects IDs below 24. Each selected thread writes `5` and every other thread writes `1` to its own slot in a zeroed buffer, so the readback catches a wrong mask or a missing store. ### Verification - After the rebase onto `940d32f`, the Windows SDK DXIL validator (1.8.2502.11) accepted the shader. An RTX 5080 returned all 64 expected values for each selector. The local WARP adapter reported no Wave32 support and skipped dispatch. - In a separate checkout, disabling the restored-mask lookup made this test fail during lowering with `a lane-mask join of an untracked mask`, the same error seen on `ffe310e` before spill tracking landed. - Both workspace Clippy configurations and the asset-policy check passed locally. GitHub CI passed on the rebased commit. [CI run](https://github.com/Marvisak/VIctory/actions/runs/45627896619) <details> <summary>Full local Windows workspace tests</summary> The unmodified `main` run had 696 passing tests, 5 failures and 10 ignored tests. The rebased branch had 697 passing tests, the same 5 failures and 10 ignored tests. The added pass was `wave32_spilled_mask_at_join`. - `descriptor::host::tests::dynamic_slots_are_held_until_released` - `emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride` - `emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros` - `emit::synthetic_tests::gathers_at_a_level_match_the_hardware` - `memory::tests::lists_share_a_table_and_copies_keep_their_views` </details> AI-assisted with OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:30 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-24 22:34 UTC · original

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

**@⁠DesertGamer** on GitHub · 2026-11-24 22:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1784#issuecomment-7146394473) ### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:36 UTC · original · edited 2026-11-25 15:24 UTC

Automated triage for the maintainers.

Merge candidate (worth a look). Now that it merges cleanly: this adds wave32_spilled_mask_at_join to emit/valu_tests.rs, a 64-thread Wave32 compute shader where a uniform branch joins a lane mask restored by v_readlane_b32 with one computed directly, reading each thread's output back for both branch selectors. I checked the hand-encoded instructions (v_cmp_gt_u32, v_writelane/v_readlane, the s_cmp_eq_u32/s_cbranch_scc0/s_branch offsets, s_and_saveexec_b32, s_or_b32, v_lshlrev_b32, the MUBUF offen bits): branch targets and expected values match. Lowering runs unconditionally, so CI exercises the lower.rs lane-mask join path even without a GPU. The small try_lower_valu_cs refactor leaves the existing helper's behaviour unchanged. CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/1784#issuecomment-7149737749) · edited 2026-11-25 15:24 UTC <!-- victory-triage v1 head=ca8652e51923ff035ad5fb09e88ffe765928de57 verdict=merge-candidate at=2026-11-25T15:33:00Z --> Automated triage for the maintainers. **Merge candidate (worth a look).** Now that it merges cleanly: this adds `wave32_spilled_mask_at_join` to `emit/valu_tests.rs`, a 64-thread Wave32 compute shader where a uniform branch joins a lane mask restored by `v_readlane_b32` with one computed directly, reading each thread's output back for both branch selectors. I checked the hand-encoded instructions (`v_cmp_gt_u32`, `v_writelane`/`v_readlane`, the `s_cmp_eq_u32`/`s_cbranch_scc0`/`s_branch` offsets, `s_and_saveexec_b32`, `s_or_b32`, `v_lshlrev_b32`, the MUBUF `offen` bits): branch targets and expected values match. Lowering runs unconditionally, so CI exercises the `lower.rs` lane-mask join path even without a GPU. The small `try_lower_valu_cs` refactor leaves the existing helper's behaviour unchanged. CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 23:04 UTC · original · approved these changes

Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests.

Wave32 spilled lane masks at control-flow joins: wave32_spilled_mask_at_join lowers through try_lower_valu_cs. +2 macOS tests.

**@⁠catminou4** on GitHub · 2026-11-24 23:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/1784#pullrequestreview-6048809707) · **approved these changes** Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (70564ae), cargo test -p victory-shader --locked → 118 passed, 0 failed. GPU execution tests (valu_tests/host) are #[cfg(all(test, windows))] and run only on Windows; macOS covers lowering/structure unit tests. Wave32 spilled lane masks at control-flow joins: wave32_spilled_mask_at_join lowers through try_lower_valu_cs. +2 macOS tests.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 19:13 UTC · original · approved these changes

Verified locally merged onto origin/main (63bcca43, Windows 11 x64, Rust 1.98.1 MSVC, RTX 5090 & WARP):

  • cargo test --locked -p victory-shader --lib wave32_spilled_mask_at_join (VICTORY_WARP=0) — 1 passed, 0 failed (hardware: branch 0, all 64 thread values matched and hardware: branch 1, all 64 thread values matched; WARP skips GPU readback as Wave32 is unavailable)
  • cargo test --locked -p victory-shader --lib wave32_spilled_mask_at_join (VICTORY_WARP=1) — 1 passed, 0 failed (lowering runs; GPU readback skips cleanly without Wave32)
  • cargo clippy --locked -p victory-shader --all-targets -- -D warnings (default and --all-features) — 0 warnings
  • cargo xtask policy — ok (191 files ok)

Review notes

  • Decoded all 18 machine words and branch offsets (0xBF84_0003, 0xBF82_0001): the test spills s6 (thread ID < 40) via v_writelane_b32 into v20 lane 1, restores it via v_readlane_b32 into s12 on one arm of the s0 == 0 uniform branch, joins with s14 (thread ID < 24) on the other arm, and verifies all 64 threads across two Wave32 waves.
  • Minor note if combining with #2225: wave32_spilled_mask_at_join (valu_tests.rs:321) uses [("hardware", false), ("WARP", true)], which can switch to Host::test_backends() once #2225 lands.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 19:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/1784#pullrequestreview-6079376020) · **approved these changes** Verified locally merged onto `origin/main` (`63bcca43`, Windows 11 x64, Rust 1.98.1 MSVC, RTX 5090 & WARP): - `cargo test --locked -p victory-shader --lib wave32_spilled_mask_at_join` (`VICTORY_WARP=0`) — **1 passed, 0 failed** (`hardware: branch 0, all 64 thread values matched` and `hardware: branch 1, all 64 thread values matched`; WARP skips GPU readback as Wave32 is unavailable) - `cargo test --locked -p victory-shader --lib wave32_spilled_mask_at_join` (`VICTORY_WARP=1`) — **1 passed, 0 failed** (lowering runs; GPU readback skips cleanly without Wave32) - `cargo clippy --locked -p victory-shader --all-targets -- -D warnings` (default and `--all-features`) — 0 warnings - `cargo xtask policy` — ok (`191 files ok`) ### Review notes - Decoded all 18 machine words and branch offsets (`0xBF84_0003`, `0xBF82_0001`): the test spills `s6` (`thread ID < 40`) via `v_writelane_b32` into `v20` lane 1, restores it via `v_readlane_b32` into `s12` on one arm of the `s0 == 0` uniform branch, joins with `s14` (`thread ID < 24`) on the other arm, and verifies all 64 threads across two Wave32 waves. - Minor note if combining with #2225: `wave32_spilled_mask_at_join` (`valu_tests.rs:321`) uses `[("hardware", false), ("WARP", true)]`, which can switch to `Host::test_backends()` once #2225 lands.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1784/head:github-bot/gh-1784'
git switch 'github-bot/gh-1784'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1784'
git switch 'github-bot/gh-1784'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1784'
git switch 'github-bot/gh-1784'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1784'
git switch 'main'
git merge --squash 'github-bot/gh-1784'
git switch 'main'
git merge --ff-only 'github-bot/gh-1784'
git switch 'main'
git merge 'github-bot/gh-1784'
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!1784
No description provided.