d3d12: measure mesh-output reservation and add the indexed-VS eligibility predicate (#3180) #3468
Code
Clone this repository
Checkout
From your project repository, check out a new branch and test the changes.
git fetch -u"d3d12/mesh-output-fill:KelboLive-d3d12/mesh-output-fill" git switch "KelboLive-d3d12/mesh-output-fill"
Open
leonida/mandy
KelboLive
wants to merge 2 commits from
KelboLive/mandy:d3d12/mesh-output-fill into main
pull from: KelboLive/mandy:d3d12/mesh-output-fill
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/3323
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
2 participants
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!3468
Loading…
Reference in a new issue
No description provided.
Delete branch "KelboLive/mandy:d3d12/mesh-output-fill"
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 pull request can be merged automatically.
Reviewers 0 approvals
Details
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.What/why
#3180: native mesh is thin because the title declares 128x128 output maxima and the reservation follows the declaration; the audit proposed measuring used/reserved output bytes per group and a pure eligibility predicate for a future indexed-VS form. This adds the measurement and the predicate, no behaviour change.
Added
leonida-shaderemit/mesh_fill.rs:mesh_out_fill(layout, v, p)=(v*vertex_stride + p*primitive_stride) / group_bytes, withgroup_bytes == 0-> 0.indexed_vs_eligible(threads, layout, facts):threads <= 128,max_vertices <= 128,max_primitives <= 128, no per-primitive outputs, no LDS, no barriers, no writes, only first-lane cross-lane reads.TranslationFacts/CrossLane,fill_bucketandfill_histogramwithFILL_BUCKETS.HostShader::mesh_output_layout()reads the fallbackmesh_out, else parses the emitted PSV0 maxima and OSG1/PSG1 strides (post-clamp values).leonida-gpumesh_fill(diagnostics only): one line per mesh program every five seconds, with declared maxima, strides,group_bytes, direct-dispatch group counts and reserved MB a frame; layouts cached per program name. With actual counts supplied it prints the fill, and indirect runs with GPU-only counts say so.Native-path limitation (stated in the log)
The native path can report reserved bytes, not true fill: the console M0 becomes
SetMeshOutputCounts(and an LDS exchange withLEONIDA_MESH_COUNTS) inside the shader and is never stored in the mesh-buffer header, which holds D3D12 draw arguments. Making it readable would require a diagnostic store in the translated shader - a translation change, out of scope here. The fill path is unit-tested and ready for a future source.Tests
leonida-shader: 453 passed, 10 newmesh_filltests + a layout read-back.leonida-gpu: 755 serial, 3 diagnosticsmesh_filltests; clippy clean for both crates; no-game-data and diff clean.Unverified
No game run: whether reporting reserved-only is enough to size the indexed-VS opportunity on the real title (the actual
(v,p)histogram is still missing), and whetherindexed_vs_eligible's mapping from the realLower/Shaderfields is exact for every program (documented approximations: barriers fromno_barrier/fence_only, cross-lane fromexchange/split_lds/WAVE_OPS). The ten-program in-game A/B remains the missing evidence for the frame-time claim.Item: D3D12-MESH-OUTPUT-FILL, claimed in #3312. Depends on: none.
AI-assisted: DeepSeek V4.1 Flash (OpenCode); the #3180 audit defined the probe and the predicate.
f684c6216cto26b567a972Rebased onto
main44c480a5f(head26b567a97). No conflicts. Re-ran:leonida-shader453 passed, GPU lib 758 passed, 0 failed, 60 ignored.26b567a972to54b59d757fReplayed onto
mainbba262b94(head54b59d757). No conflicts. Re-ran:leonida-shader456 passed, 0 failed, 6 ignored; GPU lib 777 passed, 0 failed, 60 ignored.54b59d757ftoa0b770b4bcReplayed onto
maine1be896b2(heada0b770b4b). No conflicts. GPU 777 passed; shader 456 passed, 6 ignored.One extra docs commit:
LEONIDA_MESH_COUNTSis read inmesh_fill.rsnow, so its generated row moved and--checkfailed. Regenerated.a0b770b4bcto5af0a53d6fReplayed onto
main00e245be5(head5af0a53d6). No conflicts; switch page--checkok. GPU 787 passed, 0 failed, 60 ignored. Theleonida-shadersuite was last green at 456 on this code (the rebase touched no shader source).5af0a53d6ftoc77c35f389Replayed onto
mainf22b9fa64(headc77c35f38). No conflicts; switch page ok. GPU 790 passed, 0 failed, 60 ignored.c77c35f389todbdefc4d60Replayed onto
main6491bc1a1(headdbdefc4d6). No conflicts; switch page ok. GPU 790 passed, 0 failed, 60 ignored.dbdefc4d60toc5a00abc35Replayed onto
main6b0498d37(headc5a00abc3). No conflicts. GPU 790 passed, 0 failed, 60 ignored.RUN —
c5a00abc35(rebased onmain6b0498d37),NVIDIA RTX 5070 12 GB,Windows 11.Static & unit checks
cargo test -p leonida-shader --lib --locked mesh_fill:10/10PASScargo clippy -p leonida-gpu --all-targets --locked -- -D warnings:0warningspython -I tools/d3d12_switches.py --check&python -I scripts/check_no_game_data.py: PASSLive 315 s run (
-SeriesS -NoFrameGen -NoPrecompile -AutoMenu)27samples with>= 1000draws,max_draws = 5,294): median22.8 fps(43.8 ms, p1012.9, p9024.7;3000-4999draws,16samples: median23.4 fps).0ERRORlines,0mesh_fillwarnings,device-lost.txt = false, peak video memory8,057 / 11,176 MB.Live
leonida_gpu::mesh_fillaggregates (clean-room summary, no shader hashes)128 vertices / 128 primitives, with3,584-33,280B/group (final snapshot median15,360B/group). All lines reportedfill reserved onlyon the native path, as expected.127in-world snapshots (>= 100mesh pipelines): median189pipelines per snapshot, median direct-dispatch reservation6,465groups/frame (52.00 MBreserved/frame), median78,333indirect dispatches per snapshot with GPU-only group counts.187pipelines):52direct-dispatch (6,465groups/frame,51.39 MBreserved/frame; largest single pipeline10.39 MB/frame at2,029groups *5,120B/group) +135indirect-only (81,536indirect dispatches with GPU-only group counts — ~72% of active mesh pipelines) +0idle.207pipelines):9,441groups/frame,154.93 MBreserved/frame (largest single pipeline39.96 MB/frame at1,419groups *28,160B/group) +30,380indirect dispatches (129indirect-only,1both).One live observation (cadence & log volume)
d3d12/crates/leonida-gpu/src/host.rs,crate::mesh_fill::line(frames)is called inMeter::linesoutside theif five { ... }block, so it fires every ~1 s (139snapshots, median1.02 scadence) rather than every 5 s as stated in the PR description and doc comment.diagnosticsis enabled in standard test runs, this emitted25,052INFOlines in 315 s (~189lines/s in-world, ~41% of the60,596-line log), repeating the longfill reserved only (...)note on every line. Movingcrate::mesh_fill::line(frames)insideif five { ... }(and optionally summarizing or gating the per-pipeline dump behind an opt-in switch) would match the documented 5 s cadence and significantly cut log noise.AI-assisted.
c5a00abc35toeeefb7f665Replayed onto
main0036195a7(headeeefb7f66). No conflicts. 790 passed, 0 failed, 60 ignored.eeefb7f665toc82f118919Replayed onto
mainf4b0404e9(headc82f11891). No conflicts. 790 passed, 0 failed, 60 ignored.c82f118919to48e8f56245Replayed onto
main93b9d90a2(head48e8f5624). No conflicts. 790 passed, 0 failed, 60 ignored.48e8f56245tod130d9b379Replayed onto
mainc5355dd25(headd130d9b37). No conflicts. 791 passed, 0 failed, 60 ignored.d130d9b379to6b4b1f479cReplayed onto
maine1b0248c1(head6b4b1f479). No conflicts. 791 passed, 0 failed, 60 ignored.6b4b1f479ctod130b35ee8Replayed onto
maind99bb4d7a(headd130b35ee). No conflicts. 794 passed, 0 failed, 60 ignored.