d3d12-gpu: time card-copy sends, hashes, cross-copies, and compares in LEONIDA_GPU_TIMING (D3D12-GPU-TIMING-OWN-PASSES) #3323
Open
github-bot
wants to merge 3 commits from
github-bot/gh-3323 into main
AGit
pull from: github-bot/gh-3323
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!3323
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3323"
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?
@lixonik on GitHub · 2026-12-03 11:06 UTC · original
lixonik:d3d12/gpu-timing-own-passes→main· +334 −102 · 4 files · 3 commits · openClaimed in the coordination issue as: D3D12-GPU-TIMING-OWN-PASSES
What and why
Addresses the GPU timing gap noted in #3311 ("What the timing does not see"): the ~770+ per-frame card-copy hash and compare passes (
Host::card_beforeand post-submissionrecord_compare_passes) previously carried no timestamps underLEONIDA_GPU_TIMING=1,LEONIDA_OWN_STAMPS=1lumped sends and hash passes into a singleKind::Sendspair,ownstamps::linewas unreachable whenlate()was false (including underLEONIDA_GPU_TIMING=1orLEONIDA_RELAY=0), andPendingCompare::recordunderLEONIDA_COMPARE_ON_SENDER=1took no timestamps at all.Changes:
d3d12/crates/leonida-gpu/src/host/ownstamps.rs:Kindinto four distinct phases (Sends,Hash,Cross,Compare) and track pass counts alongside list counts and GPU microseconds.ownstampsunderLEONIDA_GPU_TIMING=1indiagnosticsbuilds and feed each completed phase intocopystat::command_took_manyunderown [card sends],own [card hash],own [card cross], andown [card compare].reserve/mark_begin/mark_end(zeroing the readback slot on reserve and bumpingPAIRSto8192) soPendingCompare::recordonleonida-sendis timed cleanly too.ownstamps::lineemission soLEONIDA_GPU_TIMING=1without card buffers does not log all-zero lines.d3d12/crates/leonida-gpu/src/host.rs:Sends(copies + barrier, only whenhas_sends) andHash(CARD_COMPAREmode 0, only whentotal_hash_passes > 0) separately inHost::card_before.reserve/mark_begin/mark_endthroughPendingCompareand moveownstamps::line(frames)fromlate_lineintoMeter::linesso it runs in both asynchronous and synchronous (LEONIDA_GPU_TIMING=1,LEONIDA_RELAY=0) modes.d3d12/crates/leonida-gpu/src/copystat.rs:command_took_many(op, count, us)(delegatingcommand_tookto it) so batched passes report accurate per-frame pass counts and total/max microseconds in theLEONIDA_GPU_TIMINGsummary.d3d12/docs/switches.md: regenerated withpython -I tools/d3d12_switches.py --out d3d12/docs/switches.md.Tested
python -I scripts/check_no_game_data.py-- PASSpython -I tools/d3d12_switches.py --check d3d12/docs/switches.md-- PASSpython -I tests/test_d3d12_switches.py-- 20/20 OKcargo test -p leonida-gpu --lib --locked ownstamps::(default features) -- 2/2 PASS (ticks_to_us_rejects_unwritten_or_backwards_pairs,own_timing_ops_cover_all_four_phases)cargo test -p leonida-gpu --lib --features diagnostics --locked ownstamps::-- 3/3 PASS (includingcommand_took_many_sums_passes_and_keeps_all_four_own_keys_distinct)cargo build --profile diag --features "diagnostics,dlss,mimalloc" --locked-- PASSLEONIDA_GPU_TIMING=1+LEONIDA_D3D12_DRED=1measurement (90 s in world, Series S, DLSS, no FG, 0 errors / 0 device lost):indirect13.0 ms in ~4,760,dispatch9.4 ms in ~3,210,mesh3.1-3.2 ms in 349,own1.2 ms in ~850 (4.3%)):own [card compare]: 0.68-0.70 ms/frame in 439-444 passes (longest batch 0.34-0.43 ms)own [card hash]: 0.26-0.27 ms/frame in 383-385 passes (longest batch 0.04 ms)own [card sends]: 0.24 ms/frame in 25 lists (longest batch 0.06 ms)LEONIDA_GPU_TIMING=1comes from synchronous per-list submission/wait overhead rather than compare/hash compute cost.LEONIDA_OWN_STAMPS=1,LEONIDA_COMPARE_ON_SENDER=1, Series S, DLSS, no FG, 315 s in world, 437.6 s total, 64 world samples, max 5,312 draws):3000-4999draws bucket: 24.7 fps across 57 samples)LEONIDA_OWN_STAMPSsteady-state output (withLEONIDA_COMPARE_ON_SENDER=1active):sends 0.58-0.67 ms(8.0 lists),hash passes 0.07 ms(133-136 passes / 7.9 lists),copies between copies 0.01 ms(2.4-2.7 lists),compares behind submissions 0.52-0.53 ms(435-444 passes / 14.5 lists) -- ~1.21 ms/frame total.GPUs tested: NVIDIA GeForce RTX 5070 12 GB, Windows 10 x64 (native).
AI-assisted: yes. Author: Antigravity (Gemini 4 Neon). Reviewer: separate read-only Pro reviewer subagent (two passes; caught
ownstamps::linebeing skipped whenlate()is false underLEONIDA_GPU_TIMING=1and empty-Sendsstamping, then approved).Checklist
mainand merges cleanly.CONTRIBUTING.md), including in logs or reports quoted here.docs/design.md, with how it was confirmed. (n/a)@merzleckeier on GitHub · 2026-12-03 11:12 UTC · original
Review of
1dbec378on6e979905. The catalog check, 20 catalog tests, and all three existingownstampstests passed. I also ran a synthetic D3D12 query/readback on AMD RADV through Wine/vkd3d-proton.command_took_manyputs the entire interval into the maximum field. My 112 µs synthetic interval with a batch count of seven was recorded as(7, 112, 112). The report presents that maximum next to the command count as “the longest”. For the newownkeys that value is the longest batch, so it cannot identify the longest individual hash or compare pass. Please label it explicitly in the per-key report.ownstamps::reserve, the modulo counter clears a pair before checking whether its previous owner has collected it. In the synthetic test I completed a real query, left its result unread, and reserved a full turn of pairs. The next reservation zeroed the first sample, so the subsequent read silently skipped it. This exercises the allocator directly. The default 256-list limit stays well below 8,192 pairs, butLEONIDA_LATE_WAIT_LISTSaccepts larger values. Could the allocator skip an occupied pair and release it at retirement, or could the submission path enforce a bound covering all live stamps?AI-assisted with OpenAI Codex.
@lixonik on GitHub · 2026-12-03 11:21 UTC · original
@merzleckeier Thanks for the thorough review and the synthetic RADV query/readback test! Both points are addressed in
0c836e32e:copystat.rs):COMMANDS_BY_WORKnow tracksbatched: bool(falseforcommand_took,trueforcommand_took_many), so batchedown [card ...]entries logthe longest batch {:.2} mswhile individual commands keepthe longest {:.2} ms.host/ownstamps.rs,host.rs): added an atomicIN_USE: [AtomicBool; PAIRS]table.claim_slotskips occupied slots and returnsNonewhen all8192pairs are in flight instead of zeroing/clobbering an unread slot;ownstamps::read(&mut Vec<Stamp>)drains and releases each slot (Ordering::Release) afterread_volatile(), andCardPlan::dropreleases any unread stamps as a safety net.cargo test -p leonida-gpu --lib --locked ownstamps::(3/3 PASS) and--features diagnostics(4/4 PASS, includingclaim_slot_skips_occupied_pairs_and_returns_none_when_fulland verifyingbatchedfor bothcommand_took_manyandcommand_took); separate read-only Pro reviewer approved.AI-assisted: yes (Antigravity -- Gemini 4 Neon; Pro reviewer subagent).
@merzleckeier on GitHub · 2026-12-03 11:24 UTC · original
Re-tested
0c836e32eon AMD RADV through Wine/vkd3d-proton. The real GPU sample survived a full timestamp ring. Reservation returnedNoneat capacity, the 112 µs batch was counted after readback, and the same slot could then be claimed and cleared for reuse. All four existingownstampstests and the added local GPU probe passed. The report now explicitly labels the batch maximum. This resolves both of my review points.AI-assisted with OpenAI Codex.
@MoonEyes on GitHub · 2026-12-03 12:46 UTC · original
RUN (in game, third party, batch of four pull requests), each head merged with
git merge --no-ffonto main6e9799050, in one build: #26424b4d99a82, #31518894c5812, #33230c836e32e, #332402f37bcf8. RTX 4060 8 GB, driver 610.88, Windows 11. Series S,-Resolution 1080, frame generation 2x,-PrecompileUsed, 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 17.4 fps on other runs in the last day: 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, on the heads listed above. If one of these pull requests changes its head, this run no longer covers it.
Limits: one run; arrival in the world was driven by keys and not checked on pictures. The precompile before the world took 529 s, against about 110 s for main alone: the translator change in #3324 left the pipeline cache cold. Switches that are off by default (for example #3323's own-pass timing) were not turned on: this run covers their default path only. #2642 targets Wine and was run on Windows only. #3151 changes what happens on a lost device; no device was lost, so that path was not exercised.
AI-assisted (Claude Code, Claude Opus 5.5).
@EdenBendheim on GitHub · 2026-12-03 12:54 UTC · original
RUN (RTX 3090 24 GB) — both instrumented 300 s gates PASS, including the sender and per-command batch telemetry.
0c836e32e290062f5fdf7adb9b1c9d63a456ecd5merged locally onto mainb053a1813c8980c4357d51bbe6e69a35dc8c476c, merge4c271d26872546ee9b6176f0b5cae900d96e7bdf. Exe SHA-256e950ca622d9029835fcf204e02281ea5ca3ba8007eb928470d36cc990b4f51d8; diagnostics,dlss,mimalloc.The sender arm had 197 sender reports, median 18.2 sends/frame, 4.96 ms working, 0.70 ms waiting. Synchronous command table recorded 44 entries per send/hash/compare phase in the measured window, all labeled longest batch; medians of longest batch 0.915/0.070/0.250 ms (maxima 2.15/0.73/1.81 ms). Cross and sender table entries absent in this synchronous recipe as expected. No malformed own rows.
Both gates passed and saved cache; sender had a suspend-late warning. Native placement in sender held for 12 marks, 120.218 s after the first stable mark; synchronous run rendered in-world but control/placement was not established. Different instrumentation/workloads/locations, no matched performance attribution. Live ring occupancy/reuse and separate identification of each sender-recorded compare were not measured.
Targeted ownstamps tests: 3/3 default, 4/4 diagnostics; switch checks 21/21, clean-room/diff/catalog passed. Capacity/reuse covered synthetically. AI-assisted: Codex GPT-6.2 Sol (tester and independent numeric check). No game content attached.
@lixonik on GitHub · 2026-12-03 14:39 UTC · original
Merged
origin/main(128579e9e) into22517bbaeto resolve thed3d12/docs/switches.mdconflict (#3318/#3293/#3333) and regeneratedd3d12/docs/switches.md.There are zero Rust code changes vs
0c836e32e(same4 files changed, 334 insertions(+), 102 deletions(-)diff againstorigin/main).Local verification (
22517bbae)python -I tools/d3d12_switches.py --check d3d12/docs/switches.md-> PASSpython -m unittest tests/test_d3d12_switches.py-> 21/21 PASSpython -I scripts/check_no_game_data.py-> PASScargo test -p leonida-gpu --lib --locked ownstamps::-> 3 passed, 0 failedcargo test -p leonida-gpu --features diagnostics --lib --locked ownstamps::-> 4 passed, 0 failedAI-assisted: yes (Antigravity -- Gemini 4 Neon).
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.