d3d12-gpu: time card-copy sends, hashes, cross-copies, and compares in LEONIDA_GPU_TIMING (D3D12-GPU-TIMING-OWN-PASSES) #3323
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u origin "github-pr/3323:github-pr/3323" git switch "github-pr/3323"
Open
leonida/mandy
lixonik wants to merge 3 commits from
github-pr/3323 into main
pull from: github-pr/3323
merge into: leonida:main
leonida:main
leonida:github-pr/3295
leonida:beta
leonida:docs/changelog-3483-3500
leonida:github-pr/3294
leonida:github-pr/2975
leonida:github-pr/2815
leonida:feat/gate-driver-start
leonida:feat/skip-pipelines-release
leonida:perf/lazy-compare
leonida:perf/mwaitx-wait
leonida:test/prio-ceiling-main
leonida:fix/ab-cpu-stdout
leonida:fix/gate-old-crashes
leonida:diag/ab-cpu
leonida:test/main-0312
leonida:github-pr/3291
leonida:diag/indirect-clamp-census
leonida:feat/barrier-enhanced
leonida:perf/texture-frame-ceiling
leonida:perf/dstorage-threads
leonida:fix/console-queue-dma-tables
leonida:fix/port-descriptors-record-parts
leonida:fix/frame-waits-fence
leonida:fix/console-sampler-words
leonida:fix/graphics-userdata-spill
leonida:fix/xg-reserved-layout-rotation
leonida:fix/barrier-console-flags
leonida:fix/switches-wait-test-child
leonida:test/list-value-waits
leonida:test/lot-gxdk-0412
leonida:fix/bvh-compacted-size
leonida:docs/i18n-quickstarts
leonida:feat/native-pipeline-slots
leonida:fix/clippy-leonida-gpu
leonida:fix/list-value-producers
leonida:fix/descriptor-page-straddle
leonida:fix/xmem-low-window
leonida:fix/ffx-jitter-never-zero
leonida:fix/run-stdout-closed
leonida:github-pr/2892
leonida:github-pr/2896
leonida:feat/warm-save-every
leonida:github-pr/2980
leonida:github-pr/2994
leonida:github-pr/3005
leonida:github-pr/3010
leonida:github-pr/3136
leonida:github-pr/3303
leonida:github-pr/3220
leonida:github-pr/3143
leonida:github-pr/3330
leonida:github-pr/3226
leonida:github-pr/3187
leonida:carry/3395
leonida:github-pr/2946
leonida:github-pr/2947
leonida:github-pr/2945
leonida:github-pr/2983
leonida:github-pr/3001
leonida:github-pr/3372
leonida:github-pr/3128
leonida:github-pr/3296
leonida:github-pr/2588
leonida:github-pr/3119
leonida:github-pr/3378
leonida:fix/crash-diagnostics
leonida:feat/dlss-mip-bias
leonida:fix/retired-out-of-order
leonida:fix/dxr-postbuild-barrier
leonida:fix/amd-relay-default
leonida:fix/removed-report-wait
leonida:feat/heap-twin
leonida:feat/vram-margin
leonida:github-pr/2472
leonida:github-pr/3123
leonida:github-pr/3088
leonida:assets/annonce-v1
leonida:github-pr/2794
leonida:github-pr/3300
leonida:github-pr/3304
leonida:github-pr/3308
leonida:github-pr/3367
leonida:github-pr/3369
leonida:fix/launcher-dlss-diagnostics
leonida:github-pr/3269
leonida:github-pr/2957
leonida:github-pr/3205
leonida:fix/crash-zero-guard
leonida:github-pr/3185
leonida:github-pr/3099
leonida:github-pr/3104
leonida:github-pr/3348
leonida:github-pr/3379
leonida:github-pr/3377
leonida:perf/darner-title-priority-ceiling
leonida:github-pr/3376
leonida:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
leonida:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
leonida:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
leonida:github-pr/3373
leonida:github-pr/3368
leonida:github-pr/3198
leonida:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
leonida:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
leonida:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
leonida:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
leonida:github-pr/3346
leonida:github-pr/3375
leonida:github-pr/2958
leonida:github-pr/3151
leonida:github-pr/3307
leonida:github-pr/3278
leonida:github-pr/3374
leonida:fix/runtime-test-conservative-fixtures
leonida:github-pr/3366
leonida:ci/shard-semantic-linux
leonida:github-pr/3354
leonida:docs/fg-limit-fps-switch
leonida:github-pr/3365
leonida:fix/read-file-hard-link
leonida:github-pr/3364
leonida:fix/book-slot-heap-never-read
leonida:github-pr/3361
leonida:github-pr/3263
leonida:github-pr/3360
leonida:github-pr/3353
leonida:github-pr/3331
leonida:fix/alias-later-queued-submissions
leonida:github-pr/3352
leonida:github-pr/3228
leonida:github-pr/3349
leonida:claude/gallant-sagan-aamatr
leonida:github-pr/3200
leonida:github-pr/3132
leonida:github-pr/3332
leonida:github-pr/3340
leonida:github-pr/3311
leonida:github-pr/3334
leonida:github-pr/3297
leonida:github-pr/3256
leonida:github-pr/2567
leonida:github-pr/2851
leonida:d3d12/agility-sdk-621
leonida:github-pr/3164
leonida:github-pr/3114
leonida:github-pr/3050
leonida:github-pr/3113
leonida:github-pr/3326
leonida:github-pr/3144
leonida:github-pr/2642
leonida:github-pr/3072
leonida:github-pr/2789
leonida:github-pr/2643
leonida:github-pr/3009
leonida:github-pr/3035
leonida:github-pr/3031
leonida:github-pr/2686
leonida:github-pr/2834
leonida:github-pr/3321
leonida:github-pr/3325
leonida:github-pr/3290
leonida:github-pr/3324
leonida:github-pr/3130
leonida:claude/fervent-curie-m19lnr
leonida:github-pr/3309
leonida:github-pr/3305
leonida:github-pr/3306
leonida:github-pr/3302
leonida:github-pr/3301
leonida:github-pr/3345
leonida:github-pr/3211
leonida:github-pr/3027
leonida:github-pr/3286
leonida:github-pr/3235
leonida:github-pr/3265
leonida:github-pr/3275
leonida:codex/skip-no-hit-ray-passes
leonida:github-pr/2823
leonida:github-pr/2911
leonida:github-pr/3262
leonida:github-pr/3125
leonida:github-pr/3206
leonida:github-pr/3250
leonida:github-pr/3238
leonida:github-pr/3188
leonida:github-pr/2952
leonida:github-pr/3217
leonida:github-pr/3168
leonida:t3/preserve-fsr-sdk-restart-path
leonida:t3/propagate-host-failure-hresult
leonida:github-pr/3209
leonida:t3/launcher-custom-parameters
leonida:github-pr/3207
leonida:github-pr/3183
leonida:github-pr/3160
leonida:github-pr/3201
leonida:ci/less-to-run
leonida:github-pr/2930
leonida:github-pr/2797
leonida:github-pr/2999
leonida:perf/native-compute-shader-forms
leonida:github-pr/3191
leonida:github-pr/3011
leonida:github-pr/3019
leonida:github-pr/2996
leonida:gh-readonly-queue/main/pr-2789-45dc41f95c1cd0dcc29c2c50582e0e9af8a77259
leonida:claude/blissful-franklin-ukp7ag
leonida:github-pr/3141
leonida:github-pr/3156
leonida:github-pr/3150
leonida:github-pr/3153
leonida:github-pr/3163
leonida:github-pr/3142
leonida:github-pr/3139
leonida:github-pr/2841
leonida:github-pr/3069
leonida:github-pr/3098
leonida:github-pr/3107
leonida:github-pr/3071
leonida:github-pr/2774
leonida:github-pr/2889
leonida:github-pr/3075
leonida:github-pr/2661
leonida:github-pr/3064
leonida:github-pr/3054
leonida:github-pr/3049
leonida:github-pr/2855
leonida:github-pr/2943
leonida:github-pr/3016
leonida:github-pr/2887
leonida:github-pr/3006
leonida:github-pr/3003
leonida:github-pr/2993
leonida:notes/card-time-and-plant-flicker
leonida:github-pr/2989
leonida:feat/vulkan-rs
leonida:github-pr/2985
leonida:github-pr/2951
leonida:github-pr/2982
leonida:github-pr/752
leonida:github-pr/792
leonida:github-pr/2877
leonida:github-pr/2654
leonida:github-pr/2893
leonida:github-pr/2948
leonida:github-pr/2944
leonida:github-pr/2919
leonida:github-pr/2915
leonida:archive/ci/less-to-run/20261202T1121Z
leonida:github-pr/2800
leonida:github-pr/2822
leonida:github-pr/2833
leonida:github-pr/2840
leonida:github-pr/2831
leonida:github-pr/2832
leonida:github-pr/2801
leonida:github-pr/2890
leonida:github-pr/2891
leonida:github-pr/2664
leonida:github-pr/2807
leonida:rt-call-trace
leonida:github-pr/2755
leonida:perf/ahead-split
leonida:github-pr/2587
leonida:github-pr/2698
leonida:github-pr/2609
leonida:github-pr/3219
leonida:docs/readme-runtime-proposal
leonida:github-pr/2017
leonida:github-pr/1741
leonida:github-pr/1667
leonida:codex/coord-claim-check-20261124-7e48
No reviewers
Assignees
Clear assignees
No assignees
Labels
Clear labels
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
enhancement
New feature or request
missing claim
Needs a claim in #14
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
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
Projects
Clear projects
No items
No project
Milestone
Clear milestone
No items
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Reference
leonida/mandy!3323
Loading…
Reference in a new issue
No description provided.
Delete branch "github-pr/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?
This branch is out-of-date with the base branch
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Claimed 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)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.
@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).
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.
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).
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.
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).