Add a minimal WaveReadLaneAt shuffle check at native and forced widths #150

Merged
rasptum merged 1 commit from upstream-pr/151 into main 2026-11-21 17:46:29 +00:00
rasptum commented 2026-11-21 17:33:06 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by rasptum on 2026-11-21T17:33:06Z.


Change

Adds wave_shuffle_warp and wave_shuffle_hardware, the minimal source-built shuffle requested in #145. It isolates the WaveReadLaneAt(v, (lane*7+3) % width) read from the wave64 BVH fixture.

  • tests/wave_shuffle.hlsl has one 64-thread group. Each thread stores its native lane, WaveGetLaneCount(), WaveReadLaneFirst(t) as a wave id, and the group thread returned by the shuffle, a self-inverse mirror (width-1-lane) and a broadcast (3 % width).
  • tests/wave_shuffle.cpp maps (wave, lane) to threads and classifies each shuffle result as correct, the exact inverse permutation, or other. It checks both controls and prints inverse_distinct: at width 8, 7n+3 ≡ 3-n is self-inverse, so a reversal cannot be seen there.
  • The variants are native (cs_6_5) and forced 16, 32 and 64 ([WaveSize], cs_6_6). Forced widths run only inside the adapter's lane range with SM 6.6. Any wrong lane fails the test. It skips when no forced width can run.
  • The native variant is cs_6_5, not 6.0, because the Windows 10 in-box WARP removes the device for a non-literal lane index (details in #145). bvh_reads_waves makes the same choice.

Verification

Windows 10 22H2 (19045.6466), VS Build Tools 17.14, SDK 10.0.26100, on 245b207.

Build Adapter Result
Default RTX 3060 (SM 6.5 in-box) Skipped: native width 32 64/64 correct, forced widths need SM 6.6
Default In-box WARP 10.0.19041 (SM 6.2) Skipped
Agility 1.620.2 (+ #147 locally) RTX 3060 Passed: native 32 and forced 32, 64/64 correct each
Agility + WARP 1.0.22 (#147 locally) WARP Failed as intended: native 8 64/64 correct (inverse_distinct=no), forced 16, 32 and 64 each 64/64 inverse. Controls had 0 errors.

Default full suite: 84 of 86 passed or skipped. The 2 failures are reference_triangle_* because my local sample checkout has CRLF shaders, which is a separate fix. All other results match main.

Evidence and follow-up

No external inputs, and the shader is original to this repository. If the CI runner's WARP supports a forced width, this test runs there and shows whether that WARP version has the same inversion. I have not seen the runner's lane range. Whether to report this to Microsoft, and whether bvh_wave64_warp should treat it as a known WARP result, stays open in #145.

AI-assisted (Claude Code); built and run locally on the configurations above.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6532151878 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/151). Originally posted by [rasptum](https://github.com/rasptum) on 2026-11-21T17:33:06Z. --- ## Change Adds `wave_shuffle_warp` and `wave_shuffle_hardware`, the minimal source-built shuffle requested in #145. It isolates the `WaveReadLaneAt(v, (lane*7+3) % width)` read from the wave64 BVH fixture. - `tests/wave_shuffle.hlsl` has one 64-thread group. Each thread stores its native lane, `WaveGetLaneCount()`, `WaveReadLaneFirst(t)` as a wave id, and the group thread returned by the shuffle, a self-inverse mirror (`width-1-lane`) and a broadcast (`3 % width`). - `tests/wave_shuffle.cpp` maps (wave, lane) to threads and classifies each shuffle result as correct, the exact inverse permutation, or other. It checks both controls and prints `inverse_distinct`: at width 8, `7n+3 ≡ 3-n` is self-inverse, so a reversal cannot be seen there. - The variants are native (`cs_6_5`) and forced 16, 32 and 64 (`[WaveSize]`, `cs_6_6`). Forced widths run only inside the adapter's lane range with SM 6.6. Any wrong lane fails the test. It skips when no forced width can run. - The native variant is `cs_6_5`, not 6.0, because the Windows 10 in-box WARP removes the device for a non-literal lane index (details in #145). `bvh_reads_waves` makes the same choice. ## Verification Windows 10 22H2 (19045.6466), VS Build Tools 17.14, SDK 10.0.26100, on `245b207`. | Build | Adapter | Result | |---|---|---| | Default | RTX 3060 (SM 6.5 in-box) | Skipped: native width 32 64/64 correct, forced widths need SM 6.6 | | Default | In-box WARP 10.0.19041 (SM 6.2) | Skipped | | Agility 1.620.2 (+ #147 locally) | RTX 3060 | Passed: native 32 and forced 32, 64/64 correct each | | Agility + WARP 1.0.22 (#147 locally) | WARP | Failed as intended: native 8 64/64 correct (`inverse_distinct=no`), forced 16, 32 and 64 each 64/64 inverse. Controls had 0 errors. | Default full suite: 84 of 86 passed or skipped. The 2 failures are `reference_triangle_*` because my local sample checkout has CRLF shaders, which is a separate fix. All other results match `main`. ## Evidence and follow-up No external inputs, and the shader is original to this repository. If the CI runner's WARP supports a forced width, this test runs there and shows whether that WARP version has the same inversion. I have not seen the runner's lane range. Whether to report this to Microsoft, and whether `bvh_wave64_warp` should treat it as a known WARP result, stays open in #145. _AI-assisted (Claude Code); built and run locally on the configurations above._
upstream-sync closed this pull request 2026-11-24 06:41:34 +00:00
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
R0Y00/Xbox2Windows!150
No description provided.