Shader tests: check Wave64 binary64 sums after one half exits a loop #3501

Open
Venom2054 wants to merge 7 commits from upstream-pr/3501 into main
Venom2054 commented 2026-11-27 10:45:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Venom2054 on 2026-11-27T10:45:25Z.


This is the masked-loop regression requested in #2978, stacked on f923b5d. Review the single test commit. The other commits shown against main belong to the parent stack.

Three synthetic groups each start with 64 lanes. Only the upper half, lower half, or lane 63 continues to the second iteration. The readback checks both words of the binary64 sum for each active lane and both initialized marker words for each lane that exited. The inputs keep all intermediate sums exactly representable and give each lane a distinct contribution to the low word.

Second iteration Expected result, high and low words
Upper half 40400000_00000c20
Lower half 40400000_00000420
Lane 63 3ff00000_00001000

A native Wave64 hardware readback is requested. On Microsoft app-local WARP 1.0.22, all 192 first-iteration results and 127 inactive-lane markers matched. All 65 continuing lanes returned the first sum, 40500000_00000820. A separate DXC-compiled HLSL control using WaveActiveSum(double) inside a divergent loop showed the same result on WARP. A uniform two-iteration HLSL control that zeroed inactive contributions passed all 65 second-iteration sums. This leaves the cause on native Wave64 hardware open.

On an RTX 5070 Ti, the parent stack requires a native wave of 64 for this program and correctly skips dispatch on the 32-lane adapter. In a separate split-Wave64 implementation based on #439, the identical synthetic instruction words, inputs and expected results passed all 768 output-word checks on that card.

To reproduce, run cargo test -p victory-shader --lib --features host --locked a_wave64_binary64_sum_observes_early_loop_exits -- --nocapture. The output identifies devices skipped for wave width and devices that executed the check. For the software comparison, run a copy of the test executable next to the x64 d3d10warp.dll from Microsoft.Direct3D.WARP 1.0.22.

