host: say which card answered, when it is the small one, and how much of its budget is its own #3141

Open
fiestorra wants to merge 1 commit from upstream-pr/3141 into main
fiestorra commented 2026-12-02 13:42:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T13:42:02Z.


Which card answered, always; a warning when it is not the one with the most memory of its own; and the memory line no longer prints the PC's memory as the card's - the three things #3034's finding: asks for.

1. The card, in every run

host device card  card="NVIDIA GeForce RTX 4090" vendor=0x10de device=0x2684 dedicated_mb=24576 shared_mb=16300

A bug report's first question is which card ran, and the only line that named one was LEONIDA_ADAPTER's own, so a run that took the default said nothing. It is the "say which GPU answered" rule the repo added to AGENTS.md, on the production path.

2. The warning, when the default is the small one

D3D12CreateDevice(None, ..) - the branch that runs when no card is named - makes its device on Windows' default adapter, and on a PC whose monitor hangs off the motherboard that is the integrated chip. DLSS cannot start there, every frame is drawn by the chip, and nothing said so (#3034's laptop, #2907, #2762).

host device on the default card, which is not the one with the most memory of its own:
  card="AMD Radeon(TM) Graphics" card_mb=512 bigger="NVIDIA GeForce RTX 4090" bigger_mb=24576
name the card with LEONIDA_ADAPTER, or the launcher's -Adapter

It does not change the device: the repo does not pick a card for people. No WMI, and no cost on a one-card PC - the same DXGI enumeration LEONIDA_ADAPTER already does.

3. The memory line, told honestly

log_video_memory called DXGI's MEMORY_SEGMENT_GROUP_LOCAL "the card's own", and on an integrated chip that group is the PC's memory - which is how a 512 MB chip printed a 15,683 MB budget as its own. The card now says how much of it is its own, from the adapter's own DedicatedVideoMemory:

