Shader tests: VICTORY_ADAPTER picks the GPU the hardware checks run on #1889

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

@⁠alexdeliu on GitHub · 2026-11-25 00:10 UTC · original
alexdeliu:feat/test-adapter → main · +48 −0 · 2 files · 2 commits · open

Host::new always takes the default adapter. On a machine with two GPUs (common: an iGPU beside a graphics card, or a laptop's Intel and NVIDIA), the hardware checks in victory-shader's tests can only run on one of them, and testers post results for half their hardware.

With VICTORY_ADAPTER=<n>, Host::new uses DXGI's nth adapter (0 is the default). The first host of a run names the device on stderr. A wrong index says so once and the hardware checks skip, as they do on a machine without a device. When the variable is unset nothing changes. The README's test section gets two lines about it.

Tested on one machine with an AMD RX 9070 (RDNA4, adapter 0) and the Ryzen 7700's iGPU (gfx1036, RDNA2, adapter 1), on main @ 70564ae:

  • both CI clippy runs are clean;
  • cargo test -p victory-shader --locked --lib gives the same result on both adapters: 208 passed, plus the 2 PSV0 tests that fail on main with the Windows SDK's dxil.dll 1.7. Those fail without this change too;
  • VICTORY_ADAPTER=1 … -- --nocapture prints VICTORY_ADAPTER=1: AMD Radeon(TM) Graphics, and VICTORY_ADAPTER=7 prints no such adapter;
  • a new unit test, adapter_index_reads_a_number_or_nothing, covers parsing the variable.

This makes RDNA2 and RDNA4 runs of the same commit from one machine routine, for example for #1599 (AMD's i64 compares, which reproduce on both).

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠alexdeliu** on GitHub · 2026-11-25 00:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889) `alexdeliu:feat/test-adapter` → `main` · +48 −0 · 2 files · 2 commits · open `Host::new` always takes the default adapter. On a machine with two GPUs (common: an iGPU beside a graphics card, or a laptop's Intel and NVIDIA), the hardware checks in `victory-shader`'s tests can only run on one of them, and testers post results for half their hardware. With `VICTORY_ADAPTER=<n>`, `Host::new` uses DXGI's `n`th adapter (0 is the default). The first host of a run names the device on stderr. A wrong index says so once and the hardware checks skip, as they do on a machine without a device. When the variable is unset nothing changes. The README's test section gets two lines about it. **Tested** on one machine with an AMD RX 9070 (RDNA4, adapter 0) and the Ryzen 7700's iGPU (gfx1036, RDNA2, adapter 1), on `main` @ `70564ae`: - both CI clippy runs are clean; - `cargo test -p victory-shader --locked --lib` gives the same result on both adapters: 208 passed, plus the 2 PSV0 tests that fail on `main` with the Windows SDK's `dxil.dll` 1.7. Those fail without this change too; - `VICTORY_ADAPTER=1 … -- --nocapture` prints `VICTORY_ADAPTER=1: AMD Radeon(TM) Graphics`, and `VICTORY_ADAPTER=7` prints `no such adapter`; - a new unit test, `adapter_index_reads_a_number_or_nothing`, covers parsing the variable. This makes RDNA2 and RDNA4 runs of the same commit from one machine routine, for example for #1599 (AMD's i64 compares, which reproduce on both). AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Host::new always took the default adapter, so a machine with a second
GPU (an iGPU beside a graphics card, say) could not run the GPU checks
on it. VICTORY_ADAPTER=<n> picks DXGI's nth adapter; the first host of
a run names it on stderr, or says the index has no adapter, since the
tests then skip as they do without a device.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/victory-shader/src/emit/host.rs
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:44 +00:00
Author
Owner

@⁠aycow on GitHub · 2026-11-25 01:22 UTC · original

@⁠fiestorra Upstream CI at ccfb029 passed. I separately selected each adapter in a local selector-only overlay. Both hardware paths executed on AMD Radeon Graphics and RTX 5070 Laptop GPU. WARP still runs the gather oracle, and its fixed Wave32 pipeline is refused as expected.

Explicit NVIDIA selection exposed a separate reproducible issue on driver 581.91. gathers_at_a_level_match_the_hardware at synthetic_tests.rs:261 returns [0.0, 1.0, 0.0, 0.0] for lane 0 (NaN U) where the CPU oracle expects zeros. Two runs on ccfb029 and one on 42363ab with only the DXGI ordinal changed gave the same result. The NVIDIA permute test passes. The old Windows runner failure was at a different assertion and lane. Sharing here because explicit selection already has coverage in this PR.

The AMD iGPU reports 512 MiB dedicated. NVIDIA reports 7.62 GiB and WARP reports zero. A non-software adapter that reports zero dedicated memory would still be excluded by the default filter, and I did not have one to verify. No assertions were changed.

**@⁠aycow** on GitHub · 2026-11-25 01:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7149479775) @⁠fiestorra Upstream CI at `ccfb029` passed. I separately selected each adapter in a local selector-only overlay. Both hardware paths executed on AMD Radeon Graphics and RTX 5070 Laptop GPU. WARP still runs the gather oracle, and its fixed Wave32 pipeline is refused as expected. Explicit NVIDIA selection exposed a separate reproducible issue on driver 581.91. `gathers_at_a_level_match_the_hardware` at `synthetic_tests.rs:261` returns `[0.0, 1.0, 0.0, 0.0]` for lane 0 (NaN U) where the CPU oracle expects zeros. Two runs on `ccfb029` and one on `42363ab` with only the DXGI ordinal changed gave the same result. The NVIDIA permute test passes. The old Windows runner failure was at a different assertion and lane. Sharing here because explicit selection already has coverage in this PR. The AMD iGPU reports 512 MiB dedicated. NVIDIA reports 7.62 GiB and WARP reports zero. A non-software adapter that reports zero dedicated memory would still be excluded by the default filter, and I did not have one to verify. No assertions were changed.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:37 UTC · original · edited 2026-11-25 22:23 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/host.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7149769852) · edited 2026-11-25 22:23 UTC <!-- victory-triage v1 head=113f280a2b2710016d6ec912904d574ba8a010ad verdict=needs-rebase at=2026-11-25T22:26:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-shader/src/emit/host.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Headache3318 on GitHub · 2026-11-25 01:41 UTC · original

Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head 13afa69 applied cleanly onto current main ccfb029.

  • cargo test -p victory-shader --locked: 118 passed, 0 failed, 1 ignored. All tests pass, including the new adapter_index_reads_a_number_or_nothing test.
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 3 pre-existing errors in test code (fail identically on main ccfb029). The PR introduces no new clippy warnings.

