GPU: read the host GPU's vendor and capabilities once (host profile) #511

Open
github-bot wants to merge 1 commit from github-bot/gh-511 into a-publier AGit
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-27 07:57 UTC · original
0xkn0wh3r3:nvidia-host-profile → a-publier · +322 −53 · 6 files · 1 commits · open

Groundwork for NVIDIA-specific defaults that leave the AMD RDNA paths as they are. This PR changes no behaviour; it gives later changes one place to choose a path by vendor or capability.

The NVIDIA reports (#333, #346, #457, #487) trace most of the gap to defaults tuned on the RX 7900 XTX: fallback heaps, residency waits, and card-buffer limits on 8–12 GB cards. Changing those for NVIDIA alone first needs the vendor known in one place. Today each check works it out for itself: indirect::amd() creates a DXGI factory on every call, and an OPTIONS19 query runs on every pipeline creation.

Changes

1. host::profile, read once (new crates/victory-gpu/src/host/profile.rs)

  • Read right after the host device is made, before anything chooses a path by it, and logged once as host GPU profile.
  • Holds:
    • the vendor (Vendor: AMD, NVIDIA, Intel, Microsoft, other, by PCI ID)
    • WaveLaneCountMin / WaveLaneCountMax
    • the resource binding tier
    • the view-heap maximum the runtime reports (OPTIONS19; None on older runtimes)
    • the tiled resources tier
    • whether GPU upload heaps (resizable BAR) are offered
    • anisotropic filtering with point mip
  • Profile::amd(), nvidia() and rdna() give the answers; RDNA means AMD with waves of 32 and 64, as before.

2. The existing checks read it

  • The wave size and RDNA setup when the device is made (host.rs).
  • indirect::amd(): the host device's answer comes from the profile. A test's or benchmark's own device is still asked directly, so the WARP tests are unaffected.
  • Host::mapped_card_memory(), which keeps its own log line.
  • tiles::wanted().
  • The OPTIONS19 query in pipeline/host.rs, which ran on every pipeline creation.

3. switch::by_host(name, read, default, nvidia)

  • If the variable is set, it decides, read the way that switch already reads it (=1, or anything but 0).
  • If it is unset, an NVIDIA host gets nvidia. Every other host, including one whose vendor is not known, keeps default, the current value.
  • Nothing calls it yet. It carries #[expect(dead_code)], so the build fails once the first switch uses it, as a reminder to remove the attribute.

Not changed

  • No default changes, on any vendor.
  • Nothing under crates/victory-shader/src changes. Any edit there changes the translator's fingerprint (victory-gpu/build.rs), and every cached shader is translated again. So offline translate keeps its own AMD check in emit/host.rs.
  • The view-heap size is still decided by descriptor::host::probe_view_limit, which makes a heap to test it. The profile's value is what the runtime reports, for the log and for code that runs before any heap exists.

Tests

  • New unit tests:
    • vendor IDs, both ways
    • RDNA detection: AMD with waves of 32 and 64, not GCN, not NVIDIA, not an unnamed adapter
    • Profile answers for an RX 7900, an RTX card, an older AMD card and an unnamed adapter
    • by_host's choice: a set variable wins on every host; a host that is not NVIDIA keeps the old default
  • cargo test -p victory-gpu: 405 passed, 34 ignored. With --features diagnostics: 454 passed, 34 ignored.
    • watch::port7_tests::no_write_is_lost_with_port_7 failed once in a full run. It is a timing-sensitive write-watch test this PR does not touch. It passed five times alone and in a full rerun.
  • cargo test -p xtask: 9 passed.
  • cargo clippy -p victory-gpu -p victory --all-targets -- -D warnings: clean, with and without --features victory-gpu/diagnostics.

Not verified

  • Run only on an AMD card, and not with the title. On an NVIDIA card the host GPU profile line in the log should say vendor=Some(Nvidia) with wave_lanes=Some((32, 32)).
**@⁠0xkn0wh3r3** on GitHub · 2026-11-27 07:57 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/511) `0xkn0wh3r3:nvidia-host-profile` → `a-publier` · +322 −53 · 6 files · 1 commits · open Groundwork for NVIDIA-specific defaults that leave the AMD RDNA paths as they are. This PR changes no behaviour; it gives later changes one place to choose a path by vendor or capability. The NVIDIA reports (#333, #346, #457, #487) trace most of the gap to defaults tuned on the RX 7900 XTX: fallback heaps, residency waits, and card-buffer limits on 8–12 GB cards. Changing those for NVIDIA alone first needs the vendor known in one place. Today each check works it out for itself: `indirect::amd()` creates a DXGI factory on every call, and an OPTIONS19 query runs on every pipeline creation. ## Changes **1. `host::profile`, read once** (new `crates/victory-gpu/src/host/profile.rs`) - Read right after the host device is made, before anything chooses a path by it, and logged once as `host GPU profile`. - Holds: - the vendor (`Vendor`: AMD, NVIDIA, Intel, Microsoft, other, by PCI ID) - `WaveLaneCountMin` / `WaveLaneCountMax` - the resource binding tier - the view-heap maximum the runtime reports (OPTIONS19; `None` on older runtimes) - the tiled resources tier - whether GPU upload heaps (resizable BAR) are offered - anisotropic filtering with point mip - `Profile::amd()`, `nvidia()` and `rdna()` give the answers; RDNA means AMD with waves of 32 and 64, as before. **2. The existing checks read it** - The wave size and RDNA setup when the device is made (`host.rs`). - `indirect::amd()`: the host device's answer comes from the profile. A test's or benchmark's own device is still asked directly, so the WARP tests are unaffected. - `Host::mapped_card_memory()`, which keeps its own log line. - `tiles::wanted()`. - The OPTIONS19 query in `pipeline/host.rs`, which ran on every pipeline creation. **3. `switch::by_host(name, read, default, nvidia)`** - If the variable is set, it decides, read the way that switch already reads it (`=1`, or anything but `0`). - If it is unset, an NVIDIA host gets `nvidia`. Every other host, including one whose vendor is not known, keeps `default`, the current value. - Nothing calls it yet. It carries `#[expect(dead_code)]`, so the build fails once the first switch uses it, as a reminder to remove the attribute. ## Not changed - No default changes, on any vendor. - Nothing under `crates/victory-shader/src` changes. Any edit there changes the translator's fingerprint (`victory-gpu/build.rs`), and every cached shader is translated again. So offline `translate` keeps its own AMD check in `emit/host.rs`. - The view-heap size is still decided by `descriptor::host::probe_view_limit`, which makes a heap to test it. The profile's value is what the runtime reports, for the log and for code that runs before any heap exists. ## Tests - New unit tests: - vendor IDs, both ways - RDNA detection: AMD with waves of 32 and 64, not GCN, not NVIDIA, not an unnamed adapter - `Profile` answers for an RX 7900, an RTX card, an older AMD card and an unnamed adapter - `by_host`'s choice: a set variable wins on every host; a host that is not NVIDIA keeps the old default - `cargo test -p victory-gpu`: 405 passed, 34 ignored. With `--features diagnostics`: 454 passed, 34 ignored. - `watch::port7_tests::no_write_is_lost_with_port_7` failed once in a full run. It is a timing-sensitive write-watch test this PR does not touch. It passed five times alone and in a full rerun. - `cargo test -p xtask`: 9 passed. - `cargo clippy -p victory-gpu -p victory --all-targets -- -D warnings`: clean, with and without `--features victory-gpu/diagnostics`. ## Not verified - Run only on an AMD card, and not with the title. On an NVIDIA card the `host GPU profile` line in the log should say `vendor=Some(Nvidia)` with `wave_lanes=Some((32, 32))`.
The vendor and the capabilities paths are chosen by are read once, right
after the host device is made, into `host::profile` and logged as
"host GPU profile": vendor, wave lanes, resource binding tier, the view
heap size the runtime reports (OPTIONS19), tiled resources tier, GPU
upload heaps, and anisotropic filtering with point mip.

The existing checks use it: the wave size and RDNA setup at device
creation, `indirect::amd` (no DXGI factory for the host device; a test's
own device is still asked directly), `mapped_card_memory`,
`tiles::wanted`, and the OPTIONS19 query that ran on every pipeline
creation.

`switch::by_host` gives a switch a default chosen by the host GPU: a set
variable decides as that switch reads it, else NVIDIA gets its own
default and every other host (or one whose vendor is not known) keeps
the default it had. Nothing calls it yet.

No default changes, and nothing under victory-shader/src changes, so the
translator's fingerprint and the shader store stay as they are.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 07:59:30 +00:00
Author
Owner

@⁠MamaLeVrai on GitHub · 2026-11-27 11:40 UTC · original

Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At 0f7c528: victory-gpu 405 passed, 0 failed, 34 ignored.

AI-assisted (Claude Code); no game data.

**@⁠MamaLeVrai** on GitHub · 2026-11-27 11:40 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/511#issuecomment-7217345691) Tested on an RX 6950 XT (RDNA 2), driver 32.0.21045.29003, Windows 11 build 26300, Rust 1.98.1, release. At `0f7c528`: `victory-gpu` 405 passed, 0 failed, 34 ignored. AI-assisted (Claude Code); no game data.
Author
Owner

@⁠WellyngtonSantos on GitHub · 2026-11-27 13:08 UTC · original

Tested on an older AMD card, the case an_older_amd_card_or_unknown_lanes_is_not_rdna describes: RX 580 2048SP (Polaris / GCN4), AMD legacy driver 31.0.21925.1001, Windows 11 26200. The device reports PCI vendor 0x1002 and waves of 64 to 64 lanes. Cross-compiled with the pinned 1.98.1 toolchain (cargo xwin test -p victory-gpu --release --target x86_64-pc-windows-msvc --no-run), run from the crate directory with --test-threads=1.

victory-gpu passed failed ignored
a-publier 4eb6cfd 396 0 34
this PR 0f7c528 405 0 34

The extra nine are the PR's new tests, and the six host::profile tests among them pass. By the profile's rule (Amd with lanes 32..=64), this card is AMD and not RDNA, because it runs 64 lanes only. That is the case an_older_amd_card_or_unknown_lanes_is_not_rdna encodes, and nothing in the crate's tests changes for it.

**@⁠WellyngtonSantos** on GitHub · 2026-11-27 13:08 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/511#issuecomment-7219101907) Tested on an older AMD card, the case `an_older_amd_card_or_unknown_lanes_is_not_rdna` describes: **RX 580 2048SP (Polaris / GCN4), AMD legacy driver 31.0.21925.1001**, Windows 11 26200. The device reports PCI vendor 0x1002 and waves of 64 to 64 lanes. Cross-compiled with the pinned 1.98.1 toolchain (`cargo xwin test -p victory-gpu --release --target x86_64-pc-windows-msvc --no-run`), run from the crate directory with `--test-threads=1`. | `victory-gpu` | passed | failed | ignored | |---|---|---|---| | `a-publier` `4eb6cfd` | 396 | 0 | 34 | | this PR `0f7c528` | **405** | **0** | 34 | The extra nine are the PR's new tests, and the six `host::profile` tests among them pass. By the profile's rule (`Amd` with lanes `32..=64`), this card is AMD and not RDNA, because it runs 64 lanes only. That is the case `an_older_amd_card_or_unknown_lanes_is_not_rdna` encodes, and nothing in the crate's tests changes for it.
This pull request can be merged automatically.
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/511/head:github-bot/gh-511'
git switch 'github-bot/gh-511'

Merge

Merge the changes and update on Forgejo.
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-511'
git switch 'github-bot/gh-511'
git rebase 'a-publier'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-511'
git switch 'github-bot/gh-511'
git rebase 'a-publier'
git switch 'a-publier'
git merge --no-ff 'github-bot/gh-511'
git switch 'a-publier'
git merge --squash 'github-bot/gh-511'
git switch 'a-publier'
git merge --ff-only 'github-bot/gh-511'
git switch 'a-publier'
git merge 'github-bot/gh-511'
git push origin 'a-publier'
This discussion has been locked. Commenting is limited to contributors.
No description provided.