The patch passes shader all-target/all-feature Clippy with warnings denied and the repository asset check. The full local shader suite also encountered an access violation in heap_direct_texture_reads_mark_their_heap_index; the same isolated test crashed at the unmodified parent. The new fixture uses hand-written instructions and synthetic inputs. Implementation and testing were assisted by Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5525294476 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3501). Originally posted by [Venom2054](https://github.com/Venom2054) on 2026-11-27T10:45:25Z. --- This is the masked-loop regression requested in [#2978](https://github.com/Marvisak/VIctory/pull/2978#issuecomment-7207309924), stacked on `f923b5d`. [Review the single test commit](https://github.com/Venom2054/VIctory/commit/55353e5b08412d7d42aed77946415737238ca2b8). The other commits shown against main belong to the parent stack. Three synthetic groups each start with 64 lanes. Only the upper half, lower half, or lane 63 continues to the second iteration. The readback checks both words of the binary64 sum for each active lane and both initialized marker words for each lane that exited. The inputs keep all intermediate sums exactly representable and give each lane a distinct contribution to the low word. | Second iteration | Expected result, high and low words | | --- | --- | | Upper half | `40400000_00000c20` | | Lower half | `40400000_00000420` | | Lane 63 | `3ff00000_00001000` | **A native Wave64 hardware readback is requested.** On Microsoft app-local WARP 1.0.22, all 192 first-iteration results and 127 inactive-lane markers matched. All 65 continuing lanes returned the first sum, `40500000_00000820`. A separate DXC-compiled HLSL control using `WaveActiveSum(double)` inside a divergent loop showed the same result on WARP. A uniform two-iteration HLSL control that zeroed inactive contributions passed all 65 second-iteration sums. This leaves the cause on native Wave64 hardware open. On an RTX 5070 Ti, the parent stack requires a native wave of 64 for this program and correctly skips dispatch on the 32-lane adapter. In a separate split-Wave64 implementation based on #439, the identical synthetic instruction words, inputs and expected results passed all 768 output-word checks on that card. To reproduce, run `cargo test -p victory-shader --lib --features host --locked a_wave64_binary64_sum_observes_early_loop_exits -- --nocapture`. The output identifies devices skipped for wave width and devices that executed the check. For the software comparison, run a copy of the test executable next to the x64 `d3d10warp.dll` from Microsoft.Direct3D.WARP 1.0.22. The patch passes shader all-target/all-feature Clippy with warnings denied and the repository asset check. The full local shader suite also encountered an access violation in `heap_direct_texture_reads_mark_their_heap_index`; the same isolated test crashed at the unmodified parent. The new fixture uses hand-written instructions and synthetic inputs. Implementation and testing were assisted by Codex.
oni-swr commented 2026-11-27 11:35:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-27T11:35:37Z.


Independent WARP/CPU verification (no physical GPU), Windows 11 build 26200, Rust 1.98.1 debug build, cargo test -p victory-shader --lib --features host --locked, VICTORY_WARP=1 and VICTORY_D3D12_WARP=1, dxil.dll 10.0.19041.5609 (Windows SDK redist). Synthetic tests only.

Commits: base 63bcca4 (main), parent f923b5d, head 55353e5b.

The new test, on head 55353e5b (masked_sum_tests::a_wave64_binary64_sum_observes_early_loop_exits):

  • System WARP 10.0.26100.9818 (4-lane waves): passes, but only by skipping (native Wave64/FP64 unavailable (lanes 4..4); skipped), so it checks nothing here.
  • App-local Microsoft.Direct3D.WARP 1.0.22.0 next to the test exe: the test runs and fails. The first mismatch per group is (group 0, lane 0x20), (group 1, lane 0), (group 2, lane 0x3f). In each, the continuing lane returns 40500000_00000820 (the first-iteration sum) where 40400000_00000c20, 40400000_00000420 and 3ff00000_00001000 were expected. This is the same result the PR describes for WARP 1.0.22, so the fixture reproduces it. It is red by design until the Wave64 behaviour is resolved; it will be red in any environment that runs it on that WARP.

Parent f923b5d: the test does not exist (312 tests listed, 313 on head); masked_sum filters to 0 tests.

Suite, base vs head (--test-threads 1; the same sets also appeared at 4 threads):

WARP base 63bcca4 head 55353e5b
system 10.0.26100.9818 298 passed, 4 failed, 3 ignored 304 passed, 6 failed, 3 ignored
app-local 1.0.22 296 passed, 6 failed, 3 ignored 303 passed, 7 failed, 3 ignored
  • The failures present on base are the same on head: synthetic_tests::{gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out, permutes_mask_high_address_bits_and_divergent_branches, a_mask_joined_with_data_at_a_uniform_loop_is_its_number} on the system WARP, and a similar set (plus hosts_that_do_not_fuse_are_named, wave64_permutes_stay_within_each_32_lane_half, edge_flagged_triangles_draw_as_unflagged_ones) on 1.0.22.
  • Head's only additions: the new test (fails on 1.0.22, as above) and, on the system WARP only, two tests from the parent stack: valu_tests::a_whole_wave_binary64_sum_counts_the_active_lanes_only and valu_tests::a_whole_wave_binary64_sum_reaches_the_host. They panic at crates/victory-shader/src/emit/valu_tests.rs:239 with hardware: compute_pipeline failed: The parameter is incorrect. They fail the same way at the parent f923b5d, so they are not from the reviewed commit. The commit message of ab08acb says they skip WARP's 4-lane waves, but on this system WARP they fail instead. They pass on 1.0.22.

Findings: no blockers in the reviewed commit. The new test is a deliberate failing repro on WARP 1.0.22 and a vacuous pass on 4-lane WARP. The valu_tests.rs:239 failure on the system WARP belongs to the parent stack.

Not verified: native Wave64 hardware (no GPU here).

AI-assisted (Claude Code / Claude Sonnet 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7217253047 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3501#issuecomment-7217253047). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-27T11:35:37Z. --- Independent WARP/CPU verification (no physical GPU), Windows 11 build 26200, Rust 1.98.1 debug build, `cargo test -p victory-shader --lib --features host --locked`, `VICTORY_WARP=1` and `VICTORY_D3D12_WARP=1`, dxil.dll 10.0.19041.5609 (Windows SDK redist). Synthetic tests only. Commits: base `63bcca4` (main), parent `f923b5d`, head `55353e5b`. **The new test, on head `55353e5b`** (`masked_sum_tests::a_wave64_binary64_sum_observes_early_loop_exits`): - System WARP 10.0.26100.9818 (4-lane waves): passes, but only by skipping (`native Wave64/FP64 unavailable (lanes 4..4); skipped`), so it checks nothing here. - App-local Microsoft.Direct3D.WARP 1.0.22.0 next to the test exe: the test runs and **fails**. The first mismatch per group is (group 0, lane 0x20), (group 1, lane 0), (group 2, lane 0x3f). In each, the continuing lane returns `40500000_00000820` (the first-iteration sum) where `40400000_00000c20`, `40400000_00000420` and `3ff00000_00001000` were expected. This is the same result the PR describes for WARP 1.0.22, so the fixture reproduces it. It is red by design until the Wave64 behaviour is resolved; it will be red in any environment that runs it on that WARP. **Parent `f923b5d`:** the test does not exist (312 tests listed, 313 on head); `masked_sum` filters to 0 tests. **Suite, base vs head** (`--test-threads 1`; the same sets also appeared at 4 threads): | WARP | base `63bcca4` | head `55353e5b` | | --- | --- | --- | | system 10.0.26100.9818 | 298 passed, 4 failed, 3 ignored | 304 passed, 6 failed, 3 ignored | | app-local 1.0.22 | 296 passed, 6 failed, 3 ignored | 303 passed, 7 failed, 3 ignored | - The failures present on base are the same on head: `synthetic_tests::{gathers_at_a_level_match_the_hardware, permutes_read_the_lane_named_and_zero_from_lanes_left_out, permutes_mask_high_address_bits_and_divergent_branches, a_mask_joined_with_data_at_a_uniform_loop_is_its_number}` on the system WARP, and a similar set (plus `hosts_that_do_not_fuse_are_named`, `wave64_permutes_stay_within_each_32_lane_half`, `edge_flagged_triangles_draw_as_unflagged_ones`) on 1.0.22. - Head's only additions: the new test (fails on 1.0.22, as above) and, on the system WARP only, two tests from the parent stack: `valu_tests::a_whole_wave_binary64_sum_counts_the_active_lanes_only` and `valu_tests::a_whole_wave_binary64_sum_reaches_the_host`. They panic at `crates/victory-shader/src/emit/valu_tests.rs:239` with `hardware: compute_pipeline failed: The parameter is incorrect.` They fail the same way at the parent `f923b5d`, so they are not from the reviewed commit. The commit message of `ab08acb` says they skip WARP's 4-lane waves, but on this system WARP they fail instead. They pass on 1.0.22. **Findings:** no blockers in the reviewed commit. The new test is a deliberate failing repro on WARP 1.0.22 and a vacuous pass on 4-lane WARP. The `valu_tests.rs:239` failure on the system WARP belongs to the parent stack. Not verified: native Wave64 hardware (no GPU here). AI-assisted (Claude Code / Claude Sonnet 5.5).
ColorMeBoom commented 2026-11-27 13:52:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by ColorMeBoom on 2026-11-27T13:52:07Z.


AMD run: RX 5700 XT (RDNA1, 32–64 lanes, native Wave64 and FP64), driver 32.0.21045.29003, Windows 11 26200, Rust 1.98.1, debug. The head was merged onto main 63bcca4 and run on the native adapter (VICTORY_WARP unset), no game files. Head 55353e5. This is the native Wave64 readback the description asks for.

  • a_wave64_binary64_sum_observes_early_loop_exits passes on hardware: hardware: verified both iterations in all three Wave64 groups. The upper half, the lower half and lane 63 each get their second-iteration sum, so on native Wave64 the translated program gives the right results. The system WARP in the same run skipped (native Wave64/FP64 unavailable (lanes 4..4)). That points to the continuing lanes returning 40500000_00000820 being WARP 1.0.22's behaviour, which matches your DXC WaveActiveSum(double) control on WARP, and not the translation's. I didn't run app-local WARP 1.0.22 here.
  • The parent stack's a_whole_wave_binary64_sum_reaches_the_host and a_whole_wave_binary64_sum_counts_the_active_lanes_only pass on this card. The system WARP skips them with no pipeline for a wave of 32, as ab08acb intends; on @oni-swr's machine they panicked there instead. a_64_bit_value_converts_to_f32_round_to_nearest and both wave::tests binary64 tests pass.
  • Full victory-shader suite (--features host): 310 passed, 0 failed, 3 ignored. heap_direct_texture_reads_mark_their_heap_index didn't crash on this card. cargo clippy -p victory-shader --all-targets --features host -- -D warnings: clean.

AI use: Claude Code (Claude Opus 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7220043437 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3501#issuecomment-7220043437). Originally posted by [ColorMeBoom](https://github.com/ColorMeBoom) on 2026-11-27T13:52:07Z. --- **AMD run: RX 5700 XT** (RDNA1, 32–64 lanes, native Wave64 and FP64), driver 32.0.21045.29003, Windows 11 26200, Rust 1.98.1, debug. The head was merged onto `main` `63bcca4` and run on the native adapter (`VICTORY_WARP` unset), no game files. Head `55353e5`. This is the native Wave64 readback the description asks for. - **`a_wave64_binary64_sum_observes_early_loop_exits` passes on hardware:** `hardware: verified both iterations in all three Wave64 groups`. The upper half, the lower half and lane 63 each get their second-iteration sum, so on native Wave64 the translated program gives the right results. The system WARP in the same run skipped (`native Wave64/FP64 unavailable (lanes 4..4)`). That points to the continuing lanes returning `40500000_00000820` being WARP 1.0.22's behaviour, which matches your DXC `WaveActiveSum(double)` control on WARP, and not the translation's. I didn't run app-local WARP 1.0.22 here. - The parent stack's `a_whole_wave_binary64_sum_reaches_the_host` and `a_whole_wave_binary64_sum_counts_the_active_lanes_only` pass on this card. The system WARP skips them with `no pipeline for a wave of 32`, as `ab08acb` intends; on @oni-swr's machine they panicked there instead. `a_64_bit_value_converts_to_f32_round_to_nearest` and both `wave::tests` binary64 tests pass. - Full `victory-shader` suite (`--features host`): **310 passed, 0 failed, 3 ignored**. `heap_direct_texture_reads_mark_their_heap_index` didn't crash on this card. `cargo clippy -p victory-shader --all-targets --features host -- -D warnings`: clean. AI use: Claude Code (Claude Opus 5.5).
oddmaniv commented 2026-11-27 14:18:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oddmaniv on 2026-11-27T14:18:51Z.


Independent verification of the PR author's concurrent WARP pipeline/draw test at 55353e5b08412d7d42aed77946415737238ca2b8.

cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocapture

Tree Result
Unmodified PR head 1 passed, 0 failed, 0 ignored; native exit 0
Unmodified main 1 passed, 0 failed, 0 ignored; native exit 0
PR patch applied to pinned main 1 passed, 0 failed, 0 ignored; native exit 0

Main baseline pin: 63bcca43c6a00a758510398fa43096ce7e4f7df0.

Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits.
This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed.

AI-assisted verification.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7220625060 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3501#issuecomment-7220625060). Originally posted by [oddmaniv](https://github.com/oddmaniv) on 2026-11-27T14:18:51Z. --- Independent verification of the PR author's concurrent WARP pipeline/draw test at `55353e5b08412d7d42aed77946415737238ca2b8`. `cargo test --locked -p victory-shader --lib emit::host::tests::parallel_warp_pipelines_and_draws -- --exact --nocapture` | Tree | Result | | --- | --- | | Unmodified PR head | 1 passed, 0 failed, 0 ignored; native exit 0 | | Unmodified main | 1 passed, 0 failed, 0 ignored; native exit 0 | | PR patch applied to pinned main | 1 passed, 0 failed, 0 ignored; native exit 0 | Main baseline pin: `63bcca43c6a00a758510398fa43096ce7e4f7df0`. Windows x86_64 MSVC native runs. Local and remote source snapshots matched before and after each check. The adaptation applies the PR diff without additional source edits. This is focused regression coverage, not the full workspace suite, a gameplay test, or an independent validation of every behavior in the PR. No new fix is claimed. AI-assisted verification.
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/3501:upstream-pr/3501'
git switch 'upstream-pr/3501'

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/3501'
git switch 'upstream-pr/3501'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3501'
git switch 'upstream-pr/3501'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3501'
git switch 'main'
git merge --squash 'upstream-pr/3501'
git switch 'main'
git merge --ff-only 'upstream-pr/3501'
git switch 'main'
git merge 'upstream-pr/3501'
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!3501
No description provided.