Not tested: Windows MSVC build, the title itself. AI-assisted.

**@⁠Headache3318** on GitHub · 2026-11-25 01:41 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7149848438) Tested on Linux (Arch, kernel 7.3.5, 3× RTX 4090 driver 620.73.04), Rust 1.98.1 (pinned). PR head `13afa69` applied cleanly onto current `main` `ccfb029`. - `cargo test -p victory-shader --locked`: 118 passed, 0 failed, 1 ignored. All tests pass, including the new `adapter_index_reads_a_number_or_nothing` test. - `cargo clippy -p victory-shader --all-targets -- -D warnings`: 3 pre-existing errors in test code (fail identically on main `ccfb029`). The PR introduces no new clippy warnings. Not tested: Windows MSVC build, the title itself. AI-assisted.
Author
Owner

@⁠alexdeliu on GitHub · 2026-11-25 04:50 UTC · original

@⁠catminou4 merged main (940d32f) in as 113f280; no force-push. The conflict was with #1911/#1925's hardware_adapter in host.rs. Both behaviours are kept: with no VICTORY_ADAPTER, the first adapter that is not software and has dedicated memory is used, exactly as on main. VICTORY_ADAPTER=<n> takes DXGI's adapter n instead, and the first host of a run names it.

Rechecked on the RX 9070 + gfx1036 machine:

  • both CI clippy runs are clean;
  • cargo test -p victory-shader --locked --lib gives 246 passed both by default and with VICTORY_ADAPTER=1 (AMD Radeon(TM) Graphics), plus the 2 PSV0 tests main itself fails with the SDK's dxil.dll 1.7;
  • VICTORY_ADAPTER=7 prints no such adapter.
**@⁠alexdeliu** on GitHub · 2026-11-25 04:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7153210528) @⁠catminou4 merged `main` (`940d32f`) in as `113f280`; no force-push. The conflict was with #1911/#1925's `hardware_adapter` in `host.rs`. Both behaviours are kept: with no `VICTORY_ADAPTER`, the first adapter that is not software and has dedicated memory is used, exactly as on `main`. `VICTORY_ADAPTER=<n>` takes DXGI's adapter `n` instead, and the first host of a run names it. Rechecked on the RX 9070 + gfx1036 machine: - both CI clippy runs are clean; - `cargo test -p victory-shader --locked --lib` gives 246 passed both by default and with `VICTORY_ADAPTER=1` (`AMD Radeon(TM) Graphics`), plus the 2 PSV0 tests `main` itself fails with the SDK's `dxil.dll` 1.7; - `VICTORY_ADAPTER=7` prints `no such adapter`.
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 11:43 UTC · original

