d3d12: background shader work off by default on NVIDIA with Developer Mode (D3D12-BACKGROUND-OFF-NVIDIA) #3437
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
2 participants
Due date
No due date set.
Reference
leonida/mandy!3437
Loading…
Reference in a new issue
No description provided.
Delete branch "oreofr/background-off-nvidia"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as D3D12-BACKGROUND-OFF-NVIDIA. Validated with conditions by MoonEyes.
Depends on: #3301 (it changes the same lines; this branch merges its head
810d3c6a2and resolves itsCargo.tomlconflict withmain)Refs #2821
What and why
The driver's background shader work ("D3D Background Threads",
ID3D12Device6::SetBackgroundProcessingMode(DISABLE_BACKGROUND_WORK, KEEP_ALL)) was switched off only withLEONIDA_D3D12_BACKGROUND=0. On NVIDIA that switch stopped theDXGI_ERROR_DEVICE_REMOVED(0x887A0005) losses of #2821. This makes it the default there, under MoonEyes' conditions:LEONIDA_D3D12_BACKGROUND01developer_mode()readsAllowDevelopmentWithoutDevLicenseunderHKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock(RegGetValueW, read only, throughtdr::machine_dword, the reader the TDR log already used). It is read only for an NVIDIA adapter with the variable unset.ID3D12Device6or a driver refusal; the decision stays a pure function (background_work(setting, vendor, developer_mode)) that unit tests cover entirely; and no call is made on a PC where it is known to be refused. The call's result is still logged (from #3301):ok=true, or a warning with the HRESULT if the registry says on and the runtime refuses anyway.LEONIDA_D3D12_BACKGROUND=1silences it.EnumAdapterByLuid(device.GetAdapterLuid()), the lookupHost::adapteralready did, moved up a few lines), so it is right with-Adapter, the default adapter and WARP.d3d12/docs/switches.md(regenerated) and a newd3d12/docs/findings.mdsection.Evidence (#2821; details and links in
findings.md)=0on NVIDIA: about 14 runs on 5 PCs, 0 losses (RTX 4060 Laptop: 5 losses in 6 runs without it, 3 runs of 30-45 min with it; RTX 4080 SUPER: 3 of 3 without, 0 in 1 with (n=1); RTX 4070: 0 in 2 runs of 33 min and 1 h 36 min; RTX 3070: 5 of 6 without, 0 in 2 with (n=2); RTX 4080).findings.md, "Frame-rate switches measured on a six-core PC") was slower with the work off (118.6 against about 80 ms, n=1, many runtime changes ago).=1gives the work back where it costs frames.Tested
host::tests):background_work_is_off_by_default_on_nvidia_with_developer_modecovers the vendor (NVIDIA, AMD, Intel, WARP, unknown) x Developer Mode (on, off) x variable (unset,0,1, other) table, and that0/1/other vendors never read Developer Mode. Red/green: with the old default (unset keeps the work) it fails (left: KeptWithoutDeveloperMode, right: DisableByDefault), with the change it passes. #3301's log test is extended to the new decisions (advice line,default on NVIDIAreason, failure warnings).cargo test --locked -p leonida-gpu: 735 passed, 0 failed (59 ignored).cargo clippy --locked -p leonida-gpu --all-targets: no warning.cargo build --locked --profile diag -p leonida --features diagnostics,dlss,mimalloc: builds (the oneleonida-gpuwarning,book.rs:247, is onmaintoo).python -I tests/test_d3d12_switches.py: 22 OK;python -I scripts/check_no_game_data.pyon the changed files: clean.GPUs tested: NVIDIA GeForce RTX 4070 Laptop GPU, Windows 11 Pro, Developer Mode off (unit tests and build only).
Follow-up (not in this pull request)
AI-assisted: Claude Code (Claude Opus 5.5).
Checklist
main(plus #3301) and merges cleanly.🤖 Generated with Claude Code
Gate run on an RTX 3090 (NVIDIA 621.40, Windows 11 Pro build 26300, Developer Mode on), head
d96dbaaa9(which contains #3301) merged intomain04a838fc4without conflict, diag profile withdiagnostics,dlss,mimalloc, msvc target. Run withLEONIDA_D3D12_BACKGROUNDunset. Reference:main04a838fc4built the same way. Series X output 2560x1440, DLSS quality, no frame generation, 300 s standing at the save, fresh data.ok=trueand the reason (NVIDIA, Developer Mode on) in the line itself. No variable was needed.mainthe same sampler had seen 4 of them in an earlier run.main; median frame 27.66 against 28.69 ms, p99 42.2 against 45.5 ms. Other processes used about 7 points less CPU in this run than in the reference, so read this as "no cost", not as a gain. Pauses as in the reference (the loading one, then a few of 1.3-3.4 s right after reaching the world), none after 150 s.main.Verdict: PASS. On a PC with Developer Mode on, the background work is off by default, logged clearly, and costs nothing here.
GPUs tested: NVIDIA GeForce RTX 3090, driver 621.40.
AI-assisted: run and report by Claude Code (Claude Opus 5.5).
30a851050into #3437 (tree tested by local CI) e6fdc8c401Merged by OreoFR (agent) at MoonEyes' request. His judge accepted it with no blocking or medium point. The one useful minor point was fixed in
d96dbaaa9: Developer Mode forced by a group policy now counts too.enlighted ran it in game on an RTX 3090 with Developer Mode on and no variable, 300 s:
ok=true;Local CI (normal mode,
--trust-pr-code) on headd96dbaaa9merged into main30a851050: PASS.--trust-pr-codewas used after reading the change: atracing-subscriberdev-dependency from the workspace, with one line inCargo.lockand no new crate.make_game.py --help, Rust tests 845 s, Rust replay test 77 s, Rust build as shipped 86 s, standard-library Python tests 603 s.The forge refused the merge while the head was behind main.
main(30a851050) was merged into the head ase6fdc8c40, with the same tree the CI tested. Merged as6b5ceb934.This brings #3301 (head
810d3c6a2) into main with its conflict resolved, as MoonEyes asked. #3301 is closed with a link here.Not run on the RTX 4070 Laptop: Developer Mode is off there, so only the "kept, with the log line" path would run.