Skip to content

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

Open
rminzao wants to merge 1 commit into
Marvisak:mainfrom
rminzao:gpu-log-host-adapter
Open

rminzao wants to merge 1 commit into
Marvisak:mainfrom
rminzao:gpu-log-host-adapter

Conversation

@rminzao

@rminzao rminzao commented Nov 25, 2026

Copy link
Copy Markdown

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

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 <noreply@anthropic.com>
@jeremygold02

Copy link
Copy Markdown
Contributor

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

Evidence

Checks and limits

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.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.
Needs work.

The new adapter::log (crates/victory-gpu/src/adapter.rs) runs after D3D12CreateDevice in host::create. It logs the adapter the device is actually on, found by GetAdapterLuid, and warns when DXGI's high-performance adapter is a different GPU or when the device's maximum wave lane count is below 32. It only logs and selects nothing, so it is useful next to the adapter-selection PRs. #967 also adds adapter.rs and currently conflicts with main, while this PR merges cleanly.

What it needs:

  • Fix the CI failure: clippy::undocumented_unsafe_blocks fails the build at adapter.rs:99 (describe, the unsafe { adapter.CheckInterfaceSupport(..) } block). Add a // SAFETY: comment above it.
  • Wave warning (suggestion): it fires only when WaveLaneCountMax < 32. A device that runs only 32 lanes, or only 64, also refuses the pipelines pinned to the other width. Either cover that case or word the warning for the narrow case it detects. This was also raised by the reviewer above.

CI: failing (check: clippy undocumented_unsafe_blocks in adapter.rs).


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants