Repository navigation
Conversation
|
RUN Verdict: Setup:
Unit test:
In-run A/B (
World phases (
With 32 hardware threads on Ryzen 9 5950X, there is ample CPU headroom for driver background threads compared to 6C/8C CPUs, so AI-assisted: Antigravity |
|
RUN (RTX 4060 8 GB, NVIDIA 610.88, Windows 11 26300, The switch never took effect here. No harm seen: no loss, no panic. But I can not confirm the effect. AI-assisted (Claude Code). |
|
I checked the actual HRESULT for the mode changes in For the native Windows question, Microsoft documents that MEASURED with offscreen synthetic devices under Wine. AI-assisted (Codex). |
KelboLive
left a comment
There was a problem hiding this comment.
The draw-counter and docs side is consistent: WORLD_DRAWS = 500.0 matches tools/game_gate.py:22 and its two-line rule, ENTER/LEAVE 2/10 × 0.5 s matches the text, the frame log stays exact (list.rs:2541-2551, no new atomic on count_draw), and 604 tests pass (the 2 diagnostics failures are the known parallel flakes, green alone).
Blocking: the mechanism is restricted to Windows Developer Mode, and the failure is silent. D3D12_BACKGROUND_PROCESSING_MODE_DISABLE_BACKGROUND_WORK is documented as requiring Developer Mode. set_mode discards the HRESULT (driver_background.rs:153-167), the caller logs only on success (:139-147) and retries every 500 ms. On a default Windows install that produces exactly the allowed=true then silence MoonEyes reported, and matches merzleckeier's E_NOTIMPL — the PR's successful allowed=false run implies a machine where it was permitted. Neither findings.md nor switches.md mentions the precondition, and play-nvidia.ps1:278 now defaults the launcher to world, so for most users the headline feature is a silent no-op that looks like it worked.
Please:
- log the first HRESULT once (with the mode and
Developer Modenamed in the message), instead of retrying into silence; - document the Developer Mode precondition in both
findings.mdandswitches.md; - hold the
worldlauncher default until a run on a non-Developer-Mode install confirms the mode actually changes — or make the default conditional on a successful probe.
Also, WORLD_DRAWS = 500.0 mirrors the gate only by comment: mutating it to 50.0 leaves all four driver_background tests green, so nothing pins the "as the game gate counts it" claim. A test that imports the number from game_gate.py (or asserts the same value) would.
Minor: driver_background.rs:11 says "~9 minutes" while findings/body say "9 to 15", and findings.md:1731 says a repeat run "has none" then that the threads stop about 45 s after the world comes up — reword that pair.
Merge is clean against current main and the merged tree still passes d3d12_switches.py --check; #2888 and #2743 conflict only in findings.md (and #2743 also switches.md).
VERIFY-2847 — Linux, Fedora 45, Rust 1.98.1 (the pinned toolchain), Wine 11.21, no GPU device, no game filesVerdict: PASS. The switch's rules are readable and the counting they need is there, the new tests pass, and nothing that worked before is broken. The measurements the pull request quotes are a claim about an NVIDIA card and the game, and I could not check them. Head 1. What it changesAfter the pipelines are made or loaded, the driver compiles their shaders again on threads of its own in this process, and until it has done so those threads take one or two processors — on a processor the title already fills, that costs the frame. The new module lets that work be switched off, or paused while the world is drawn:
2. What I checkedThe policy mapping. fn policy(variable: Option<&str>) -> Policy {
match variable.map(str::trim) {
Some("0") => Policy::Never,
Some("world") => Policy::OutsideWorld,
_ => Policy::Always,
}
}unset and The world is recognised with hysteresis. const ENTER: u32 = 2; // counts in a row of the world before it is switched off
const LEAVE: u32 = 10; // counts in a row of no world before it is allowed again
The phase wins over the policy. fn allowed(phase: Option<bool>, policy: Policy, world: bool) -> bool {
phase.unwrap_or(match policy { Policy::Always => true, Policy::Never => false, Policy::OutsideWorld => !world })
}
The counting it needs is there. 3. What the tests do here
The pull request changes no test, so the red side cannot be built (there is nothing to take); the base and the head were compared instead:
One further test, 4. What I did not check
AI-assisted: MiniMax M3.1 Flash. |
…d (LEONIDA_D3D12_BACKGROUND=world) After pipelines are made or loaded the driver compiles their shaders again on its own threads in this process until it has done so for the translations in use. Measured on an RTX 3080: those threads take one or two processors for 9 to 15 minutes of play after each change of translations, 2 to 3 ms a frame with the card's work unchanged; switched in turns of 20 s in one run, 39.6 ms median frame with the work allowed, 38.1 ms with it off. Asking the driver to finish early, or giving its threads the idle priority, did not help. LEONIDA_D3D12_BACKGROUND=world switches that work off while the world is drawn (500 draws a frame or more, as the game gate counts it) and allows it in loading screens and menus, so that it still finishes over sessions. Unset or 1 and 0 are as before; LEONIDA_AB can switch it in a run. The draw counter becomes a running total read beside the frame line's counts (take_counts keeps its own mark), and the presented-frame count is available outside diagnostics builds.
… world by default LEONIDA_D3D12_BACKGROUND=world in play-nvidia.ps1, with what was measured on an RTX 3080: with shaders the driver had never seen, 26.1 frames a second against 24.9 for the 14 minutes its threads ran with the defaults, the card's work a frame the same (29.5 and 30.5 ms). The findings and the switch list say so; the old comment that the card's cost was unknown is answered.
…in (review) Windows switches the driver's background work off only in Developer mode: the call is refused elsewhere. The thread logs the refusal once with the call's code and ends, where it asked again every half second without a word. The precondition is in the module, findings.md, switches.md and the launcher's comment. A test reads WORLD_DRAWS from tools/game_gate.py.
…gate counts it (review) `LEONIDA_D3D12_BACKGROUND=0` now goes through driver_background::start as well: the mode is set on the title's device when it is made, and a refusal is written once with its code, as for `world` and `LEONIDA_AB`. host.rs keeps one call. The world is judged on the draws the frame line counts (draw::drawn, the game gate's figure), so list.rs is back as it was; the counter keeps its own marks, tested over a long world stretch followed by a menu. The thread gets the device from start(), so the "no device yet" case is gone. The NVIDIA launcher sets `world` only where Windows is in Developer mode. findings.md no longer says the work finishes over a few sessions, and says the refusal line is unit-tested, not yet seen in a run.
…wording (review) The launcher reads AllowDevelopmentWithoutDevLicense with Registry.GetValue, which gives 0 for a missing key or value instead of throwing under Set-StrictMode. findings.md says asking once is unit-tested and the refusal line not yet seen in a run, and that world is the launcher's default where Developer mode is on.
3a9afee to
c1bf55d
Compare
|
Thanks @KelboLive, @MoonEyes, @merzleckeier. Rebased on
Tested on the RTX 3080 (driver 32.0.16.2140, Windows 11, Developer mode on): crate tests and diagnostics tests, three mutations each caught by a test, and a 300 s gate run of this code: PASS, AI-assisted (Claude Code, Claude Fable 5.2 and Claude Opus 5.5; a separate Claude Opus 5.5 agent reviewed the diff before this push). |
The launcher tests run under PowerShell on Linux too, where Microsoft.Win32.Registry throws
("Registry is not supported on this platform"). The read is now behind $IsWindows.
Claimed in the coordination issue as:
D3D12-DRIVER-BACKGROUND-PLAY(#2570 (comment))What and why
After pipelines are made or loaded, the driver compiles their shaders again on four threads of its own in this process ("D3D Background Thread"s), and keeps the result in its own cache. Until that is done for the translations in use, those threads take one or two processors. That lasts 9 to 15 minutes of play after each change of translations, and comes back after a session that ended first. On a processor the title already fills, this costs the frame while the card's own work stays the same.
LEONIDA_D3D12_BACKGROUND=worldswitches that work off while the world is drawn (500 draws a frame or more, as the game gate counts it) and allows it in loading screens and menus. The work still finishes over sessions, without taking the processors play needs.d3d12/crates/leonida-gpu/src/driver_background.rs: one place for the three ways to set the mode.0sets it on the title's device when it is made (the call that was inhost.rs);worldandLEONIDA_ABstart a thread that counts the frame line's draws (draw::drawn, the game gate's figure) every 0.5 s, with hysteresis (2 counts to enter the world, 10 to leave it). Unset or1start nothing: the driver is left as it is.worldby default where Windows is in Developer mode (below). The runtime's default is unchanged.queue::presented()is available outside diagnostics builds.findings.mdsection,switches.mdregenerated (it also picks upLEONIDA_PROMPTS_PAD, which main added without regenerating the page).Windows switches this work off only in Developer mode. Microsoft's page of
D3D12_BACKGROUND_PROCESSING_MODEsays ofDISABLE_BACKGROUND_WORK: "Available only in Developer mode." The PC measured below has it on. Elsewhere the call is refused, so0andworldchange nothing. Since the review, the thread says so once and ends: aWARNlinethe driver's background shader work stays as the driver likes, with the mode and the call's code, naming Developer mode and where to turn it on. Before, a refused call was asked again every half second without a word, which is what an RTX 4060 without Developer mode showed:allowed=trueat the start, noallowed=falsein 14 minutes of world. The precondition is written in the module,findings.md,switches.mdand the launcher's comment.The launcher sets
worldonly where Developer mode is on (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock,AllowDevelopmentWithoutDevLicense= 1, the switch of Settings, System, For developers). Elsewhere it leaves the driver as it is, so players without Developer mode see no change and no warning;-More @{LEONIDA_D3D12_BACKGROUND='world'}still asks for it, and then the log says the driver refused.worldlets the work run only in loading screens and menus. Those are short: after a 900 sworldsession the defaults' threads still ran 14 minutes, so for a player who seldom sits in menus the work may never finish. On this card that costs nothing measurable (the card's work with shaders the driver never got to: 29.5 ms a frame, against 30.4 ms with its finished ones).Measured (RTX 3080 10 GB, driver 32.0.16.2140, Windows 11 with Developer mode on, Series S settings, standing, gate runs with the driver mod and a per-thread processor sampler)
The slow phase. While the driver's threads ran: 24.4-25.2 fps, card 77 % busy, 8.2 ms a frame idle behind the submitting thread. Once they stopped: 26.4-27.2 fps, 83 %, 5.7 ms. The card's work a frame was about 31 ms in both.
A/B within one run.
LEONIDA_AB=20,LEONIDA_D3D12_BACKGROUND: 38.1 ms median frame with the work off, 39.6 ms with it allowed (3-8 ms in the phases where the threads burst to 160-235 %). The card's work was the same.Cold shaders, same data folder.
LEONIDA_LEGACY_PLAIN=1gave shader code the driver had never seen.worldfirst, then the defaults:worldShaders the driver never got to cost this card nothing measurable. The remaining gap of the
worldrun (26.1 against 27.0) is on the processor side (7.2 against 5.7 ms idle behind the submitting thread). That run was the folder's first, so its pipelines compiled in the game during its first minutes. Its gate verdict was FAIL (present_gap) for that reason, not because of the switch.Tried and dropped:
D3D12_MEASUREMENTS_ACTION_COMMIT_RESULTS_HIGH_PRIORITY): honoured within 5-9 s, but the threads went on at the same rate;Tested
On Windows 11, from
d3d12\with the pinned toolchain, rebased onmain8422def:cargo test -p leonida-gpu --locked --lib: 676 passed, 0 failed, 59 ignored. In 2 of 4 full runs one test failed,texture::alias_cast_tests::committed_and_placed_r32_uint_textures_cast_to_r9g9b9e5_under_legacy_barriers(green alone 3 of 3); on plainmain8422def the same test failed in 1 of 4 full runs, so it is not this change.cargo test -p leonida-gpu --locked --features diagnostics: 747 passed, 0 failed, 59 ignored (onmain393901a before the last rebase;mainitself: 739).driver_background::tests, 8 tests: the variable's values; the decision with and without an A/B phase; the world's hysteresis both ways;each_count_judges_only_the_frames_since_the_last(a long stretch of world then a menu); a count without frames;the_world_begins_where_the_game_gate_says(readsWORLD_DRAWSfromtools/game_gate.pyand checks one draw a frame below it is not the world);a_mode_is_asked_for_only_when_it_changes;a_refused_mode_is_reported_once_and_not_asked_again. Onmainthey do not build (the module is new).WORLD_DRAWSat 50, and with the counter's mark not moved on, at least one test fails each time.cargo clippy -p leonida-gpu --all-targets --locked: no warning in the changed files (the one warning is inhost.rscode frommain).rustfmt --config-path d3d12/rustfmt.toml --edition 2024 --checkon the module;python -I tools/d3d12_switches.py --check d3d12/docs/switches.md;python -I tests/test_win_launchers.py;python -I scripts/check_no_game_data.pyon the changed files: OK. The launcher's Developer mode read checked underSet-StrictMode -Version Latestwith the key present and missing.allowed=trueat start andallowed=false78 s later, at world entry.GPUs tested: NVIDIA GeForce RTX 3080 10 GB, driver 32.0.16.2140, Windows 11 (Developer mode on). The refused path (Developer mode off) is covered by the unit test, not by a run here.
AI-assisted: yes. Claude Code with Claude Fable 5.2 and Claude Opus 5.5; the diff was reviewed by a separate Claude Opus 5.5 agent before this push.
Checklist
mainand merges cleanly.docs/design.md(no translator change here).