Offline measurement on a retail dump

Result: no count change against main.

I merged head 113f280a onto main 940d32f (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 23,918 on main, 23,918 with this PR.

No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 11:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7161414603) ### Offline measurement on a retail dump **Result: no count change against `main`.** I merged head 113f280a onto `main` 940d32f (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 23,918 on `main`, 23,918 with this PR. No program changes its failure reason. The count shows that the change rejects nothing on this data. It does not show whether the output is right. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
Author
Owner

@⁠KainanP on GitHub · 2026-11-25 12:43 UTC · original

Tested head 113f280 (identical to a merge onto main 940d32f) on a dual-GPU laptop. DXGI adapter 0 is an RTX 4060 Laptop (driver 610.47 / 32.0.16.1047), 1 is Intel UHD 8086:a78b (31.0.101.5445), 2 is Microsoft Basic Render Driver. Windows 11 26200, Rust 1.98.1 MSVC, no game data. Ran cargo test -p victory-shader --lib --locked --no-fail-fast -- --nocapture once per setting.

setting adapter named passed / failed / ignored
unset (none; hardware_adapter = RTX 4060) 245 / 3 / 3
VICTORY_ADAPTER=0 VICTORY_ADAPTER=0: NVIDIA GeForce RTX 4060 Laptop GPU 245 / 3 / 3
VICTORY_ADAPTER=1 VICTORY_ADAPTER=1: Intel(R) UHD Graphics 240 / 8 / 3
VICTORY_ADAPTER=2 VICTORY_ADAPTER=2: Microsoft Basic Render Driver 246 / 2 / 3
VICTORY_ADAPTER=7 VICTORY_ADAPTER=7: no such adapter (...) 248 / 0 / 3
VICTORY_ADAPTER=Intel none (not an adapter index) 173 / 75 / 3
VICTORY_WARP=1 none 246 / 2 / 3
VICTORY_WARP=1 VICTORY_ADAPTER=1 none (WARP wins) 246 / 2 / 3
VICTORY_WARP=1 VICTORY_ADAPTER=Intel none 173 / 75 / 3

The switch works. With =1, the Intel UHD result matches what main 940d32f gave earlier on this same iGPU with a local adapter hook: 239 / 8 / 3, plus this PR's own test = 240 / 8 / 3. The 8 failures are the iGPU's: bvh_tests ×3, arithmetic_matches_the_hardware, the stride_tests no-view read, permutes_read_the_lane_named_and_zero_from_lanes_left_out, image_atomics_of_64_bits, fspx_programs_run_with_the_hardwares_dot_products. Unset and =0 give the same 3 NVIDIA failures as main (stride_tests ×2, gathers_at_a_level_match_the_hardware). VICTORY_WARP=1 takes precedence over the index, as documented.

Things worth knowing:

  1. An out-of-range index turns the whole hardware suite green. With =7, every hardware check skips and the run reports 248 passed / 0 failed. The one no such adapter line is the only sign, and plain cargo test captures it unless a test fails. A typo looks like a clean run. Suggestion: fail with an error instead of skipping when VICTORY_ADAPTER is set but unusable.
  2. A non-numeric value also kills WARP. adapter_index is parsed before the warp branch, so Host::new(true) returns the same error. With =Intel (or =igpu), no device opens at all, so the 75 tests that need at least one device panic (e.g. check()'s no SM 6.6 device assert), even with VICTORY_WARP=1. Parsing the index only on the non-WARP path would keep WARP working.
  3. An explicit index reaches WARP (=2 here) and runs the hardware-only checks on it. That yields the 2 WARP failures hardware_adapter exists to avoid (the Wave32 permute, gathers). This is acceptable for an opt-in setting, as the triage says.

Relation to #2367. No conflict: git merge-tree is clean for this PR onto main, #2367 onto main, and the two together. They touch different files (victory-shader/src/emit/host.rs vs victory-gpu/src/host.rs), so they are complementary (test host vs title host), not duplicates. But they claim the same variable with different grammars. #2367 documents VICTORY_ADAPTER=igpu|dgpu|<index>|<name substring> in the README's switch table. Here only an index is accepted, and anything else fails 75 tests (item 2). A user who follows #2367's README and then runs cargo test --workspace hits that. Sharing one parser would fix it (victory-gpu already depends on victory-shader with host), or this PR could accept the same spellings. At minimum, the indices agree: both use EnumAdapters1 order.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

**@⁠KainanP** on GitHub · 2026-11-25 12:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7162771783) Tested head `113f280` (identical to a merge onto `main` `940d32f`) on a dual-GPU laptop. DXGI adapter 0 is an RTX 4060 Laptop (driver 610.47 / 32.0.16.1047), 1 is Intel UHD 8086:a78b (31.0.101.5445), 2 is Microsoft Basic Render Driver. Windows 11 26200, Rust 1.98.1 MSVC, no game data. Ran `cargo test -p victory-shader --lib --locked --no-fail-fast -- --nocapture` once per setting. | setting | adapter named | passed / failed / ignored | |---|---|---| | unset | (none; `hardware_adapter` = RTX 4060) | 245 / 3 / 3 | | `VICTORY_ADAPTER=0` | `VICTORY_ADAPTER=0: NVIDIA GeForce RTX 4060 Laptop GPU` | 245 / 3 / 3 | | `VICTORY_ADAPTER=1` | `VICTORY_ADAPTER=1: Intel(R) UHD Graphics` | **240 / 8 / 3** | | `VICTORY_ADAPTER=2` | `VICTORY_ADAPTER=2: Microsoft Basic Render Driver` | 246 / 2 / 3 | | `VICTORY_ADAPTER=7` | `VICTORY_ADAPTER=7: no such adapter (...)` | 248 / 0 / 3 | | `VICTORY_ADAPTER=Intel` | none (`not an adapter index`) | 173 / 75 / 3 | | `VICTORY_WARP=1` | none | 246 / 2 / 3 | | `VICTORY_WARP=1 VICTORY_ADAPTER=1` | none (WARP wins) | 246 / 2 / 3 | | `VICTORY_WARP=1 VICTORY_ADAPTER=Intel` | none | 173 / 75 / 3 | **The switch works.** With `=1`, the Intel UHD result matches what `main` `940d32f` gave earlier on this same iGPU with a local adapter hook: 239 / 8 / 3, plus this PR's own test = 240 / 8 / 3. The 8 failures are the iGPU's: `bvh_tests` ×3, `arithmetic_matches_the_hardware`, the `stride_tests` no-view read, `permutes_read_the_lane_named_and_zero_from_lanes_left_out`, `image_atomics_of_64_bits`, `fspx_programs_run_with_the_hardwares_dot_products`. Unset and `=0` give the same 3 NVIDIA failures as `main` (`stride_tests` ×2, `gathers_at_a_level_match_the_hardware`). `VICTORY_WARP=1` takes precedence over the index, as documented. Things worth knowing: 1. **An out-of-range index turns the whole hardware suite green.** With `=7`, every hardware check skips and the run reports 248 passed / 0 failed. The one `no such adapter` line is the only sign, and plain `cargo test` captures it unless a test fails. A typo looks like a clean run. Suggestion: fail with an error instead of skipping when `VICTORY_ADAPTER` is set but unusable. 2. **A non-numeric value also kills WARP.** `adapter_index` is parsed before the `warp` branch, so `Host::new(true)` returns the same error. With `=Intel` (or `=igpu`), no device opens at all, so the 75 tests that need at least one device panic (e.g. `check()`'s `no SM 6.6 device` assert), even with `VICTORY_WARP=1`. Parsing the index only on the non-WARP path would keep WARP working. 3. An explicit index reaches WARP (`=2` here) and runs the hardware-only checks on it. That yields the 2 WARP failures `hardware_adapter` exists to avoid (the Wave32 permute, gathers). This is acceptable for an opt-in setting, as the triage says. **Relation to #2367.** No conflict: `git merge-tree` is clean for this PR onto `main`, #2367 onto `main`, and the two together. They touch different files (`victory-shader/src/emit/host.rs` vs `victory-gpu/src/host.rs`), so they are complementary (test host vs title host), not duplicates. But they claim the **same variable with different grammars**. #2367 documents `VICTORY_ADAPTER=igpu|dgpu|<index>|<name substring>` in the README's switch table. Here only an index is accepted, and anything else fails 75 tests (item 2). A user who follows #2367's README and then runs `cargo test --workspace` hits that. Sharing one parser would fix it (`victory-gpu` already depends on `victory-shader` with `host`), or this PR could accept the same spellings. At minimum, the indices agree: both use `EnumAdapters1` order. _AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this._
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/host.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1889/head:github-bot/gh-1889'
git switch 'github-bot/gh-1889'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1889'
git switch 'github-bot/gh-1889'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1889'
git switch 'github-bot/gh-1889'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1889'
git switch 'main'
git merge --squash 'github-bot/gh-1889'
git switch 'main'
git merge --ff-only 'github-bot/gh-1889'
git switch 'main'
git merge 'github-bot/gh-1889'
git push origin 'main'
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!1889
No description provided.