Shaders: lane masks read through a join need the console's wave size; tests skip devices without 32-lane waves (#356) #377

Open
github-bot wants to merge 2 commits from github-bot/gh-377 into main AGit
Owner

@⁠RenzoWit35 on GitHub · 2026-11-25 00:09 UTC · original
RenzoWit35:fix/356-host-wave-size → main · +129 −22 · 5 files · 2 commits · open

Addresses two of the three causes behind the six failures in #356. Those failures come from a host whose waves are not 32 lanes wide; the reported numbers point to 16-lane waves.

What changed

1. A lane mask that reaches data through a join now requires the console's wave size (d0602c7)

reads_mask_as_data only counted a value as a mask when that value itself was a known mask. In a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is, s20 holds vcc_lo on one path and 5 on the other. After the join it is a phi, which the check did not count, so the program declared no WaveSize. On a 32-lane host that goes unnoticed. On a 16-lane host the ballot covers 16 lanes, which is the 65535 vs 4294967295 in the report.

The new mask_values (in emit/lower.rs) adds every phi that has a mask among its incoming values, directly or through other phis. reads_mask_as_data takes that set, computed once per program, in both the lowering and own_bits. Instructions whose result is a mask still don't count as data reads.

New GPU-free test: the program above must lower with wave_size == Some(32). It fails with the old check.

2. Shader tests skip, rather than fail, a WaveSize(32) program on a device without 32-lane waves (23b63af)

Host::wave_lanes() reads WaveLaneCountMin/Max (D3D12 OPTIONS1), and Host::runs_waves_of(n) checks n against that range. run_cases_on now skips a refused pipeline only when the device cannot run 32-lane waves; on any other device a refused pipeline still panics. This covers ds_min_max_f32_order_floats_and_return_the_old_value ("compute_pipeline failed: The parameter is incorrect" in #356). on_the_card in wave64_tests already skipped refused pipelines.

New test devices_report_their_wave_sizes checks that each device reports a power-of-two range.

Testing

  • cargo test --workspace passes on an RTX 4070 Ti (32–32 lanes), and cargo clippy --workspace --all-targets is clean.
  • WARP reports 4–4 lanes and refuses WaveSize(32) with the same error as in #356. With WARP added temporarily to the ds_min_max order test, the WARP run is now skipped with a message instead of failing.
  • Not run on a 16-lane host: I don't have one.

For reviewers

  • Not measured on title shaders. More programs may now declare WaveSize(32). On NVIDIA (host_max_wave() == 32), some console wave64 programs may move to the exchange path or keep 64-lane waves and be refused. A victory translate run on the title's shaders before and after this branch would show the change; I had no game files configured to run it.
  • Not addressed: the four *_node_test_* failures in #356. They return bvh::MISS for a ray that hits a triangle exactly at a vertex (direction [0, 2, 5]), where two edge cross-products are exactly 0. Contracting p*q - r*s into an FMA would flip that hit to a miss, but our DXIL carries no fast-math flags, so this needs the reporter's GPU and driver to confirm.

🤖 Generated with Claude Code

**@⁠RenzoWit35** on GitHub · 2026-11-25 00:09 UTC · [original](https://github.com/fxceless/victory-fork/pull/377) `RenzoWit35:fix/356-host-wave-size` → `main` · +129 −22 · 5 files · 2 commits · open Addresses two of the three causes behind the six failures in #356. Those failures come from a host whose waves are not 32 lanes wide; the reported numbers point to 16-lane waves. ## What changed **1. A lane mask that reaches data through a join now requires the console's wave size** (`d0602c7`) `reads_mask_as_data` only counted a value as a mask when that value itself was a known mask. In `a_lane_mask_joined_with_a_number_is_read_as_the_number_it_is`, `s20` holds `vcc_lo` on one path and `5` on the other. After the join it is a phi, which the check did not count, so the program declared no `WaveSize`. On a 32-lane host that goes unnoticed. On a 16-lane host the ballot covers 16 lanes, which is the `65535` vs `4294967295` in the report. The new `mask_values` (in `emit/lower.rs`) adds every phi that has a mask among its incoming values, directly or through other phis. `reads_mask_as_data` takes that set, computed once per program, in both the lowering and `own_bits`. Instructions whose result is a mask still don't count as data reads. New GPU-free test: the program above must lower with `wave_size == Some(32)`. It fails with the old check. **2. Shader tests skip, rather than fail, a `WaveSize(32)` program on a device without 32-lane waves** (`23b63af`) `Host::wave_lanes()` reads `WaveLaneCountMin`/`Max` (D3D12 OPTIONS1), and `Host::runs_waves_of(n)` checks n against that range. `run_cases_on` now skips a refused pipeline only when the device cannot run 32-lane waves; on any other device a refused pipeline still panics. This covers `ds_min_max_f32_order_floats_and_return_the_old_value` ("compute_pipeline failed: The parameter is incorrect" in #356). `on_the_card` in `wave64_tests` already skipped refused pipelines. New test `devices_report_their_wave_sizes` checks that each device reports a power-of-two range. ## Testing - `cargo test --workspace` passes on an RTX 4070 Ti (32–32 lanes), and `cargo clippy --workspace --all-targets` is clean. - WARP reports 4–4 lanes and refuses `WaveSize(32)` with the same error as in #356. With WARP added temporarily to the `ds_min_max` order test, the WARP run is now skipped with a message instead of failing. - Not run on a 16-lane host: I don't have one. ## For reviewers - **Not measured on title shaders.** More programs may now declare `WaveSize(32)`. On NVIDIA (`host_max_wave() == 32`), some console wave64 programs may move to the exchange path or keep 64-lane waves and be refused. A `victory translate` run on the title's shaders before and after this branch would show the change; I had no game files configured to run it. - **Not addressed:** the four `*_node_test_*` failures in #356. They return `bvh::MISS` for a ray that hits a triangle exactly at a vertex (direction `[0, 2, 5]`), where two edge cross-products are exactly 0. Contracting `p*q - r*s` into an FMA would flip that hit to a miss, but our DXIL carries no fast-math flags, so this needs the reporter's GPU and driver to confirm. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:42:01 +00:00
Author
Owner

@⁠HAL9000RELOADED on GitHub · 2026-11-25 19:29 UTC · original

RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main d510ee4: both new tests pass on the card with this PR. No other test changed. Run table: #129 (#129).

**@⁠HAL9000RELOADED** on GitHub · 2026-11-25 19:29 UTC · [original](https://github.com/fxceless/victory-fork/pull/377#issuecomment-7172379680) RX 7900 XTX (RDNA3), Windows 10 + #402 for SM 6.6, main `d510ee4`: both new tests pass on the card with this PR. No other test changed. Run table: #129 (https://git.gtahub.st/github/fxceless--victory-fork/pulls/129).
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/377/head:github-bot/gh-377'
git switch 'github-bot/gh-377'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-377'
git switch 'github-bot/gh-377'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-377'
git switch 'github-bot/gh-377'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-377'
git switch 'main'
git merge --squash 'github-bot/gh-377'
git switch 'main'
git merge --ff-only 'github-bot/gh-377'
git switch 'main'
git merge 'github-bot/gh-377'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.