Repository navigation
Conversation
…:Host::new On hybrid / dual-GPU laptops, Host::new(false) called D3D12CreateDevice(None, ...), which selects DXGI adapter 0 (typically the integrated GPU) instead of the discrete GPU (reported in Marvisak#1132). Fix: - In crates/victory-shader/src/emit/host.rs, enumerate hardware adapters via IDXGIFactory6::EnumAdapterByGpuPreference(..., DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE), skipping software adapters and selecting the first adapter that creates a D3D12 device with Shader Model 6.6 support. - Fall back to D3D12CreateDevice(None, ...) when IDXGIFactory6 is unavailable or no non-software adapter is present (preserving WARP-only CI behavior). - Add test emit::host::tests::hardware_host_prefers_high_performance_adapter.
DenRakEiw
left a comment
There was a problem hiding this comment.
Verified locally merged onto origin/main (Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):
cargo test -p victory-shader --lib emit::host::—hardware_host_prefers_high_performance_adapterpassed on RTX 5090 hardware and underVICTORY_D3D12_WARP=1cargo clippy -p victory-shader --all-targets— 0 warningscargo xtask policy— ok
Clean high-performance adapter preference with SM 6.6 check and safe fallback. Looks good.
AI-assisted (Gemini 4 Neon).
|
Tested on a hybrid laptop like the one in the description: i5-11400H with Intel UHD Graphics (driver 31.0.101.5333) at DXGI adapter 0 and an RTX 3050 Laptop GPU (driver 610.91), Windows 11 build 26300. I cherry-picked 1455884 onto #1138's branch (
A local probe (not pushed) printed On the note about #1138: it doesn't touch Overlap: three other open PRs change adapter selection in this
#1487 conflicts with #439 and with #1483 there. Whichever lands second could keep #1487's default together with a name or index override, which would also let a laptop run the suite on its iGPU. No game data used. AI-assisted (Claude Code). |
…dapter in emit::host::Host::new
…dapter in emit::host::Host::new
|
Automated triage for the maintainers. Needs rebase. This pull request conflicts with Generated by Claude Code |
|
Read against the head (
Static review (AI-assisted), read against the PR head 1455884; nothing was run on a GPU. |
Problem
Addresses point 1 of #1132.
On hybrid/dual-GPU Windows machines (e.g. integrated Intel UHD Graphics at adapter index 0 + discrete NVIDIA GeForce RTX 3050 at adapter index 1),
emit::host::Host::new(false)calledD3D12CreateDevice(None, ...), which always picks DXGI adapter 0 (the integrated GPU) instead of the high-performance discrete GPU.Before this fix, running
cargo test -p victory-shaderon a dual-GPU laptop silently executed hardware shader tests onIntel(R) UHD Graphics(32.0.101.6078) rather thanNVIDIA GeForce RTX 3050 6GB Laptop GPU(32.0.16.1742), causing tests to hit iGPU driver quirks (such as 16-lane wave limits and Intel Xemed3NaN behavior).Fix
check_sm66incrates/victory-shader/src/emit/host.rs.Host::new(false), enumerate hardware adapters viaIDXGIFactory6::EnumAdapterByGpuPreference(..., DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE), skippingDXGI_ADAPTER_FLAG_SOFTWARE, and select the first hardware adapter that creates a D3D12 device supporting SM 6.6.D3D12CreateDevice(None, ...)ifIDXGIFactory6is unavailable or no hardware adapter succeeds (preserving WARP-only CI environments).emit::host::tests::hardware_host_prefers_high_performance_adapterverifying thatHost::new(false)selects the first non-software SM 6.6 high-performance adapter (and passes cleanly underVICTORY_WARP=1or on WARP-only hosts).(Orthogonal to #1138, which addresses
victory-gpuruntime adapter selection rather than thevictory-shadertest host.)Verification
Tested on Windows 11 with Intel UHD Graphics (Adapter 0) + NVIDIA GeForce RTX 3050 6GB Laptop GPU (Adapter 1):
Host::new(false)now selectsNVIDIA GeForce RTX 3050 6GB Laptop GPUinstead ofIntel(R) UHD Graphics.rustfmt --edition 2024 --check crates/victory-shader/src/emit/host.rs: cleancargo test -p victory-shader --locked -- --test-threads=1(RTX 3050 + WARP +dxil.dll): 121 passed, 0 failedVICTORY_WARP=1 cargo test -p victory-shader --locked -- --test-threads=1: 121 passed, 0 failedcargo xtask policy: 154 files okcargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean