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

Open
alexdeliu wants to merge 2 commits from upstream-pr/1889 into main
alexdeliu commented 2026-11-25 00:10:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexdeliu on 2026-11-25T00:10:27Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:issue:6594076958 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889). Originally posted by [alexdeliu](https://github.com/alexdeliu) on 2026-11-25T00:10:27Z. --- `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)
aycow commented 2026-11-25 02:05:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by aycow on 2026-11-25T01:22:29Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149479775 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7149479775). Originally posted by [aycow](https://github.com/aycow) on 2026-11-25T01:22:29Z. --- @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.
Marvisak commented 2026-11-25 02:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:37:46Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149769852 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7149769852). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:37:46Z. --- <!-- 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)_
Headache3318 commented 2026-11-25 02:06:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Headache3318 on 2026-11-25T01:41:45Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149848438 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7149848438). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-25T01:41:45Z. --- 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.
catminou4 commented 2026-11-25 03:02:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T02:17:15Z.

Review: COMMENTED


Merge conflict with current main (940d32f69b) — test-infra PR (VICTORY_ADAPTER GPU selection for hardware checks) needs a rebase. Will re-test after.

<!-- greyfinch-sync:Marvisak/VIctory:review:6050698633 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#pullrequestreview-6050698633). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T02:17:15Z. **Review:** COMMENTED --- Merge conflict with current main (940d32f69b) — test-infra PR (VICTORY_ADAPTER GPU selection for hardware checks) needs a rebase. Will re-test after.
alexdeliu commented 2026-11-25 05:06:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexdeliu on 2026-11-25T04:50:22Z.


@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.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7153210528 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7153210528). Originally posted by [alexdeliu](https://github.com/alexdeliu) on 2026-11-25T04:50:22Z. --- @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`.
sinan-cmyk commented 2026-11-25 12:03:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by sinan-cmyk on 2026-11-25T11:43:24Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7161414603 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7161414603). Originally posted by [sinan-cmyk](https://github.com/sinan-cmyk) on 2026-11-25T11:43:24Z. --- ### 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).
KainanP commented 2026-11-25 13:02:54 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T12:43:40Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7162771783 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1889#issuecomment-7162771783). Originally posted by [KainanP](https://github.com/KainanP) on 2026-11-25T12:43:40Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1889:upstream-pr/1889'
git switch 'upstream-pr/1889'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1889'
git switch 'upstream-pr/1889'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1889'
git switch 'upstream-pr/1889'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1889'
git switch 'main'
git merge --squash 'upstream-pr/1889'
git switch 'main'
git merge --ff-only 'upstream-pr/1889'
git switch 'main'
git merge 'upstream-pr/1889'
git push origin 'main'
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!1887
No description provided.