... the card's own: budget 15683 MB, in use 512 MB, ... , of which 512 MB is memory of its own
    (the rest is the PC's memory, shared with the card); the PC's shared with the card: ...

A discrete card prints nothing extra (its budget is its own), and when the system does not say what the card owns, nothing is claimed.

Verified

cargo test -p leonida-gpu --lib -- --test-threads=1 bigger_card          1 passed, 1 ignored
cargo test -p leonida-gpu --lib -- --test-threads=1 the_local_budget    1 passed
cargo clippy -p leonida-gpu --all-targets                               1 warning, host.rs:7741 on main (#2877)

The ignored one makes devices (it asserts that the card called small really holds less, that the biggest is never named beside another, and that any device can be named with a vendor id and memory that are not zero); the other is pure: a card with memory of its own gets no note, a chip without one gets its share, and an unknown card gets silence.

Rebased onto main 69cd4106c, one file, no drift.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5607628631 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T13:42:02Z. --- **Which card answered, always; a warning when it is not the one with the most memory of its own; and the memory line no longer prints the PC's memory as the card's - the three things #3034's `finding:` asks for.** ## 1. The card, in every run ``` host device card card="NVIDIA GeForce RTX 4090" vendor=0x10de device=0x2684 dedicated_mb=24576 shared_mb=16300 ``` **A bug report's first question is which card ran**, and the only line that named one was `LEONIDA_ADAPTER`'s own, so a run that took the default said nothing. **It is the "say which GPU answered" rule the repo added to `AGENTS.md`, on the production path.** ## 2. The warning, when the default is the small one `D3D12CreateDevice(None, ..)` - the branch that runs when no card is named - makes its device on Windows' default adapter, and on a PC whose monitor hangs off the motherboard that is the integrated chip. **DLSS cannot start there, every frame is drawn by the chip, and nothing said so** (#3034's laptop, #2907, #2762). ``` host device on the default card, which is not the one with the most memory of its own: card="AMD Radeon(TM) Graphics" card_mb=512 bigger="NVIDIA GeForce RTX 4090" bigger_mb=24576 name the card with LEONIDA_ADAPTER, or the launcher's -Adapter ``` **It does not change the device**: the repo does not pick a card for people. **No WMI, and no cost on a one-card PC** - the same DXGI enumeration `LEONIDA_ADAPTER` already does. ## 3. The memory line, told honestly `log_video_memory` called DXGI's `MEMORY_SEGMENT_GROUP_LOCAL` "the card's own", **and on an integrated chip that group is the PC's memory** - which is how a 512 MB chip printed a **15,683 MB budget as its own**. **The card now says how much of it is its own**, from the adapter's own `DedicatedVideoMemory`: ``` ... the card's own: budget 15683 MB, in use 512 MB, ... , of which 512 MB is memory of its own (the rest is the PC's memory, shared with the card); the PC's shared with the card: ... ``` **A discrete card prints nothing extra** (its budget *is* its own), and when the system does not say what the card owns, nothing is claimed. ## Verified ``` cargo test -p leonida-gpu --lib -- --test-threads=1 bigger_card 1 passed, 1 ignored cargo test -p leonida-gpu --lib -- --test-threads=1 the_local_budget 1 passed cargo clippy -p leonida-gpu --all-targets 1 warning, host.rs:7741 on main (#2877) ``` **The ignored one makes devices** (it asserts that the card called small really holds less, that the biggest is never named beside another, and that any device can be named with a vendor id and memory that are not zero); **the other is pure**: a card with memory of its own gets no note, a chip without one gets its share, and an unknown card gets silence. **Rebased onto `main` `69cd4106c`**, one file, no drift. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
merzleckeier commented 2026-12-02 14:10:23 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:10:23Z.

Review: COMMENTED


The ignored test skips verification of the largest adapter. In device_on_the_biggest in host.rs, factory.EnumAdapters1(i).ok()? returns None from the entire helper at the normal end of enumeration. The test then returns before asserting that the largest adapter produces no warning. Breaking on enumeration exhaustion, as production already does, lets the helper use the best it collected. A failed GetDesc1 can similarly be skipped per adapter.

Verified on main 69cd4106c + head 4d289b62 with an MSVC-target build under Wine 11.22 / vkd3d-proton 3.1.0 on CachyOS. DXGI exposed the Radeon iGPU (512 MiB) and RTX 4070 SUPER (12,282 MiB). The original helper returned None and the stock ignored test passed. A scratch helper with break at enumeration end created the RTX device and reached the assertion. With those physical devices selected explicitly, production bigger_card_than named the RTX beside the Radeon and returned None for the RTX itself. Mesa RADV 26.3.1 and NVIDIA 620.73.04. Synthetic tests only. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6152441341 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#pullrequestreview-6152441341). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:10:23Z. **Review:** COMMENTED --- **The ignored test skips verification of the largest adapter.** In `device_on_the_biggest` in `host.rs`, `factory.EnumAdapters1(i).ok()?` returns `None` from the entire helper at the normal end of enumeration. The test then returns before asserting that the largest adapter produces no warning. Breaking on enumeration exhaustion, as production already does, lets the helper use the `best` it collected. A failed `GetDesc1` can similarly be skipped per adapter. Verified on main `69cd4106c` + head `4d289b62` with an MSVC-target build under Wine 11.22 / vkd3d-proton 3.1.0 on CachyOS. DXGI exposed the Radeon iGPU (512 MiB) and RTX 4070 SUPER (12,282 MiB). The original helper returned `None` and the stock ignored test passed. A scratch helper with `break` at enumeration end created the RTX device and reached the assertion. With those physical devices selected explicitly, production `bigger_card_than` named the RTX beside the Radeon and returned `None` for the RTX itself. Mesa RADV 26.3.1 and NVIDIA 620.73.04. Synthetic tests only. AI-assisted with OpenAI Codex.
merzleckeier commented 2026-12-02 14:38:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:38:01Z.

Review: COMMENTED


Follow-up on 3c09634. The same merged Rust tree was built on 69cd4106c and still merges cleanly onto acc350745, whose intervening changes are in the Python translator and its docs/tests.

On a two-adapter Wine 11.22 / VKD3D-Proton machine, a local probe selected the largest DXGI adapter and exercised the new card_of() code. Its vendor ID, device ID, dedicated memory and shared memory matched GetDesc1() for the device LUID. The RTX 4070 SUPER reported 12,282 MiB dedicated and 23,466 MiB shared, and bigger_card_than() returned None for it.

The ignored test still returns before its largest-adapter and new metadata assertions. The same probe calls the stock device_on_the_biggest() and confirms it returns None after enumeration, even though a device can be created on the selected adapter. A break on EnumAdapters1 exhaustion lets the test use its accumulated best. Keeping card_of() checks on the already-created default device would also let them run on one-adapter setups. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6152935317 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#pullrequestreview-6152935317). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:38:01Z. **Review:** COMMENTED --- Follow-up on `3c09634`. The same merged Rust tree was built on `69cd4106c` and still merges cleanly onto `acc350745`, whose intervening changes are in the Python translator and its docs/tests. On a two-adapter Wine 11.22 / VKD3D-Proton machine, a local probe selected the largest DXGI adapter and exercised the new `card_of()` code. Its vendor ID, device ID, dedicated memory and shared memory matched `GetDesc1()` for the device LUID. The RTX 4070 SUPER reported 12,282 MiB dedicated and 23,466 MiB shared, and `bigger_card_than()` returned `None` for it. The ignored test still returns before its largest-adapter and new metadata assertions. The same probe calls the stock `device_on_the_biggest()` and confirms it returns `None` after enumeration, even though a device can be created on the selected adapter. A `break` on `EnumAdapters1` exhaustion lets the test use its accumulated `best`. Keeping `card_of()` checks on the already-created default device would also let them run on one-adapter setups. AI-assisted with OpenAI Codex.
merzleckeier commented 2026-12-02 14:56:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by merzleckeier on 2026-12-02T14:56:30Z.

Review: COMMENTED


The new budget note in 5a9047ba still leaves zero-dedicated-memory UMA adapters reporting a positive budget under the card's own. memory_of_its_own_mb() maps a failed GetDesc1() and a successful descriptor containing DedicatedVideoMemory == 0 to the same value. The latter is a valid byte count, and on UMA the DXGI local segment maps to system memory. Adapter descriptor · D3D12 memory pools

Confirmed with a synthetic 15,683 MiB local budget and zero dedicated VRAM on acc350745 + this head. The existing note was empty. A local Option<u64> version preserved the distinction and passed the stock budget assertions plus the new zero case under Wine 11.22. The 35-test game_gate.py suite had 33 passes and 2 skips. I also checked that VIDEO reads the same four budget/usage fields with an added zero-specific suffix, so the existing parser prefix can stay in place. The zero-dedicated case was simulated. AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6153275185 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#pullrequestreview-6153275185). Originally posted by [merzleckeier](https://github.com/merzleckeier) on 2026-12-02T14:56:30Z. **Review:** COMMENTED --- The new budget note in `5a9047ba` still leaves zero-dedicated-memory UMA adapters reporting a positive budget under `the card's own`. `memory_of_its_own_mb()` maps a failed `GetDesc1()` and a successful descriptor containing `DedicatedVideoMemory == 0` to the same value. The latter is a valid byte count, and on UMA the DXGI local segment maps to system memory. [Adapter descriptor](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/ns-dxgi-dxgi_adapter_desc1) · [D3D12 memory pools](https://learn.microsoft.com/windows/win32/api/d3d12/ne-d3d12-d3d12_memory_pool) Confirmed with a synthetic 15,683 MiB local budget and zero dedicated VRAM on `acc350745` + this head. The existing note was empty. A local `Option<u64>` version preserved the distinction and passed the stock budget assertions plus the new zero case under Wine 11.22. The 35-test `game_gate.py` suite had 33 passes and 2 skips. I also checked that `VIDEO` reads the same four budget/usage fields with an added zero-specific suffix, so the existing parser prefix can stay in place. The zero-dedicated case was simulated. AI-assisted with OpenAI Codex.
Kal0s-design commented 2026-12-02 17:04:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Kal0s-design on 2026-12-02T17:04:49Z.


Ran natively on Windows 11, head 5a9047ba3 merged into current main (3c106eb2f, clean merge). This machine is a desktop with three DXGI adapters: a discrete NVIDIA card, an integrated adapter and the software adapter. No game data.

DXGI's adapter order changed on this machine. In my first probe, adapter 0 was the integrated adapter and D3D12CreateDevice(None) landed on it. A later probe, run three times with both CreateDXGIFactory1 and CreateDXGIFactory2, gave the same result each time: adapter 0 is the discrete card, which is the only one with a display output, and D3D12CreateDevice(None) lands on it. An earlier run on this machine, posted on #3049, also had the discrete card first. I cannot show what changed the order between my two probes. So the order is not fixed even on one desktop, which is the case this PR's always-on card line is for.

Suites (measured)

Command Result
cargo test -p leonida-gpu --lib --locked -- bigger_card --include-ignored 2 passed (including the ignored one)
cargo test -p leonida-gpu --lib --locked 697 passed, 60 ignored
cargo clippy -p leonida-gpu --locked --all-targets only the existing unused_mut

What the new code reports on real adapters (measured, throwaway test calling card_of / bigger_card_than / own_memory_note on a device made on each adapter)

Device on card_of matches GetDesc1 (name, vendor, dedicated) bigger_card_than own_memory_note(local budget, dedicated)
default (D3D12CreateDevice(None)) yes, and its LUID is adapter 0's in both probes (integrated in the first, discrete in the later one) first probe: names the discrete card as bigger; later probe: same adapter as the discrete row, so None same as the row for that adapter
integrated adapter yes names the discrete card as bigger note printed: the local budget is many times the dedicated carve-out
discrete card yes None empty (local budget below dedicated)
software adapter (WARP) yes, dedicated 0 names the discrete card (not reached: the WARP branch never sets on_the_default_card) empty
  • On native Windows, while the integrated adapter was adapter 0, the warning fired as intended with no LEONIDA_ADAPTER: the device landed on the integrated adapter and the warning named the discrete card. With the discrete card as adapter 0, the default device is on the biggest card and bigger_card_than returns None, so there is no warning. The thread had only shown this under Wine. The integrated adapter's non-local budget reads 0 here, so on this adapter the memory line's "the PC's shared with the card: budget 0 MB" sits next to a note saying "the rest is the PC's memory, shared with the card". It is accurate, but readers may find it confusing.
  • The zero-dedicated case raised above is real on Windows, not only simulated. The software adapter reports dedicated 0 and a positive local budget. own_memory_note returns "" for it, so a LEONIDA_D3D12_WARP run still labels all of that budget "the card's own".
  • The PR's device_on_the_biggest() returns None on native Windows too (integrated, discrete and software adapters; adapter 0 was the integrated one in that probe). The ignored test therefore passed after only its first block. The largest-adapter and card_of assertions did not run here either, which confirms the earlier Wine report on a real three-adapter Windows host.

own_memory_note boundaries (measured, pure)

budget MB, own MB result
1536, 512 empty
1537, 512 note
3072, 2048 empty
3073, 2048 note
15683, 0 empty
17408, 16384 empty
17409, 16384 note
0, 512 empty

The 1024 MB slack is strict at own + 1024. A 2 GiB-carve-out integrated adapter whose local budget is within 1 GiB of the carve-out would get no note.

Reading

  • bigger_card_than ranks adapters only by DedicatedVideoMemory. An APU with a large UMA carve-out set in firmware could outrank a smaller discrete card and would then be named as the "bigger" one. This is not tested, because the comparison is inline over a live device and I did not want to test a replica of it.
  • DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE returns the discrete card here, while UNSPECIFIED and MINIMUM_POWER return the integrated one (measured).

Overlap with #3049 (4d96edeae, measured)

  • git merge-tree: #3141 on top of main + #3049 conflicts in host.rs create(), in the default-device else branch. #3049 rewrites it into chosen_adapter() → default_adapter() → D3D12CreateDevice(None), and #3141 adds on_the_default_card = true after the bare D3D12CreateDevice(None). When resolving, set the flag only in #3049's final if device.is_none() fallback. Otherwise a small card named by LEONIDA_ADAPTER would be warned about.
  • With #3049 alone merged on main, its default_adapter() returns None on this machine. Its integrated() predicate (< 1 GiB dedicated) is false for this integrated adapter, so whenever the integrated adapter is adapter 0, as it was in my first probe, #3049 leaves the device there and #3141's warning is the only signal. The two PRs complement each other. #3049's own description notes that an integrated GPU reserving 1 GiB or more is not switched, and this machine is such a case.
  • Both PRs add name extraction from DXGI_ADAPTER_DESC1. #3049 adds a card_name helper, and #3141 has two inline copies plus a closure. Whichever lands second can share one.

Not checked: the emitted host device card / warning lines as they appear in a real log (I called the functions directly and did not start a Host); laptops with hybrid graphics; a non-NVIDIA discrete card; an in-game run.

GPUs tested: one NVIDIA desktop card + an integrated adapter + WARP (device creation only).

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7352871125 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#issuecomment-7352871125). Originally posted by [Kal0s-design](https://github.com/Kal0s-design) on 2026-12-02T17:04:49Z. --- Ran natively on Windows 11, head `5a9047ba3` merged into current `main` (`3c106eb2f`, clean merge). This machine is a desktop with three DXGI adapters: a discrete NVIDIA card, an integrated adapter and the software adapter. No game data. **DXGI's adapter order changed on this machine.** In my first probe, adapter 0 was the integrated adapter and `D3D12CreateDevice(None)` landed on it. A later probe, run three times with both `CreateDXGIFactory1` and `CreateDXGIFactory2`, gave the same result each time: adapter 0 is the discrete card, which is the only one with a display output, and `D3D12CreateDevice(None)` lands on it. An earlier run on this machine, posted on #3049, also had the discrete card first. I cannot show what changed the order between my two probes. So the order is not fixed even on one desktop, which is the case this PR's always-on card line is for. **Suites (measured)** | Command | Result | |---|---| | `cargo test -p leonida-gpu --lib --locked -- bigger_card --include-ignored` | 2 passed (including the ignored one) | | `cargo test -p leonida-gpu --lib --locked` | 697 passed, 60 ignored | | `cargo clippy -p leonida-gpu --locked --all-targets` | only the existing `unused_mut` | **What the new code reports on real adapters (measured, throwaway test calling `card_of` / `bigger_card_than` / `own_memory_note` on a device made on each adapter)** | Device on | `card_of` matches `GetDesc1` (name, vendor, dedicated) | `bigger_card_than` | `own_memory_note(local budget, dedicated)` | |---|---|---|---| | default (`D3D12CreateDevice(None)`) | yes, and its LUID is adapter 0's in both probes (integrated in the first, discrete in the later one) | first probe: names the discrete card as bigger; later probe: same adapter as the discrete row, so `None` | same as the row for that adapter | | integrated adapter | yes | names the discrete card as bigger | note printed: the local budget is many times the dedicated carve-out | | discrete card | yes | `None` | empty (local budget below dedicated) | | software adapter (WARP) | yes, dedicated 0 | names the discrete card (not reached: the WARP branch never sets `on_the_default_card`) | empty | - On native Windows, while the integrated adapter was adapter 0, the warning fired as intended with no `LEONIDA_ADAPTER`: the device landed on the integrated adapter and the warning named the discrete card. With the discrete card as adapter 0, the default device is on the biggest card and `bigger_card_than` returns `None`, so there is no warning. The thread had only shown this under Wine. The integrated adapter's non-local budget reads 0 here, so on this adapter the memory line's "the PC's shared with the card: budget 0 MB" sits next to a note saying "the rest is the PC's memory, shared with the card". It is accurate, but readers may find it confusing. - The zero-dedicated case raised above is real on Windows, not only simulated. The software adapter reports dedicated 0 and a positive local budget. `own_memory_note` returns `""` for it, so a `LEONIDA_D3D12_WARP` run still labels all of that budget "the card's own". - The PR's `device_on_the_biggest()` returns `None` on native Windows too (integrated, discrete and software adapters; adapter 0 was the integrated one in that probe). The ignored test therefore passed after only its first block. The largest-adapter and `card_of` assertions did not run here either, which confirms the earlier Wine report on a real three-adapter Windows host. **`own_memory_note` boundaries (measured, pure)** | budget MB, own MB | result | |---|---| | 1536, 512 | empty | | 1537, 512 | note | | 3072, 2048 | empty | | 3073, 2048 | note | | 15683, 0 | empty | | 17408, 16384 | empty | | 17409, 16384 | note | | 0, 512 | empty | The 1024 MB slack is strict at `own + 1024`. A 2 GiB-carve-out integrated adapter whose local budget is within 1 GiB of the carve-out would get no note. **Reading** - `bigger_card_than` ranks adapters only by `DedicatedVideoMemory`. An APU with a large UMA carve-out set in firmware could outrank a smaller discrete card and would then be named as the "bigger" one. This is not tested, because the comparison is inline over a live device and I did not want to test a replica of it. - `DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE` returns the discrete card here, while `UNSPECIFIED` and `MINIMUM_POWER` return the integrated one (measured). **Overlap with #3049 (`4d96edeae`, measured)** - `git merge-tree`: #3141 on top of `main` + #3049 conflicts in `host.rs` `create()`, in the default-device `else` branch. #3049 rewrites it into `chosen_adapter()` → `default_adapter()` → `D3D12CreateDevice(None)`, and #3141 adds `on_the_default_card = true` after the bare `D3D12CreateDevice(None)`. When resolving, set the flag only in #3049's final `if device.is_none()` fallback. Otherwise a small card named by `LEONIDA_ADAPTER` would be warned about. - With #3049 alone merged on `main`, its `default_adapter()` returns `None` on this machine. Its `integrated()` predicate (< 1 GiB dedicated) is false for this integrated adapter, so whenever the integrated adapter is adapter 0, as it was in my first probe, #3049 leaves the device there and #3141's warning is the only signal. The two PRs complement each other. #3049's own description notes that an integrated GPU reserving 1 GiB or more is not switched, and this machine is such a case. - Both PRs add name extraction from `DXGI_ADAPTER_DESC1`. #3049 adds a `card_name` helper, and #3141 has two inline copies plus a closure. Whichever lands second can share one. Not checked: the emitted `host device card` / warning lines as they appear in a real log (I called the functions directly and did not start a `Host`); laptops with hybrid graphics; a non-NVIDIA discrete card; an in-game run. GPUs tested: one NVIDIA desktop card + an integrated adapter + WARP (device creation only). AI-assisted: yes (Claude Code).
fiestorra commented 2026-12-02 18:07:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-02T18:07:58Z.


Thank you - that is a better check of this than I could make here, and the adapter-order observation is the part I did not have.

Your measurement table is the one I would have wanted: card_of matching GetDesc1, bigger_card_than naming the discrete card, and own_memory_note crossing exactly where the arithmetic says it should (1536/512 empty, 1537/512 note; 3072/2048 empty, 3073/2048 note). And the two cases I could only simulate turned out to be real on Windows - the software adapter's dedicated 0, and device_on_the_biggest() returning None for every card on that machine. That is the part where a second machine is worth more than a second test.

What I am taking from it: "DXGI's adapter order changed on this machine" - adapter 0 was the integrated in your first probe and the discrete in the second - is the fact this pull request exists for. If D3D12CreateDevice(None, ..) can land on a different card between two runs of the same machine, then a vendor=1002 in a test's output is not an oddity to explain away; it is the default working as documented and the reason the warning matters. I have a log from this week that shows exactly that on my own box (a places run answering vendor=1002 while the game ran on the 4090), and I had been treating it as stable per machine - your probe says otherwise, and that makes the note in the test's output the only thing a reader can trust.

On the clippy note: the existing unused_mut is not mine, and I would rather it stays visible than be silenced by this pull request.

AI-assisted: yes - DeepSeek v4.1 (flash).

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7353983733 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#issuecomment-7353983733). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-02T18:07:58Z. --- **Thank you - that is a better check of this than I could make here, and the adapter-order observation is the part I did not have.** **Your measurement table is the one I would have wanted**: `card_of` matching `GetDesc1`, `bigger_card_than` naming the discrete card, and `own_memory_note` crossing exactly where the arithmetic says it should (1536/512 empty, 1537/512 note; 3072/2048 empty, 3073/2048 note). **And the two cases I could only simulate turned out to be real on Windows** - the software adapter's dedicated 0, and `device_on_the_biggest()` returning `None` for every card on that machine. **That is the part where a second machine is worth more than a second test.** **What I am taking from it**: **"DXGI's adapter order changed on this machine"** - adapter 0 was the integrated in your first probe and the discrete in the second - **is the fact this pull request exists for.** **If `D3D12CreateDevice(None, ..)` can land on a different card between two runs of the same machine, then a `vendor=1002` in a test's output is not an oddity to explain away; it is the default working as documented and the reason the warning matters.** **I have a log from this week that shows exactly that on my own box** (a `places` run answering `vendor=1002` while the game ran on the 4090), and I had been treating it as stable per machine - **your probe says otherwise, and that makes the note in the test's output the only thing a reader can trust.** **On the clippy note**: the existing `unused_mut` is not mine, and I would rather it stays visible than be silenced by this pull request. **AI-assisted:** yes - DeepSeek v4.1 (flash). Written with an AI assistant.
MoonEyes commented 2026-12-02 18:11:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-12-02T18:11:49Z.


Reviewed #3141 (code review only, not built here: Windows-only DXGI code). The logging is useful, but the device-making half of its ignored test never runs, and it conflicts with #3049, which changes the same card choice.

Head 5a9047ba36
Merge with main 45dc41f95c clean (git merge-tree); merge base 69cd4106ce, 38 commits behind
Switches registry on the merge python -I tools/d3d12_switches.py --check d3d12/docs/switches.md: exit 0
Windows evidence Kal0s-design, this head merged onto 3c106eb2f: suites green, warning seen on a real integrated-adapter default

Defects

  1. d3d12/crates/leonida-gpu/src/host.rs, bigger_card_tests::device_on_the_biggest: the loop is let adapter = factory.EnumAdapters1(i).ok()?;. EnumAdapters1 always ends the enumeration with DXGI_ERROR_NOT_FOUND, so the ? returns None from the whole function before best is ever used. The test then stops at let Some(biggest) = device_on_the_biggest() else { return };, so its second and third parts ("the biggest card is never named beside another", and the card_of checks) never run on any machine, and the ignored test still reports ok. bigger_card_than in the same diff does it right (let Ok(adapter) = factory.EnumAdapters1(i) else { break };). Same fix here; adapter.GetDesc1().ok()? two lines below has the same problem and should continue.
  2. Conflicts with #3049 (host: use the high-performance card when the default is integrated, open): git merge-tree pr/3049 pr/3141 reports CONFLICT (content) in d3d12/crates/leonida-gpu/src/host.rs. Both rewrite the D3D12CreateDevice(None, ..) branch of create(). If #3049 lands, this warning ("name the card with LEONIDA_ADAPTER") is no longer the right advice for the integrated-default case it targets. The two authors should agree which lands first; this one then keeps only the always-on card line and the memory note. #2948 (log the host adapter selected by the device, open) also overlaps with the always-on line.

Smaller points

  • The UTF-16 name decoding is written twice (card_of and the name closure in bigger_card_than), and each function makes its own DXGI factory and looks up the same adapter by LUID. One helper returning the DXGI_ADAPTER_DESC1 would remove both copies. This runs once per run, so it is cleanliness, not cost.
  • Process: no claim ID in the description, and the model is given as DeepSeek v4.1 (flash). CONTRIBUTING.md lists that model for documentation and simple fixes; this adds new runtime code. A "new code" model should review it.

Verdict: defects. Fix item 1 (a two-line change) and settle the order with #3049.

AI-assisted: Claude Opus 5.5 (Claude Code), review only.

AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.


Generated by Claude Code

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7354100881 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#issuecomment-7354100881). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-12-02T18:11:49Z. --- **Reviewed #3141 (code review only, not built here: Windows-only DXGI code). The logging is useful, but the device-making half of its ignored test never runs, and it conflicts with #3049, which changes the same card choice.** | | | |---|---| | Head | `5a9047ba36` | | Merge with `main` `45dc41f95c` | clean (`git merge-tree`); merge base `69cd4106ce`, 38 commits behind | | Switches registry on the merge | `python -I tools/d3d12_switches.py --check d3d12/docs/switches.md`: exit 0 | | Windows evidence | Kal0s-design, this head merged onto `3c106eb2f`: suites green, warning seen on a real integrated-adapter default | **Defects** 1. `d3d12/crates/leonida-gpu/src/host.rs`, `bigger_card_tests::device_on_the_biggest`: the loop is `let adapter = factory.EnumAdapters1(i).ok()?;`. `EnumAdapters1` always ends the enumeration with `DXGI_ERROR_NOT_FOUND`, so the `?` returns `None` from the whole function before `best` is ever used. The test then stops at `let Some(biggest) = device_on_the_biggest() else { return };`, so its second and third parts ("the biggest card is never named beside another", and the `card_of` checks) never run on any machine, and the ignored test still reports `ok`. `bigger_card_than` in the same diff does it right (`let Ok(adapter) = factory.EnumAdapters1(i) else { break };`). Same fix here; `adapter.GetDesc1().ok()?` two lines below has the same problem and should `continue`. 2. **Conflicts with #3049** (`host: use the high-performance card when the default is integrated`, open): `git merge-tree pr/3049 pr/3141` reports `CONFLICT (content)` in `d3d12/crates/leonida-gpu/src/host.rs`. Both rewrite the `D3D12CreateDevice(None, ..)` branch of `create()`. If #3049 lands, this warning ("name the card with LEONIDA_ADAPTER") is no longer the right advice for the integrated-default case it targets. The two authors should agree which lands first; this one then keeps only the always-on card line and the memory note. #2948 (`log the host adapter selected by the device`, open) also overlaps with the always-on line. **Smaller points** - The UTF-16 name decoding is written twice (`card_of` and the `name` closure in `bigger_card_than`), and each function makes its own DXGI factory and looks up the same adapter by LUID. One helper returning the `DXGI_ADAPTER_DESC1` would remove both copies. This runs once per run, so it is cleanliness, not cost. - Process: no claim ID in the description, and the model is given as DeepSeek v4.1 (flash). CONTRIBUTING.md lists that model for documentation and simple fixes; this adds new runtime code. A "new code" model should review it. **Verdict: defects.** Fix item 1 (a two-line change) and settle the order with #3049. AI-assisted: Claude Opus 5.5 (Claude Code), review only. AI-assisted verification: Claude Opus (Claude Code), separate agent per batch. --- _Generated by [Claude Code](https://claude.ai/code)_
fiestorra commented 2026-12-03 00:18:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-12-03T00:18:55Z.


VERIFY-3141 — Windows nativo: corrió en una máquina con dos adaptadores, y el control mostró qué mitad prueba aquí

Own commit 5a9047ba3 — host.rs, +199/−2

Ran at the head, with the two-adapter test forced on (#[ignore]d because it needs a card — this machine has an RTX 4090 and an integrated Radeon):

cargo test -p leonida-gpu --lib the_default_card -- --ignored
  host::bigger_card_tests::the_default_card_is_named_beside_a_bigger_one_and_the_biggest_never_is ... ok

And the control, which did not bite, and the reason is the finding: I stubbed bigger_card_than to return None always — and the test still passed. Because the test's first half is if let Some(...) = bigger_card_than(&default), and on this machine Windows' default device is the biggest card (the 4090, beside the iGPU) — so the "a bigger one exists beside it" branch is skipped entirely, and the rest (the biggest is never told it is small) is satisfied by a function that never says anything.

So: the test passes here, and what it actually proves here is the negative half. The half that needs a default card smaller than another — the hybrid-laptop shape, where the iGPU is the default and the dGPU holds more — is not exercised on a desktop, and my stub is invisible to it.

What I can say: the code compiles, creates a device, enumerates adapters, finds the biggest, and card_of names it with a vendor id and DXGI's memory — all of that ran, on real DXGI, on this card. What did not run is the sentence the pull request is about ("the device is on the default card and another has more memory of it"), because the sentence is false on this machine.

What I could not test

  • The hybrid case: needs a laptop whose default adapter is the smaller one. A suggestion, if the author wants one: the comparison can be exercised as a pure function over (vendor, memory) pairs, the way #3049 and #2823 were fixed tonight — the integrated(desc) predicate became testable the same way.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7363047954 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/3141#issuecomment-7363047954). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-12-03T00:18:55Z. --- ## VERIFY-3141 — Windows nativo: **corrió en una máquina con dos adaptadores**, y el control mostró qué mitad prueba aquí | | | |---|---| | Own commit | `5a9047ba3` — `host.rs`, +199/−2 | **Ran at the head, with the two-adapter test forced on** (`#[ignore]`d because it needs a card — this machine has an RTX 4090 **and** an integrated Radeon): ``` cargo test -p leonida-gpu --lib the_default_card -- --ignored host::bigger_card_tests::the_default_card_is_named_beside_a_bigger_one_and_the_biggest_never_is ... ok ``` **And the control, which did not bite, and the reason is the finding**: I stubbed `bigger_card_than` to return `None` always — **and the test still passed.** **Because the test's first half is `if let Some(...) = bigger_card_than(&default)`, and on this machine Windows' default device *is* the biggest card** (the 4090, beside the iGPU) — **so the "a bigger one exists beside it" branch is skipped entirely, and the rest (`the biggest is never told it is small`) is satisfied by a function that never says anything.** **So: the test passes here, and what it actually proves here is the negative half.** **The half that needs a default card *smaller* than another** — the hybrid-laptop shape, where the iGPU is the default and the dGPU holds more — **is not exercised on a desktop**, **and my stub is invisible to it.** **What I can say**: the code **compiles, creates a device, enumerates adapters, finds the biggest, and `card_of` names it with a vendor id and DXGI's memory** — **all of that ran, on real DXGI, on this card.** **What did not run is the sentence the pull request is about** (`"the device is on the default card and another has more memory of it"`), **because the sentence is false on this machine.** ## What I could not test - **The hybrid case**: needs a laptop whose default adapter is the smaller one. **A suggestion, if the author wants one**: the comparison can be exercised as a pure function over `(vendor, memory)` pairs, **the way `#3049` and `#2823` were fixed tonight — the `integrated(desc)` predicate became testable the same way.** Written with an AI assistant.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3141:upstream-pr/3141'
git switch 'upstream-pr/3141'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3141'
git switch 'upstream-pr/3141'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3141'
git switch 'upstream-pr/3141'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3141'
git switch 'main'
git merge --squash 'upstream-pr/3141'
git switch 'main'
git merge --ff-only 'upstream-pr/3141'
git switch 'main'
git merge 'upstream-pr/3141'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
ProjectLeonida/mandy!3141
No description provided.