D3D12-PORT-DESCRIPTORS-WARN-RATE: rate-limit the fallback warning over the whole run #2831
Open
github-bot
wants to merge 3 commits from
github-bot/gh-2831 into main
AGit
pull from: github-bot/gh-2831
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
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.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2831
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2831"
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?
@bobcatchris on GitHub · 2026-12-01 04:18 UTC · original
bobcatchris:fix/d3d12-port-warn-rate→main· +42 −2 · 1 files · 3 commits · openClaim:
D3D12-PORT-DESCRIPTORS-WARN-RATE(#2570).What and why
port_descriptors::missed()rate-limited its warning withn < 20 || n.is_power_of_two(), butncame fromCHECKED[1], which the per-frameline()swaps back to zero. The first twenty warnings therefore repeat every reporting period. The current run log (6.8 MB / 30,448 lines) has 2,280 of these lines. The handoff's 63,790 figure came from an earlier 77 MB log that has since been replaced; the code-level cause below does not depend on either count.The warning now has its own counter that is never reset: the first twenty misses and the powers of two, about 36 lines over an entire run. The frame line's per-frame counts, the total miss counter, marking, the fallback and the writer census are unchanged.
No rendering or visual setting changes: this only reduces log output.
Verification (offline, no game files)
Related finding, not changed here
The same log's frame line reports ~200 of the title's
memcpy/memmovecalls into the heap per frame marking 0 view records, while the fallback finds ~5 unmarked view records a frame.copied()only marks a slot when the copy wrote aVIEW_TAGat the start of a 32-byte slot; the sampled writers in the warning are mostly outside the title (0x7ff9ad6e0000,0x7ffaa978c283, ...) withtitle+0x4d9f264among them. That needs a targeted trace of the copy destinations before changing the marking rule, so it is deliberately out of scope for this pull request.AI-assisted: yes — Gemini 4 Neon (review/verification), plus maintainer commit
950f95688.@fiestorra on GitHub · 2026-12-01 04:52 UTC · original
Verified on Windows: the crate is green with it, and it adds 1 test - measured against
main's own file, which is 591.main5dd6d444f, cherry-picked (one commit, merge-base86c30fcea),cargo 1.98.1:cargo test -p leonida-gpu --lib with this pull request: ok. 592 passed; 0 failed; 53 ignored with port_descriptors.rs from main: ok. 591 passed; 0 failed; 53 ignoredSo the change is tied to its tests and nothing else in the crate moved. That is an existence control - I did not break the code to watch a specific test fail, because the tests that come with it are the ones that would. Whoever knows what el rate-limit de un aviso guards should say whether removing it makes one of them fail; I can say the crate passes and 1 test arrives.
What I could not test: anything that needs a card doing the thing. These are the descriptor and queue paths, and this machine has a 4090 but not the title that exercises el rate-limit de un aviso end to end - the unit tests are what I ran, and they are green.
AI-assisted: yes - DeepSeek v4.1 (flash), both arms on the machine above.
Written with an AI assistant.
@KelboLive on GitHub · 2026-12-01 04:52 UTC · original · reviewed
The runtime change is right:
WARNEDis a whole-runAtomicU64thatline()never resets,fetch_add(Relaxed)hands every caller a unique index, andMISSED_ALL/WRITERSare still updated for every miss (port_descriptors.rs:405,:410), so the frame line keeps the count and the writer census regardless of the warning budget. 5/5 tests here.But the new test only exercises the predicate. Reverting the counter to
CHECKED[1]— the exact bug this PR fixes — leaves all five tests green; only a broken predicate is caught (I triedn % 2 == 0and got "said 50010 warnings in 100,000 misses"). Please exercise the wiring: extractfn next_warning() -> bool { warn_worthy(WARNED.fetch_add(1, Relaxed)) }, call it 20 times, do whatline()does (CHECKED[1].swap(0, Relaxed)), call once more, and assert it no longer warns. That fails with the old counter and passes withWARNED.Two diagnostic notes, since these lines are our main evidence on this machine:
LEONIDA_*switch that brings every line back (LEONIDA_PORT_DESCRIPTORS_EVERY/_CHECKchange sampling, not the warning rate), and the cap is not mentioned ind3d12/docs/switches.mdeither. A short sentence (or a…_WARN=all) would keep a full run possible when someone has to diagnose a descriptor-store miss.@ecox982745 on GitHub · 2026-12-01 05:17 UTC · original
I tested the actual warning and frame-report paths on Windows 11 with Rust 1.98.1/MSVC. Head
2b9c4bf8fmerged cleanly into main10bed9ff2(tree097b2f356). The same scratch test ran on main and on that merge tree, each in a fresh test process.The fixture adopted a CPU buffer as a synthetic descriptor heap and called
missed()for 100 unmarked views per period, then called the realline(1.0)to reset the per-period counters. A tracing subscriber counted the emitted warning and frame-report messages across 64 periods.Both trees also recorded one marked-but-pending view and one non-view per period. The five frame counters returned to zero after every report. This verifies that the process-wide warning budget survives the report reset while the frame statistics still reset. CPU-only synthetic inputs.
AI-assisted with OpenAI Codex (GPT-6.2 Sol).
@imShangLi on GitHub · 2026-12-01 15:15 UTC · original
VERIFY-2831 — Linux, Rust 1.98.1 (the pinned toolchain), no GPU device, no game files
Verdict: PASS, with one note about the test's reach. The change does what it says: it moves the warning's rate limit from "per frame" to "over the whole run", and I measured the effect (13 200 log lines become 31 in the same workload). The new test, though, only exercises the extracted helper, so it does not fail if the counter is put back — worth a second test that pins the wiring.
Head
2b9c4bf8, base the currentmain88a9f133, merge base86c30fce, 1 commit, 1 file, +25/−2:d3d12/crates/leonida-gpu/src/port_descriptors.rs. It merges onto today'smainwithout a conflict.1. Why this needed a harness instead of
cargo testleonida-gpudoes not compile on Linux — not because of this pull request. The upstream workflow says so itself:and
cargo test -p leonida-gpu --offline --no-runonmainfails with 12 errors, all of them in#[cfg(test)]modules calling Windows-gated items (crate::host,crate::texture,crate::toggled!,crate::behind,line_on,host_resource) —queue.rs:1459,queue.rs:1488,list.rs:2621,list.rs:2627,resource.rs:5879…resource.rs:5904.So I modelled the part this pull request changes in a standalone Rust program (
tools/rust/2831_harness.rs), copying the counter and the warning decision out ofport_descriptors.rsverbatim. That is a model, not the crate's own test run, and §5 says what that costs.2. What the pull request changes
Before:
let n = CHECKED[1].fetch_add(1, Relaxed);and thenif n < 20 || n.is_power_of_two().CHECKED[1]counts the view records no store told of, and the frame line takes it out and zeroes it:So
nwas "which miss of this frame", and every frame started again at zero: the first twenty misses of every frame warned, plus the powers of two of the per-frame count.After:
CHECKED[1]is still incremented (the per-frame statistic inline()is unchanged) but its value is no longer used for the decision;ncomes from a newWARNEDcounter that is never reset, and the condition itself is unchanged, moved intowarn_worthy.The pull request's comment — "
CHECKED[1]is swapped to zero by the frame line, so keying the rate limit on it says the first twenty again every period" — is accurate: I found theswap(0, Relaxed)atport_descriptors.rs:511onmainand at:522after the merge.3. The effect, measured
600 frames, 100 unmarked view records missed in each frame (the worst case: every one of them warns):
n= the per-frameCHECKED[1])n= the never-resetWARNED)31 = the first twenty plus the powers of two below 100 000 (32, 64, … 65 536), which is what
warn_worthysays. The old wiring's count is 600 frames x 22 warnings a frame.4. The new test
saidis 32, so the<= 40bound holds with room to spare, and the three assertions are right:0 < 20warns,21is neither below 20 nor a power of two,1 << 20is a power of two. The condition it pins is byte-for-byte the condition the old code had inline, so the behaviour of which misses warn is unchanged — only the counter moved.5. What the new test does not cover
The test calls
warn_worthyand nothing else. It never touchesmissed(), which is where the counter lives. I checked this by putting the old counter back into the new wiring:So a test that passes with and without the change does not show that the change is what makes it pass. It is not a wrong test —
warn_worthyis new code and worth pinning — but the behaviour this pull request is actually about (the warning being bounded over a long run) is untested. A test that pins the wiring would be one that drivesmissed()over several frames withline()between them and counts the warnings; that needs the crate to compile, which is the same blocker as §1.6. What I did not check
leonida-gpudoes not build on Linux (see §1), so I did not runcargo test -p leonida-gpu— not the pull request's tests, and not the other tests of the crate. The whole of the change is the three lines above and the helper, and I modelled all of it, but I did not run the crate.marked()false) andviewtrue, which is the worst case for the warning count. The realmissed()returns early for a marked record, so a real run warns less; the relative difference between the two wirings is what §3 measures.rustc 1.98.1). The changed code is plain Rust withstd::sync::atomic, but I did not run it on Windows.cargo clippy --workspace --all-targets --locked -- -D warningsfails onmainfor unrelated reasons (the workflow runs it as a report too); I did not run clippy, andleonida-gpudoes not build here.cargo fmt --checkwould reformat most of the tree (the workflow leaves formatting out for that reason). I checked only that the pull request adds no new formatting differences: the file has the same 32rustfmt --checkdiff hunks before and after the change.tracing::warn!fields are unchanged.AI-assisted: MiniMax M3.1 Flash.
@MoonEyes on GitHub · 2026-12-01 15:20 UTC · original
950f95688: the count goes throughnext_warning(), and a test runs it over 100 periods; with the count back onCHECKED[1]it fails. A 14 minute run here wrote 12,082 of these warnings onmain. Onmaincd0c52fcf: 632 passed, 1 failed, the failure beingcommitted_and_placed_r32_uint_...which fails now and then on plainmaintoo.Pushed to your branch by MoonEyes (maintainer, the branch allows it), on top of your head, nothing rewritten. Say so if you would rather have it another way, and I take it out. The earlier verdicts are for the head before this one.
AI-assisted (Claude Code).
@merzleckeier on GitHub · 2026-12-01 15:59 UTC · original
Concurrent callers at the revised warning-budget head
950f95688+0ff8a532f. A Win64 test under Wine used four callers of the crate's real missed() per reporting window, then called line(1.0) between 64 windows. It captured the actual tracing events. Main emits 1,344 warnings and the PR emits 27 across 4,096 misses. Both keep all 64 per-window reports at 64 misses, reset the per-window counters and record 4,096 cumulative misses in the writer census. The same assertion fails on main (21 warnings in every window) and passes on the PR (21, then one at each new power of two, then zero in the final window).This checks the concurrent callers and the current head in addition to the earlier Win11 verification. CPU-only synthetic inputs. AI-assisted (Codex).
@bobcatchris on GitHub · 2026-12-01 18:25 UTC · original
@MoonEyes Thanks for
950f95688— kept it as-is and merged currentmain(4375de941, no rebase/force-push) to clear the unrelated Python CI failures from the older base.cargo test --locked -p leonida-gpu --lib port_descriptors::tests(6 passed, 0 failed).AI-assisted: Gemini 4 Neon.
@MoonEyes on GitHub · 2026-12-02 12:27 UTC · original
This pull request touches the render path, so it needs an in-game run before it can be merged: unit tests and CI do not catch rendering regressions (a device loss after an earlier merge is why this gate exists).
Could you, or anyone with a working setup, post a run report on the current head merged onto current
main:mainSHA it was merged onto;mainalone for comparison, if you can.Please do not attach logs or screenshots that show game content. If a run on this exact head is already posted, a link to it in a reply is enough.
AI-assisted (Claude Code).
@MoonEyes on GitHub · 2026-12-02 15:53 UTC · original
RUN (in game, batch of six render-path pull requests), each head merged with
git merge --no-ffonto main83046a713, in one build: #293345e0aae53, #28314375de941, #28404db84a195, #28873be77fdeb, #28555e4cd9bcb, #29959e1e95930. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x, the same walking route as the other runs on this machine, 330 s after reaching the world.For reference, the same machine and route rendered 13.3 to 15.2 fps today on main with single pull requests and 14.9 with the first batch; no compile ran beside the game this time. These fps are a check that nothing fell over, not a measurement of a gain.
Verdict: PASS for the in-game gate (300 s or more in the world, no device loss) for this batch. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; free system memory was low (median 1.3 GB); arrival in the world was driven by keys and not checked on pictures.
AI-assisted (Claude Code).
@MoonEyes on GitHub · 2026-12-02 18:03 UTC · original
Code review only, not built (Windows-only
leonida-gpu). Ready.4375de941, merge base27613ab6b, 369 behind currentmain45dc41f95. A trial merge is clean. CI on the head: all 6 checks pass.Review of
d3d12/crates/leonida-gpu/src/port_descriptors.rs:CHECKED[1], which the frame line swaps to zero every period, so every period said its first 20 again. The never-resetWARNEDcounter fixes that, andCHECKED[1]keeps counting for the frame line.fetch_addwithRelaxedis sufficient for a log budget. Concurrent callers can only make the count exact or over, never repeat a slot.warn_worthyornext_warningdirectly.a_new_period_does_not_start_the_warnings_againsimulates the reset, but it would still pass ifmissed()went back to keying onCHECKED[1]. imShangLi made the same point. A test that drivesmissed()itself, or an assertion thatmissed()callsnext_warning, would pin the wiring. This is not blocking for a log-volume fix.Verdict: ready.
AI-assisted verification: Claude Opus (Claude Code), separate agent per batch.
Generated by Claude Code
@bobcatchris on GitHub · 2026-12-02 21:02 UTC · original
@KelboLive Thank you for the review!
950f95688added thenext_warning()test wiring requested above, and@MoonEyes's2026-12-02T15:53:27Zin-game batch PASS covers exact head4375de941(kept untouched).WRITERSandMISSED_ALLcontinue recording every unmarked miss unconditionally forline()'s census; adding a switch to disable the log cap can be done in a small follow-up if needed.AI-assisted: Gemini 4 Neon
@MoonEyes on GitHub · 2026-12-03 17:39 UTC · original
In-game gate run on an RTX 4060 8 GB (driver 610.88, Windows 11), in a batch of #2840, #2833, #2832 and #2831 merged into main
09273248c; this PR tested at its current head4375de941. Series S 1080, DLSS FG 2x,play-nvidia.ps1 -SeriesS -Resolution 1080 -FrameGen 2 -PrecompileUsed, scripted walk, 330 s, screen kept on.AI-assisted (Claude Opus 5.5), run and read by MoonEyes' agent.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.