Repository navigation
D3D12-WARM-AMD-SINGLE-PROCESS: default leonida warm to one process on AMD - #2830
bobcatchris wants to merge 1 commit into
Conversation
Default `leonida warm` to one compiler process when the DXGI adapter reports vendor 0x1002, unless --jobs is passed explicitly. On an RX 7900 XTX the old two-thirds-of-cores default started ten amdxc64.dll compiler processes; the driver refused most PSOs and crashed with 0xc0000005. A single process made 1,845 of 1,845 pipelines with no crashes. Other vendors keep the old default. The vendor is read from DXGI without making a device, and LEONIDA_ADAPTER is honoured as it is for the host device. Two unit tests pin the pure default helper; no game files or shader data are involved. AI-assisted: yes
07c45c2 to
c6fc64b
Compare
|
Independent Windows CLI verification. Head Each invocation used
The NVIDIA and no-adapter defaults used 16 logical cores. Both explicit cases were configured to fail if the new vendor lookup was called. All five invocations exited successfully with zero pipelines to compile. Actual DXGI selection and AMD compiler stability remain hardware checks. AI-assisted with OpenAI Codex (GPT-6.2 Sol). |
KelboLive
left a comment
There was a problem hiding this comment.
On this NVIDIA box the new path is inert, which is the first thing to want: adapter_vendor_id() returns 0x10de and default_jobs(Some(0x10de), 32) is 21 (two thirds of 32) — the same as before — while --jobs still wins and never queries DXGI when passed. warm::tests is 2/2, flipping the vendor comparison fails both, and d3d12_switches.py --check, check_no_game_data and git diff --check are clean. Shaders' "every logical core" and LEONIDA_PIPELINE_WORKERS are untouched, so the shader-translation process count does not change — only how many warm processes run.
The risk I would write down, because I could not observe AMD here: the helper takes the first non-software EnumAdapters1 adapter (host.rs:1431), while create passes NULL to D3D12CreateDevice and lets Windows choose. On an Intel-iGPU + AMD-dGPU hybrid those can disagree — an OS per-app preference, or the iGPU enumerated first — and then warm picks two thirds of the cores while the runtime device is AMD, which is exactly the compiler-concurrency problem this default exists to avoid. LEONIDA_ADAPTER is the only way to align them today; the DXGI selection has no test (only default_jobs does). A sentence in the doc/comment about LEONIDA_ADAPTER would be cheap; a helper that takes the adapter list by injection would let the selection be tested.
Nit: with LEONIDA_ADAPTER set, the warm query calls chosen_adapter, which logs "host device on the card …" before any device exists, and then the device logs the same line again.
VERIFY-2830 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game filesVerdict: PASS. The repository's own red/green idea holds under Wine: the new test fails on the merge base and passes with the pull request, and nothing that worked before is broken. Head 1. What it changesAMD's driver compiler refuses most pipelines when several processes ask it at once, and faults ( fn default_jobs(vendor: Option<u32>, cores: usize) -> usize {
if vendor == Some(AMD) { 1 } else { (cores * 2 / 3).max(1) }
}and the vendor id comes from a plain DXGI enumeration that makes no device: /// PCI vendor ID of the adapter a run would use, without making a device.
/// `None` when no hardware adapter answers; callers then keep their old
/// behaviour. `LEONIDA_ADAPTER` is honoured, as it is for the device in [`create`],
/// otherwise the first hardware adapter Windows would pick.
pub fn adapter_vendor_id() -> Option<u32> { ... }The enumeration skips software adapters ( 2. What I checked
3. Red and green, run under Wine
4. What I did not check
AI-assisted: MiniMax M3.1 Flash. |
Claim:
D3D12-WARM-AMD-SINGLE-PROCESS(#2570 (comment)).What and why
leonida warmdefaulted to two thirds of the logical cores. On an RX 7900 XTX that starts tenamdxc64.dllcompiler processes; the driver silently refuses most PSOs and ends some processes with0xc0000005. The same machine warmed 1,845 of 1,845 used pipelines with--jobs 1and zero crashes, leavingwarm-bad.txtempty.This changes the default to one process when the DXGI adapter reports vendor
0x1002.--jobsstill wins when passed explicitly, so the old behaviour remains available for A/B. Every other vendor keeps two thirds of the logical cores.The vendor is queried through DXGI without creating a device, and
LEONIDA_ADAPTERis honoured the same way the host device honours it. Two unit tests pin the pure default helper for AMD, another vendor and an unknown adapter.No rendering or visual setting changes: this only chooses how many compiler processes warm uses before a run.
Verification (offline, no game files)
The two
leonidaclippy warnings (player.rs:570and the pre-existingcount % 1000inwarm.rs) are onmainbefore this change.Hardware
Measured on AMD Ryzen 7 7800X3D, Radeon RX 7900 XTX (24 GB, driver 32.0.32029.2010), Windows 11. The compiler fault and the single-process warm are from the reporter's 48-minute log; this pull request changes only the default and was verified with the tests above, not by launching the game.
No game data, archives, shaders, textures or logs are in this change.
AI-assisted: yes.