Shader tests: prefer high-performance hardware adapter in emit::host::Host::new #1487
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1487
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1487"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@AscilCH on GitHub · 2026-11-24 18:22 UTC · original
AscilCH:fix/shader-host-high-perf-adapter→main· +143 −21 · 1 files · 1 commits · openProblem
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@ayanbarosan on GitHub · 2026-11-24 18:38 UTC · original
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
1455884onto #1138's branch (mainatffe310eplus #1138). It applies cleanly.cargo test -p victory-shader --locked --lib -- --test-threads=1main+ #1138hardware (Intel(R) UHD Graphics): v_med3_f32(1.0, 2.0, NaN) = 2 (0x40000000), want 1main+ #1138 + #1487VICTORY_WARP=1A local probe (not pushed) printed
Host::new(false).adapter()asNVIDIA GeForce RTX 3050 Laptop GPUandHost::new(true).adapter()asMicrosoft Basic Render Driver. On the combination, clippy onvictory-shader(--all-targets, also with--all-features) is clean, andhost.rspasses rustfmt.On the note about #1138: it doesn't touch
victory-gpu. It changes this same test host.Host::adapter()reads the device's adapter back, and the VALU and waterfall test labels include it, as in the first row. So the two fit together: #1487 picks the GPU, and #1138 names the GPU in each failure. With #1487, a laptop's default run no longer uses the iGPU, so the #726 failure stops showing there. Machines whose only GPU is an Intel one still hit it, and #110 and the branch on #745 both fix it.Overlap: three other open PRs change adapter selection in this
host.rs:VICTORY_ADAPTERname filter. It no longer merges withmain.VICTORY_ADAPTERname filter and ahardware()check. That check treats the Microsoft Basic Render Driver as software when a CI runner lists it without the flag.VICTORY_TEST_ADAPTER=n.#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).
@Marvisak on GitHub · 2026-11-25 01:29 UTC · original
Automated triage for the maintainers.
Needs rebase. This pull request conflicts with
main(conflicting:crates/victory-shader/src/emit/host.rs). It will be reviewed once it is rebased onto the currentmain.Generated by Claude Code
@rminzao on GitHub · 2026-11-25 12:14 UTC · original
Read against the head (
1455884) and currentmain(940d32f):main'shardware_adapter()(ccfb029), which madeHost::new(false)refuse machines without a GPU:!SOFTWARE && DedicatedVideoMemory > 0, because GitHub's runner listsMicrosoft Basic Render Driverwithout the software flag and its device refuses wave32.crates/victory-shader/src/emit/host.rs:117filters on the flag only.:135(D3D12CreateDevice(None)) accepts the software default adapter again. On a GPU-less runner that brings back the failuremainjust fixed. After a rebase, the fallback should behardware_adapter()(or an error), notNone.:120-128) is better than #1483's unprobednth. AddingD3D12_OPTIONS1(WaveOps,WaveLaneCountMax >= 32) tocheck_sm66would also skip a 16-lane iGPU (Intel UHD reports 8..16 lanes) when it is first.:1445repeats the selection logic it checks, so it mainly guards against the two copies drifting apart. That's fine, but it creates a device on every adapter.VICTORY_ADAPTER=n) and #439 change the same function, and #1138 labels test failures with the adapter. A single shape (high-performance order + probe + index/name override) would be easier to land.Static review (AI-assisted), read against the PR head
1455884a28; nothing was run on a GPU.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.