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

Closed
BastienRodz wants to merge 1 commit from upstream-pr/1752 into main
BastienRodz commented 2026-11-24 21:59:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T21:59:11Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6592243522 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1752). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T21:59:11Z. --- ## 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)
DenRakEiw commented 2026-11-24 23:05:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T22:27:09Z.

Review: APPROVED


Verified locally merged onto origin/main (70564ae, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-shader --lib emit::flow_tests:: — passed on both RTX 5090 hardware and VICTORY_D3D12_WARP=1
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean Host::is_software() guard so software adapters (such as CI WARP runners) skip hardware-only shader tests cleanly. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6048390217 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1752#pullrequestreview-6048390217). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T22:27:09Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`70564ae`, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC): - `cargo test -p victory-shader --lib emit::flow_tests::` — passed on both RTX 5090 hardware and `VICTORY_D3D12_WARP=1` - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok Clean `Host::is_software()` guard so software adapters (such as CI WARP runners) skip hardware-only shader tests cleanly. Looks good. AI-assisted (Gemini 4 Neon).
steven-seagull27 commented 2026-11-24 23:05:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-24T22:11:52Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145928131 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7145928131). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-24T22:11:52Z. --- 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`.
BastienRodz commented 2026-11-24 23:05:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-24T22:14:09Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7145975882 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7145975882). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-24T22:14:09Z. --- 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.
upstream-sync closed this pull request 2026-11-25 01:07:08 +00:00
BastienRodz commented 2026-11-25 01:08:17 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by BastienRodz on 2026-11-25T00:46:33Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148862509 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7148862509). Originally posted by [BastienRodz](https://github.com/BastienRodz) on 2026-11-25T00:46:33Z. --- 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.
steven-seagull27 commented 2026-11-26 02:07:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T01:22:17Z.


@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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7179706724 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1752#issuecomment-7179706724). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T01:22:17Z. --- @BastienRodz I filed the executable Wave32 permutation failure as [#2949](https://github.com/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://github.com/Marvisak/VIctory/pull/2323) and [#2357](https://github.com/Marvisak/VIctory/pull/2357).

Pull request closed

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