GPU: prefer high-performance DXGI adapter supporting FL 12.0 (fixes #1226) #2371

Open
github-bot wants to merge 1 commit from github-bot/gh-2371 into main AGit
Owner

@⁠antikohza on GitHub · 2026-11-25 12:07 UTC · original
antikohza:feat/dxgi-high-perf-adapter → main · +81 −1 · 1 files · 1 commits · open

Split out of #2146 per maintainer triage feedback.

What this changes

  • Replaces the blind D3D12CreateDevice(None, ...) call in crates/victory-gpu/src/host.rs with best_adapter():
    • Uses IDXGIFactory6::EnumAdapterByGpuPreference(DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE) first so Windows per-app GPU preferences and discrete/eGPU devices take priority on hybrid laptops instead of falling onto an integrated GPU.
    • Verifies D3D_FEATURE_LEVEL_12_0 support with a null out-pointer (supports_fl12()) before selecting an adapter.
    • Falls back to the non-software adapter with the largest DedicatedVideoMemory, then to D3D12CreateDevice(None, ...) if needed.
  • Adds adapter_memory(&device) (LUID-matched via DXGI) to log host device memory on startup.

Closes #1226.

**@⁠antikohza** on GitHub · 2026-11-25 12:07 UTC · [original](https://github.com/Marvisak/VIctory/pull/2371) `antikohza:feat/dxgi-high-perf-adapter` → `main` · +81 −1 · 1 files · 1 commits · open Split out of #2146 per maintainer triage feedback. ### What this changes - Replaces the blind `D3D12CreateDevice(None, ...)` call in `crates/victory-gpu/src/host.rs` with `best_adapter()`: - Uses `IDXGIFactory6::EnumAdapterByGpuPreference(DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE)` first so Windows per-app GPU preferences and discrete/eGPU devices take priority on hybrid laptops instead of falling onto an integrated GPU. - Verifies `D3D_FEATURE_LEVEL_12_0` support with a null out-pointer (`supports_fl12()`) before selecting an adapter. - Falls back to the non-software adapter with the largest `DedicatedVideoMemory`, then to `D3D12CreateDevice(None, ...)` if needed. - Adds `adapter_memory(&device)` (LUID-matched via DXGI) to log `host device memory` on startup. Closes #1226.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:03:46 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 14:51 UTC · original · edited 2026-11-26 03:21 UTC

Automated triage for the maintainers.

Re-reviewed after the rebase. The branch now merges cleanly, and the content is the same as the version reviewed earlier.

In create (crates/victory-gpu/src/host.rs), best_adapter() replaces D3D12CreateDevice(None, ...). It picks the first non-software adapter from EnumAdapterByGpuPreference(HIGH_PERFORMANCE) that supports FL 12.0, checked with a null-device probe. If that fails, it takes the one with the most dedicated memory. If creating the device on it fails, it falls back to the default adapter. The startup probes (fuses_fmad) use from_device, so they follow the chosen adapter.

One minor point, not blocking: adapter_memory repeats the LUID lookup that video_memory already does with EnumAdapterByLuid. futurepro62's full-suite run on an RTX 5070 Ti passed.

Verdict: merge candidate (a recommendation to look, not an approval). CI: passing.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 14:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2371#issuecomment-7165917869) · edited 2026-11-26 03:21 UTC <!-- victory-triage v1 head=4028dc19a266942e82d3876dfa4a4eaa997190a0 verdict=merge-candidate at=2026-11-26T03:21:21Z --> Automated triage for the maintainers. Re-reviewed after the rebase. The branch now merges cleanly, and the content is the same as the version reviewed earlier. In `create` (`crates/victory-gpu/src/host.rs`), `best_adapter()` replaces `D3D12CreateDevice(None, ...)`. It picks the first non-software adapter from `EnumAdapterByGpuPreference(HIGH_PERFORMANCE)` that supports FL 12.0, checked with a null-device probe. If that fails, it takes the one with the most dedicated memory. If creating the device on it fails, it falls back to the default adapter. The startup probes (`fuses_fmad`) use `from_device`, so they follow the chosen adapter. One minor point, not blocking: `adapter_memory` repeats the LUID lookup that `video_memory` already does with `EnumAdapterByLuid`. futurepro62's full-suite run on an RTX 5070 Ti passed. **Verdict: merge candidate** (a recommendation to look, not an approval). CI: passing. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-25 23:15 UTC · original

Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head 3ffa2d5 (on its base 67e8ae1).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 773 passed, 0 failed, 9 ignored.
  • No new #[test] functions in the diff.
  • --skip leaves out tests that fail on main 842b0cb on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-25 23:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2371#issuecomment-7177313900) Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `3ffa2d5` (on its base `67e8ae1`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **773 passed, 0 failed, 9 ignored**. - No new `#[test]` functions in the diff. - `--skip` leaves out tests that fail on main `842b0cb` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠Xvania7 on GitHub · 2026-11-25 12:34 UTC · original · approved these changes

Verified bbac5c0 on Windows 10 + NVIDIA GeForce RTX 5060:

  • Clean isolation of best_adapter() and supports_fl12() via EnumAdapterByGpuPreference(HIGH_PERFORMANCE)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings
  • cargo xtask policy: 182 files ok
  • GitHub Actions Windows CI passed.

Approving.

**@⁠Xvania7** on GitHub · 2026-11-25 12:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/2371#pullrequestreview-6057676059) · **approved these changes** Verified `bbac5c0` on Windows 10 + NVIDIA GeForce RTX 5060: - Clean isolation of `best_adapter()` and `supports_fl12()` via `EnumAdapterByGpuPreference(HIGH_PERFORMANCE)` - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings - `cargo xtask policy`: 182 files ok - GitHub Actions Windows CI passed. Approving.
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 12:36 UTC · original · reviewed

Prefer high-performance DXGI adapter supporting FL 12.0, falling back to default device. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. See cluster note on #2367 — these two collide.

**@⁠catminou4** on GitHub · 2026-11-25 12:36 UTC · [original](https://github.com/Marvisak/VIctory/pull/2371#pullrequestreview-6057696914) · **reviewed** Prefer high-performance DXGI adapter supporting FL 12.0, falling back to default device. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1. See cluster note on #2367 — these two collide.
Author
Owner

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

Reviewed crates/victory-gpu/src/host.rs at 4028dc19 merged onto origin/main (63bcca43) and verified live on a dual-GPU host (Ryzen 9 9950X AMD Radeon iGPU + NVIDIA GeForce RTX 5090 dGPU) as well as WARP (VICTORY_D3D12_WARP=1) with VICTORY_D3D12_DEBUG=1.

Adapter selection & fallback audit

  • create() (host.rs:193) preserves the VICTORY_D3D12_WARP software branch untouched; for hardware creation it calls best_adapter() (host.rs:426), which queries IDXGIFactory6::EnumAdapterByGpuPreference(DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE), filters out DXGI_ADAPTER_FLAG_SOFTWARE, and checks FL 12.0 via a null out-pointer (supports_fl12 at host.rs:409), falling back to max non-software DedicatedVideoMemory and finally D3D12CreateDevice(None, ...) if needed.
  • Non-blocking maintainer notes: adapter_memory (host.rs:391) could optionally use EnumAdapterByLuid like video_memory; open #3073 addresses the same multi-GPU adapter preference (and #2053 adds GPU logging/warnings).

Verification

  • cargo run -p xtask -- policy: 191 files ok.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • Live dual-GPU selection probe on a host enumerating [0] NVIDIA GeForce RTX 5090 (0x10de, 33,750,515,712 B), [1] AMD Radeon(TM) Graphics (0x1002, 2,119,970,816 B), and [2] Microsoft Basic Render Driver (0x1414, flags=0x2):
    • Default mode selected NVIDIA GeForce RTX 5090 (sw=false, adapter_memory = 33,750,515,712).
    • VICTORY_D3D12_WARP=1 (--features diagnostics) still selected Microsoft Basic Render Driver (0x1414:0x008c, sw=true).
  • host:: with VICTORY_D3D12_DEBUG=1: 35/35 passed on RTX 5090 (skipping dynamic_slots_are_held_until_released) and 36/36 passed on WARP (--features diagnostics, skipping the pre-existing main compositor_failure_presents_primary_in_the_same_frame Debug Layer mismatch).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 15:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2371#pullrequestreview-6076685181) · **approved these changes** Reviewed `crates/victory-gpu/src/host.rs` at `4028dc19` merged onto `origin/main` (`63bcca43`) and verified live on a dual-GPU host (Ryzen 9 9950X AMD Radeon iGPU + NVIDIA GeForce RTX 5090 dGPU) as well as WARP (`VICTORY_D3D12_WARP=1`) with `VICTORY_D3D12_DEBUG=1`. ### Adapter selection & fallback audit - `create()` (`host.rs:193`) preserves the `VICTORY_D3D12_WARP` software branch untouched; for hardware creation it calls `best_adapter()` (`host.rs:426`), which queries `IDXGIFactory6::EnumAdapterByGpuPreference(DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE)`, filters out `DXGI_ADAPTER_FLAG_SOFTWARE`, and checks FL 12.0 via a null out-pointer (`supports_fl12` at `host.rs:409`), falling back to max non-software `DedicatedVideoMemory` and finally `D3D12CreateDevice(None, ...)` if needed. - Non-blocking maintainer notes: `adapter_memory` (`host.rs:391`) could optionally use `EnumAdapterByLuid` like `video_memory`; open `#3073` addresses the same multi-GPU adapter preference (and `#2053` adds GPU logging/warnings). ### Verification - `cargo run -p xtask -- policy`: 191 files ok. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - Live dual-GPU selection probe on a host enumerating `[0] NVIDIA GeForce RTX 5090 (0x10de, 33,750,515,712 B)`, `[1] AMD Radeon(TM) Graphics (0x1002, 2,119,970,816 B)`, and `[2] Microsoft Basic Render Driver (0x1414, flags=0x2)`: - Default mode selected `NVIDIA GeForce RTX 5090` (`sw=false`, `adapter_memory = 33,750,515,712`). - `VICTORY_D3D12_WARP=1` (`--features diagnostics`) still selected `Microsoft Basic Render Driver` (`0x1414:0x008c`, `sw=true`). - `host::` with `VICTORY_D3D12_DEBUG=1`: **35/35 passed** on RTX 5090 (skipping `dynamic_slots_are_held_until_released`) and **36/36 passed** on WARP (`--features diagnostics`, skipping the pre-existing `main` `compositor_failure_presents_primary_in_the_same_frame` Debug Layer mismatch).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
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/2371/head:github-bot/gh-2371'
git switch 'github-bot/gh-2371'

Merge

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