GPU: log the host GPU, and warn when it is not the one to run on #2053

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

@⁠rminzao on GitHub · 2026-11-25 04:10 UTC · original
rminzao:gpu-log-host-adapter → main · +250 −0 · 3 files · 2 commits · open

Claimed in #1633 (claim).

Problem

host::create makes the device with D3D12CreateDevice(None, …), i.e. DXGI's default adapter. On a laptop with an integrated and a discrete GPU that is usually the integrated one, unless the user set the program to "High performance" in Windows. Nothing in the log says which GPU the run was on, so a report from such a laptop silently describes the iGPU.

It matters more on an Intel iGPU: the Intel UHD here runs waves of 16 lanes only (WaveLaneCountMin/Max 16/16, as in #1829). Translated compute programs that depend on lane layout declare the console's WaveSize(32)/(64) (emit module docs), so they get no pipeline there, and the log only shows the refused pipelines.

Change

A new adapter module, called once next to tdr::log() when the device is made (not on the WARP path):

  • info line host GPU: adapter name, vendor id, user-mode driver version, dedicated memory and wave lane range.
  • warn when DXGI's high-performance adapter (EnumAdapterByGpuPreference, software adapters ignored) is another GPU than the device's, naming both and where to change it in Windows.
  • warn when the device runs waves of at most N < 32 lanes.

Logging only. It selects nothing, so it doesn't overlap the adapter selection in #967, #1483 or the selector split out of #1630, and works with whichever lands. With a selector, the first warning simply stops firing.

Tested

Intel UHD Graphics (driver 31.0.101.4146, the default adapter) + RTX 4050 Laptop (595.97), Windows 11.

  • adapter::tests: the warning rules (other GPU preferred, same GPU, only software preferred, 16 vs 32-64 lanes) and a hardware test on the default device. On this laptop the hardware test prints:
    device on Adapter { name: "Intel(R) UHD Graphics", vendor: 32902, driver: Some("31.0.101.4146"), dedicated_mib: 128, .. }
    high-performance Some(Adapter { name: "NVIDIA GeForce RTX 4050 Laptop GPU", vendor: 4318, driver: Some("32.0.15.9597"), dedicated_mib: 5920, .. })
    warning: the host device is on Intel(R) UHD Graphics, but NVIDIA GeForce RTX 4050 Laptop GPU is this PC's high-performance GPU; set this program to "High performance" in Windows' graphics settings (Settings > System > Display > Graphics) to run on it
    
    With the test's device made on the RTX 4050 instead (local, uncommitted), both lines name the RTX 4050 and nothing is warned.
  • cargo test -p victory-gpu --lib: 143 passed, 3 failed. The 3 fail the same way on main 940d32f here (the two view-heap cap tests and a_texture_written_in_one_format_reads_in_another_through_a_placed_view).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings, with and without --all-features: clean. rustfmt --check on the new file: clean. cargo xtask policy: ok.

Not run: the title, and the runtime's log with a subscriber (the lines go through tracing like tdr::log).

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠rminzao** on GitHub · 2026-11-25 04:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053) `rminzao:gpu-log-host-adapter` → `main` · +250 −0 · 3 files · 2 commits · open Claimed in #1633 ([claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633)). ## Problem `host::create` makes the device with `D3D12CreateDevice(None, …)`, i.e. DXGI's default adapter. On a laptop with an integrated and a discrete GPU that is usually the integrated one, unless the user set the program to "High performance" in Windows. Nothing in the log says which GPU the run was on, so a report from such a laptop silently describes the iGPU. It matters more on an Intel iGPU: the Intel UHD here runs waves of 16 lanes only (`WaveLaneCountMin/Max` 16/16, as in #1829). Translated compute programs that depend on lane layout declare the console's `WaveSize(32)`/`(64)` (`emit` module docs), so they get no pipeline there, and the log only shows the refused pipelines. ## Change A new `adapter` module, called once next to `tdr::log()` when the device is made (not on the WARP path): - `info` line `host GPU`: adapter name, vendor id, user-mode driver version, dedicated memory and wave lane range. - `warn` when DXGI's high-performance adapter (`EnumAdapterByGpuPreference`, software adapters ignored) is another GPU than the device's, naming both and where to change it in Windows. - `warn` when the device runs waves of at most N < 32 lanes. Logging only. It selects nothing, so it doesn't overlap the adapter selection in #967, #1483 or the selector split out of #1630, and works with whichever lands. With a selector, the first warning simply stops firing. ## Tested Intel UHD Graphics (driver 31.0.101.4146, the default adapter) + RTX 4050 Laptop (595.97), Windows 11. - `adapter::tests`: the warning rules (other GPU preferred, same GPU, only software preferred, 16 vs 32-64 lanes) and a hardware test on the default device. On this laptop the hardware test prints: ``` device on Adapter { name: "Intel(R) UHD Graphics", vendor: 32902, driver: Some("31.0.101.4146"), dedicated_mib: 128, .. } high-performance Some(Adapter { name: "NVIDIA GeForce RTX 4050 Laptop GPU", vendor: 4318, driver: Some("32.0.15.9597"), dedicated_mib: 5920, .. }) warning: the host device is on Intel(R) UHD Graphics, but NVIDIA GeForce RTX 4050 Laptop GPU is this PC's high-performance GPU; set this program to "High performance" in Windows' graphics settings (Settings > System > Display > Graphics) to run on it ``` With the test's device made on the RTX 4050 instead (local, uncommitted), both lines name the RTX 4050 and nothing is warned. - `cargo test -p victory-gpu --lib`: 143 passed, 3 failed. The 3 fail the same way on `main` 940d32f here (the two view-heap cap tests and `a_texture_written_in_one_format_reads_in_another_through_a_placed_view`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`, with and without `--all-features`: clean. `rustfmt --check` on the new file: clean. `cargo xtask policy`: ok. Not run: the title, and the runtime's log with a subscriber (the lines go through `tracing` like `tdr::log`). AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The host device takes DXGI's default adapter, which on a laptop with an
integrated and a discrete GPU is usually the integrated one, and nothing
in the log said which GPU ran. Log its name, vendor, driver, dedicated
memory and wave lane range once, and warn when DXGI's high-performance
adapter is another GPU (with where to change it in Windows) or when the
device runs waves of fewer than 32 lanes, where compute programs that need
the console's wave size get no pipeline.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The host GPU warning covered only devices below 32 lanes. A device that
runs only 32 or only 64 lanes also refuses the compute programs pinned
to the other size, and a device without wave operations gets a warning
of its own. Adds the missing SAFETY comment in `describe`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:05 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-25 04:12 UTC · original

Triage verdict — Keep the diagnostics, reconcile with adapter selection (8e0fcbf)

Evidence

  • @⁠rminzao looks up the adapter by the LUID of the device that actually initialized. That is useful on its own and preserves the current device choice. #967 probes and selects adapters and adds the same adapter.rs module, so the two PRs share an integration point. Preserve the actual-device log if the selector lands first. Device lookup · #967 patch
  • The wave warning only triggers below a maximum of 32. A 32-only adapter can still reject a shader pinned to wave64, and a successful query with WaveOps false deserves different wording from an adapter that supports a narrow wave. Warning rules · D3D12 wave-size validation

Checks and limits

  • Compared the logging and selection paths against main and #967. The hybrid-adapter run is author-reported. I did not run adapter tests in this pass.

Next step

  • Keep the actual-device log. When integrating a selector, distinguish a hardware preference from an adapter explicitly chosen by policy. Add warning controls for 32-only, 64-only, and unavailable wave operations, or label the current warning as the narrower case where neither console width can run.

This verification was AI-assisted.

**@⁠jeremygold02** on GitHub · 2026-11-25 04:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053#issuecomment-7152637046) **Triage verdict — Keep the diagnostics, reconcile with adapter selection** (`8e0fcbf`) **Evidence** - @⁠rminzao looks up the adapter by the LUID of the device that actually initialized. That is useful on its own and preserves the current device choice. #967 probes and selects adapters and adds the same `adapter.rs` module, so the two PRs share an integration point. Preserve the actual-device log if the selector lands first. [Device lookup](https://github.com/Marvisak/VIctory/blob/8e0fcbf0587482f8618f4f21b3fb488f131e3f49/crates/victory-gpu/src/adapter.rs#L25-L56) · [#967 patch](https://git.gtahub.st/github/Marvisak--VIctory/pulls/967/files) - The wave warning only triggers below a maximum of 32. A 32-only adapter can still reject a shader pinned to wave64, and a successful query with `WaveOps` false deserves different wording from an adapter that supports a narrow wave. [Warning rules](https://github.com/Marvisak/VIctory/blob/8e0fcbf0587482f8618f4f21b3fb488f131e3f49/crates/victory-gpu/src/adapter.rs#L66-L85) · [D3D12 wave-size validation](https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html) **Checks and limits** - Compared the logging and selection paths against `main` and #967. The hybrid-adapter run is author-reported. I did not run adapter tests in this pass. **Next step** - Keep the actual-device log. When integrating a selector, distinguish a hardware preference from an adapter explicitly chosen by policy. Add warning controls for 32-only, 64-only, and unavailable wave operations, or label the current warning as the narrower case where neither console width can run. This verification was AI-assisted.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:22 UTC · original · edited 2026-11-26 02:15 UTC

