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 2 commits into
Marvisak:mainfrom
rminzao:gpu-log-host-adapter
Open

rminzao wants to merge 2 commits 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

@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

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

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

rminzao and others added 2 commits November 25, 2026 21:53
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>
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 <noreply@anthropic.com>
@rminzao

rminzao commented Nov 26, 2026

Copy link
Copy Markdown
Author

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

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
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