Shader tests: a software adapter (a CI runner's) skips what only GPU hardware does #1752

Closed
github-bot wants to merge 1 commit from gh-pr/1752/head into gh-pr/1752/base
Owner

@⁠BastienRodz on GitHub · 2026-11-24 21:59 UTC · original
BastienRodz:shader-tests/software-adapter → main · +30 −4 · 4 files · 1 commits · closed without merging

What's wrong

CI on main (run 45492970391, windows-latest, no GPU) fails two tests in victory-shader:

  • emit::synthetic_tests::gathers_at_a_level_match_the_hardware:
    assertion `left == right` failed: hardware: lane 4 against its gather (left: [66.0, 67.0, 35.0, 34.0], right: [65.0, 66.0, 34.0, 33.0])
  • emit::synthetic_tests::permutes_read_the_lane_named_and_zero_from_lanes_left_out:
    no device ran the permute

On a runner without a GPU, Host::new(false) (D3D12CreateDevice(None, ...), adapter 0) gets the Microsoft Basic Render Driver (WARP behind the default adapter). The gather test skipped the hardware-rounding check only when the warp flag was true, so it ran the hardware-only check against WARP. The permute test skipped every device that refused the wave-32 pipeline and then failed assert!(ran > 0, "no device ran the permute") when both adapters were WARP.

What the fix does

  • Adds Host::is_software(&self) -> bool in crates/victory-shader/src/emit/host.rs, querying the device's adapter via GetAdapterLuid, IDXGIFactory4::EnumAdapterByLuid, and IDXGIAdapter1::GetDesc1, and reporting true when DXGI_ADAPTER_FLAG_SOFTWARE is set or VendorId == 0x1414 && DeviceId == 0x8c.
  • In gathers_at_a_level_match_the_hardware (synthetic_tests.rs), skips the "against its gather" rounding assertion when warp || host.is_software() instead of only warp.
  • In permutes_read_the_lane_named_and_zero_from_lanes_left_out (synthetic_tests.rs), prints no device ran the permute; skipped and returns when ran == 0, while keeping assert_eq!(out[0], want, "{label}") for any device that runs the pipeline.
  • Uses the same warp || host.is_software() check in flow_tests.rs and diff_tests.rs where fixed-wave-size pipeline creation errors are skipped on WARP.
  • Leaves translator code and all real-hardware assertions unchanged.

Tests

  • cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings: pass
  • cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings: pass
  • cargo xtask policy: pass
  • cargo xwin test -p victory-shader --target x86_64-pc-windows-msvc -- --test-threads=1 (Linux host under Wine, no SM 6.6 device): 147 passed; 62 failed; 2 ignored (vs 146 passed; 63 failed; 2 ignored on origin/main; permutes_read_the_lane_named_and_zero_from_lanes_left_out now skips and passes, while the remaining 62 failures require an SM 6.6 device).
  • On GitHub's windows-latest with the upstream CI's commands (clippy -D warnings with and without --all-features, then cargo test --workspace --locked): everything passes; victory-shader 209 passed, 0 failed, including both tests above: https://github.com/BastienRodz/VIctory/actions/runs/45496058662

Not tested: a GPU where Host::new(false) is real hardware. Behavior on a real hardware adapter is unchanged (host.is_software() is false, so every hardware assertion still runs).

No game data used. AI-assisted: implemented with Gemini 4 Neon, reviewed and verified with Claude Code.

Related: the same two failures show on the open PRs rebased onto 70564ae (#926, #928).

🤖 Generated with Claude Code

**@⁠BastienRodz** on GitHub · 2026-11-24 21:59 UTC · [original](https://github.com/Marvisak/VIctory/pull/1752) `BastienRodz:shader-tests/software-adapter` → `main` · +30 −4 · 4 files · 1 commits · closed without merging ## What's wrong CI on `main` ([run 45492970391](https://github.com/Marvisak/VIctory/actions/runs/45492970391), `windows-latest`, no GPU) fails two tests in `victory-shader`: - `emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: ``assertion `left == right` failed: hardware: lane 4 against its gather`` (`left: [66.0, 67.0, 35.0, 34.0]`, `right: [65.0, 66.0, 34.0, 33.0]`) - `emit::synthetic_tests::permutes_read_the_lane_named_and_zero_from_lanes_left_out`: `no device ran the permute` On a runner without a GPU, `Host::new(false)` (`D3D12CreateDevice(None, ...)`, adapter 0) gets the Microsoft Basic Render Driver (WARP behind the default adapter). The gather test skipped the hardware-rounding check only when the `warp` flag was `true`, so it ran the hardware-only check against WARP. The permute test skipped every device that refused the wave-32 pipeline and then failed `assert!(ran > 0, "no device ran the permute")` when both adapters were WARP. ## What the fix does - Adds `Host::is_software(&self) -> bool` in `crates/victory-shader/src/emit/host.rs`, querying the device's adapter via `GetAdapterLuid`, `IDXGIFactory4::EnumAdapterByLuid`, and `IDXGIAdapter1::GetDesc1`, and reporting `true` when `DXGI_ADAPTER_FLAG_SOFTWARE` is set or `VendorId == 0x1414 && DeviceId == 0x8c`. - In `gathers_at_a_level_match_the_hardware` (`synthetic_tests.rs`), skips the "against its gather" rounding assertion when `warp || host.is_software()` instead of only `warp`. - In `permutes_read_the_lane_named_and_zero_from_lanes_left_out` (`synthetic_tests.rs`), prints `no device ran the permute; skipped` and returns when `ran == 0`, while keeping `assert_eq!(out[0], want, "{label}")` for any device that runs the pipeline. - Uses the same `warp || host.is_software()` check in `flow_tests.rs` and `diff_tests.rs` where fixed-wave-size pipeline creation errors are skipped on WARP. - Leaves translator code and all real-hardware assertions unchanged. ## Tests - `cargo xwin clippy --workspace --all-targets --locked --target x86_64-pc-windows-msvc -- -D warnings`: pass - `cargo xwin clippy --workspace --all-targets --all-features --locked --target x86_64-pc-windows-msvc -- -D warnings`: pass - `cargo xtask policy`: pass - `cargo xwin test -p victory-shader --target x86_64-pc-windows-msvc -- --test-threads=1` (Linux host under Wine, no SM 6.6 device): `147 passed; 62 failed; 2 ignored` (vs `146 passed; 63 failed; 2 ignored` on `origin/main`; `permutes_read_the_lane_named_and_zero_from_lanes_left_out` now skips and passes, while the remaining 62 failures require an SM 6.6 device). - **On GitHub's `windows-latest`** with the upstream CI's commands (clippy `-D warnings` with and without `--all-features`, then `cargo test --workspace --locked`): everything passes; `victory-shader` 209 passed, 0 failed, including both tests above: https://github.com/BastienRodz/VIctory/actions/runs/45496058662 Not tested: a GPU where `Host::new(false)` is real hardware. Behavior on a real hardware adapter is unchanged (`host.is_software()` is `false`, so every hardware assertion still runs). No game data used. AI-assisted: implemented with Gemini 4 Neon, reviewed and verified with Claude Code. Related: the same two failures show on the open PRs rebased onto `70564ae` (#926, #928). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
On a GPU-less windows-latest CI runner, Host::new(false) gets the
Microsoft Basic Render Driver (WARP behind adapter 0), causing two
tests in victory-shader to fail on main:

- gathers_at_a_level_match_the_hardware only skipped the hardware
  gather-rounding check when the warp flag was true, so the "hardware"
  pass ran it against WARP and failed on lane 4.
- permutes_read_the_lane_named_and_zero_from_lanes_left_out skipped
  each device that refused the wave-32 pipeline and then failed
  assert!(ran > 0) when both adapters were WARP.

Add Host::is_software(&self) to inspect the device's adapter via
GetAdapterLuid, IDXGIFactory4::EnumAdapterByLuid, and GetDesc1
(DXGI_ADAPTER_FLAG_SOFTWARE or VendorId 0x1414 / DeviceId 0x8c). Skip
the gather-rounding check when warp || host.is_software(), and have the
permute test print a skip line and return when no device can run it.
Apply the same software-adapter check where flow_tests and diff_tests
skip fixed-wave-size pipeline rejections on WARP.

Co-Authored-By: Gemini 4 Neon <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:43:38 +00:00
github-bot closed this pull request 2026-11-26 04:43:38 +00:00
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-24 22:11 UTC · original

Tested 1bf4933 on Windows 11 build 26300.10075 with an RTX 5080 (driver 621.24), built-in Windows WARP, and app-local Microsoft WARP 1.0.22. The adapter check identified the RTX as hardware and both WARP drivers as software.

Adapter Gather results matching the expected values Wave32 permutation
RTX 5080 0/64 All 32 lanes matched
Built-in WARP 64/64 Skipped: the driver could not create the Wave32 pipeline
WARP 1.0.22 64/64 Ran; 7 of 32 lanes differed

The RTX gather failure predates this PR. The unmodified test failed on lane 0 on both the parent (70564ae) and the PR head (1bf4933): it returned [0, 1, 0, 0] and expected [0, 0, 0, 0]. I used temporary counters to get past the first assertion. The 64 comparisons above cover 32 lanes each for the plain and offset gathers. The separate hardware-only comparison against the native gather also ran on the RTX and differed on 3 of 16 lanes.

With WARP 1.0.22, the unmodified permutation test reproduced the failure. Lanes 5, 6, 12, 13, 18, 21, and 22 differed. For example, lane 5 returned 1022 and expected 1006. With built-in WARP forced for both adapter requests, the test runner reported two passes, but the permutation explicitly logged no device ran the permute; skipped.

**@⁠steven-seagull27** on GitHub · 2026-11-24 22:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7145928131) Tested `1bf4933` on Windows 11 build 26300.10075 with an RTX 5080 (driver 621.24), built-in Windows WARP, and app-local Microsoft WARP 1.0.22. The adapter check identified the RTX as hardware and both WARP drivers as software. | Adapter | Gather results matching the expected values | Wave32 permutation | |---|---:|---| | RTX 5080 | 0/64 | All 32 lanes matched | | Built-in WARP | 64/64 | Skipped: the driver could not create the Wave32 pipeline | | WARP 1.0.22 | 64/64 | Ran; **7 of 32 lanes differed** | **The RTX gather failure predates this PR.** The unmodified test failed on lane 0 on both the parent (`70564ae`) and the PR head (`1bf4933`): it returned `[0, 1, 0, 0]` and expected `[0, 0, 0, 0]`. I used temporary counters to get past the first assertion. The 64 comparisons above cover 32 lanes each for the plain and offset gathers. The separate hardware-only comparison against the native gather also ran on the RTX and differed on 3 of 16 lanes. With **WARP 1.0.22**, the unmodified permutation test reproduced the failure. Lanes 5, 6, 12, 13, 18, 21, and 22 differed. For example, lane 5 returned `1022` and expected `1006`. With **built-in WARP** forced for both adapter requests, the test runner reported two passes, but the permutation explicitly logged `no device ran the permute; skipped`.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-24 22:14 UTC · original

Thanks, that confirms the scope. The adapter check sorts the RTX as hardware and both WARPs as software. The CI runner's case, built-in WARP with no wave-32 pipeline, now skips the permute instead of failing. The other two results are failures this PR leaves exactly as they were, and they look worth an issue of their own each, since they come from main's new tests on real setups and not from the runner:

  • the RTX 5080 gather mismatch, which you saw on 70564ae too: lane 0 returns [0, 1, 0, 0] where [0, 0, 0, 0] is expected, and 3 of 16 lanes differ from the native gather;
  • WARP 1.0.22 running the wave-32 permute with 7 lanes wrong (lane 5 returns 1022 where 1006 is expected).

Would you file those with your numbers? You have the setups that reproduce them.

**@⁠BastienRodz** on GitHub · 2026-11-24 22:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7145975882) Thanks, that confirms the scope. The adapter check sorts the RTX as hardware and both WARPs as software. The CI runner's case, built-in WARP with no wave-32 pipeline, now skips the permute instead of failing. The other two results are failures this PR leaves exactly as they were, and they look worth an issue of their own each, since they come from `main`'s new tests on real setups and not from the runner: - the RTX 5080 gather mismatch, which you saw on `70564ae` too: lane 0 returns `[0, 1, 0, 0]` where `[0, 0, 0, 0]` is expected, and 3 of 16 lanes differ from the native gather; - WARP 1.0.22 running the wave-32 permute with 7 lanes wrong (lane 5 returns `1022` where `1006` is expected). Would you file those with your numbers? You have the setups that reproduce them.
Author
Owner

@⁠BastienRodz on GitHub · 2026-11-25 00:46 UTC · original

Superseded by 42363ab on main (the test host refuses a software default adapter, and the permute test skips when only WARP is there), which fixes the same two CI failures. Thanks to steven-seagull27 and DenRakEiw for testing this one.

**@⁠BastienRodz** on GitHub · 2026-11-25 00:46 UTC · [original](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7148862509) Superseded by `42363ab` on `main` (the test host refuses a software default adapter, and the permute test skips when only WARP is there), which fixes the same two CI failures. Thanks to steven-seagull27 and DenRakEiw for testing this one.
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-26 01:22 UTC · original

@⁠BastienRodz I filed the executable Wave32 permutation failure as #2949. On current main 63bcca43 the RTX 5080 matched 32/32 and WARP 1.0.22 matched 25/32. A native HLSL shader reproduced the exact same seven lanes, including lane 5 returning 1022 for an expected 1006. Built-in WARP skipped before dispatch.

The other requested follow-up, the NVIDIA gather mismatch, is already covered by the raw-view fixture changes in #2323 and #2357.

**@⁠steven-seagull27** on GitHub · 2026-11-26 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7179706724) @⁠BastienRodz I filed the executable Wave32 permutation failure as [#2949](https://git.gtahub.st/github/Marvisak--VIctory/issues/2949). On current main `63bcca43` the RTX 5080 matched 32/32 and WARP 1.0.22 matched 25/32. A native HLSL shader reproduced the exact same seven lanes, including lane 5 returning 1022 for an expected 1006. Built-in WARP skipped before dispatch. The other requested follow-up, the NVIDIA gather mismatch, is already covered by the raw-view fixture changes in [#2323](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2323) and [#2357](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2357).

Pull request closed

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!1752
No description provided.