Automated triage for the maintainers.

Merge candidate. Both points from the last triage are addressed. bd233b3 adds the // SAFETY: comment on the CheckInterfaceSupport block in adapter::describe, and CI (check) now passes on this head. adapter::warnings now warns separately for each console wave size, 32 or 64, that falls outside the device's WaveLaneCountMin..=Max, and for a device without WaveOps. The unit tests cover 16-16, 32-32, 64-64 and no-ops. The change only logs: adapter::log runs once after D3D12CreateDevice in host::create (not on the WARP path) and selects nothing. It still merges cleanly. #967, which also adds adapter.rs, does not merge cleanly at the moment.

On your reply: thanks, that matches what is on bd233b3 (the // SAFETY: comments in log/describe and the per-size wave warnings). Nothing further from triage; verdict unchanged.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053#issuecomment-7158246396) · edited 2026-11-26 02:15 UTC <!-- victory-triage v1 head=bd233b3ac16db13f9962638d9c5be86df74212c3 verdict=merge-candidate at=2026-11-26T02:16:00Z --> Automated triage for the maintainers. **Merge candidate.** Both points from the last triage are addressed. `bd233b3` adds the `// SAFETY:` comment on the `CheckInterfaceSupport` block in `adapter::describe`, and CI (`check`) now passes on this head. `adapter::warnings` now warns separately for each console wave size, 32 or 64, that falls outside the device's `WaveLaneCountMin..=Max`, and for a device without `WaveOps`. The unit tests cover 16-16, 32-32, 64-64 and no-ops. The change only logs: `adapter::log` runs once after `D3D12CreateDevice` in `host::create` (not on the WARP path) and selects nothing. It still merges cleanly. #967, which also adds `adapter.rs`, does not merge cleanly at the moment. On your reply: thanks, that matches what is on `bd233b3` (the `// SAFETY:` comments in `log`/`describe` and the per-size wave warnings). Nothing further from triage; verdict unchanged. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠rminzao on GitHub · 2026-11-26 01:43 UTC · original

Rebased onto main (63bcca4) and pushed bd233b3:

  • CI: the unsafe block in describe now has its // SAFETY: comment. cargo clippy --workspace --all-targets --locked -- -D warnings is clean, with and without --all-features.
  • Wave warning: it now names each console wave size the device's range leaves out, so a 32-only device warns about 64, a 64-only one about 32, and a 16-lane one about both. A device whose WaveOps is false gets its own message ("has no wave operations"). a_gpu_without_the_consoles_wave_sizes_is_warned_about covers 16-16, 32-32, 64-64, 32-64, 4-128 and no wave ops.

cargo test -p victory-gpu --lib adapter::: 3 passed. On this laptop the log still names the Intel UHD and points at the RTX 4050.

AI-assisted (Claude Code).

**@⁠rminzao** on GitHub · 2026-11-26 01:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053#issuecomment-7180055732) Rebased onto `main` (63bcca4) and pushed `bd233b3`: - **CI:** the `unsafe` block in `describe` now has its `// SAFETY:` comment. `cargo clippy --workspace --all-targets --locked -- -D warnings` is clean, with and without `--all-features`. - **Wave warning:** it now names each console wave size the device's range leaves out, so a 32-only device warns about 64, a 64-only one about 32, and a 16-lane one about both. A device whose `WaveOps` is false gets its own message ("has no wave operations"). `a_gpu_without_the_consoles_wave_sizes_is_warned_about` covers 16-16, 32-32, 64-64, 32-64, 4-128 and no wave ops. `cargo test -p victory-gpu --lib adapter::`: 3 passed. On this laptop the log still names the Intel UHD and points at the RTX 4050. _AI-assisted (Claude Code)._
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 04:17 UTC · original · reviewed

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Logs the host GPU and warns when it isn't the one to run on — multi-GPU diagnostics; useful for the laptop/Optimus class of issues (#1483 related).

**@⁠catminou4** on GitHub · 2026-11-25 04:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053#pullrequestreview-6051789260) · **reviewed** Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Logs the host GPU and warns when it isn't the one to run on — multi-GPU diagnostics; useful for the laptop/Optimus class of issues (#1483 related).
Author
Owner

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

Tested locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib adapter:: — 3 passed, 0 failed
  • cargo xtask policy — ok (184 files ok)
  • Clippy CI blocker: cargo clippy -p victory-gpu --all-targets reports 1 warning (which fails -D warnings in CI):
warning: unsafe block missing a safety comment
warning: `victory-gpu` (lib) generated 1 warning

Holding off approval until the // SAFETY: comment is added to the undocumented unsafe block.

AI-assisted (Gemini 4 Neon).

**@⁠DenRakEiw** on GitHub · 2026-11-25 04:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053#pullrequestreview-6052018002) · **reviewed** Tested locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib adapter::` — 3 passed, 0 failed - `cargo xtask policy` — ok (`184 files ok`) - **Clippy CI blocker:** `cargo clippy -p victory-gpu --all-targets` reports 1 warning (which fails `-D warnings` in CI): ``` warning: unsafe block missing a safety comment warning: `victory-gpu` (lib) generated 1 warning ``` Holding off approval until the `// SAFETY:` comment is added to the undocumented `unsafe` block. AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 15:38 UTC · original · approved these changes

Reviewed bd233b3ac16db13f9962638d9c5be86df74212c3 and verified on a live dual-GPU Windows 11 desktop (AMD Ryzen 9 9950X integrated AMD Radeon(TM) Graphics + discrete NVIDIA GeForce RTX 5090 + WARP) with D3D12 Debug Layer.

Audit

  • Scoping & diagnostics (crates/victory-gpu/src/lib.rs:20, crates/victory-gpu/src/host.rs:195, crates/victory-gpu/src/adapter.rs:25, :78, :120):
    • adapter is cleanly gated behind #[cfg(windows)] and logged once in host::create on the non-WARP path right before tdr::log(), keeping WARP runs quiet and avoiding any interference with adapter selection.
    • describe decodes adapter name, LUID, vendor ID, dedicated VRAM MiB, and 4-part UMD driver version via CheckInterfaceSupport(&IDXGIDevice::IID).
    • warnings accurately distinguishes high-performance GPU mismatches (ignoring software adapters), missing WaveOps, and each missing console wave size (32 / 64).

Verification

  • cargo run -p xtask -- policy (192 files ok)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default & --all-features)
  • victory-gpu adapter:: with VICTORY_D3D12_DEBUG=1: 3/3 passed on RTX 5090; 4/4 passed (adapter:: + warp_adapter_accepts_only_software, --features diagnostics) on WARP.
  • Exercised describe + warnings directly against every live DXGI adapter on this dual-GPU host:
    • NVIDIA GeForce RTX 5090 (0x10de, driver 32.0.16.1656, 32187 MiB, 32-32 lanes): matched DXGI high-performance adapter (no wrong-GPU warning) and emitted only the wave of 64 warning.
    • AMD Radeon(TM) Graphics (0x1002, driver 32.0.21042.62, 2021 MiB, 32-64 lanes): emitted the high-performance mismatch warning pointing to NVIDIA GeForce RTX 5090 and no wave-size warning.
    • Microsoft Basic Render Driver (0x1414, software=true, driver 10.0.26100.9818, 4-4 lanes): flagged both wrong-GPU and 32 or 64 wave sizes if ever hit on the non-WARP path, while skipped under VICTORY_WARP=1.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 15:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2053#pullrequestreview-6076887248) · **approved these changes** Reviewed `bd233b3ac16db13f9962638d9c5be86df74212c3` and verified on a live dual-GPU Windows 11 desktop (AMD Ryzen 9 9950X integrated `AMD Radeon(TM) Graphics` + discrete `NVIDIA GeForce RTX 5090` + WARP) with D3D12 Debug Layer. ### Audit - **Scoping & diagnostics** (`crates/victory-gpu/src/lib.rs:20`, `crates/victory-gpu/src/host.rs:195`, `crates/victory-gpu/src/adapter.rs:25`, `:78`, `:120`): - `adapter` is cleanly gated behind `#[cfg(windows)]` and logged once in `host::create` on the non-WARP path right before `tdr::log()`, keeping WARP runs quiet and avoiding any interference with adapter selection. - `describe` decodes adapter name, LUID, vendor ID, dedicated VRAM MiB, and 4-part UMD driver version via `CheckInterfaceSupport(&IDXGIDevice::IID)`. - `warnings` accurately distinguishes high-performance GPU mismatches (ignoring software adapters), missing `WaveOps`, and each missing console wave size (`32` / `64`). ### Verification - `cargo run -p xtask -- policy` (`192 files ok`) - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default & `--all-features`) - `victory-gpu` `adapter::` with `VICTORY_D3D12_DEBUG=1`: **3/3 passed** on RTX 5090; **4/4 passed** (`adapter::` + `warp_adapter_accepts_only_software`, `--features diagnostics`) on WARP. - Exercised `describe` + `warnings` directly against every live DXGI adapter on this dual-GPU host: - `NVIDIA GeForce RTX 5090` (`0x10de`, driver `32.0.16.1656`, `32187 MiB`, `32-32` lanes): matched DXGI high-performance adapter (no wrong-GPU warning) and emitted only the `wave of 64` warning. - `AMD Radeon(TM) Graphics` (`0x1002`, driver `32.0.21042.62`, `2021 MiB`, `32-64` lanes): emitted the high-performance mismatch warning pointing to `NVIDIA GeForce RTX 5090` and no wave-size warning. - `Microsoft Basic Render Driver` (`0x1414`, `software=true`, driver `10.0.26100.9818`, `4-4` lanes): flagged both wrong-GPU and `32 or 64` wave sizes if ever hit on the non-WARP path, while skipped under `VICTORY_WARP=1`.
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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