d3d12: graphics pipelines get a stable identity, logged as id= on the pipeline-compile and pipeline-use lines (RT-GRAPHICS-PREBUILD-STUDY) #2437
Closed
leonida/mandy
MoonEyes wants to merge 0 commits from
feat/graphics-pipeline-identity into main
pull from: feat/graphics-pipeline-identity
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
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!2437
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/graphics-pipeline-identity"
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?
Pull request closed
This pull request cannot be reopened because the branch was deleted.
What this is
Claim: RT-GRAPHICS-PREBUILD-STUDY, first step (the study only; no prebuild yet).
Depends on: none.
A graphics pipeline has no name that is the same in two runs.
key=on thepipeline-compilelines is thedescription the PC runtime matches a
CachedPSOagainst, and it cannot serve:is not ours);
ID3D12Device2::CreatePipelineState(the stream path, mesh pipelines) never sets it, so in one local run 279 of598 draw-time graphics builds were logged with
key=-;Without a stable name a run cannot record which pipelines it drew, and a prebuild cannot resume.
What it adds
graphics_identity()(runtime/shims/d3d12_graphics_identity.h): a SHA-256 of what defines the description andnothing of the run. It takes the decoded state blocks (blend, sample mask, rasterizer, depth and stencil, stream
output), the checksum and size of each stage's DXBC container (VS, PS, DS, HS, GS, and MS and AS), the render
target and depth formats, the sample count, and the input layout, strip cut and topology type (left out for a mesh
pipeline, which D3D12 ignores them for), plus the back face's stencil masks and the depth bounds test of a stream.
The root signature, addresses and the device are not in it. It is a pure function, with no device and no GPU.
PipelineState::create_graphicscomputes it. Every graphics creation path goes through it (the libraryCreateGraphicsPipelineState, slot 57, and the streamCreatePipelineState, mesh included), so both paths set it.pipeline-compile-begin,pipeline-compileandpipeline-use(draw) printid=<64 hex>;variant=is on them(on
pipeline-usetoo, now). A compute pipeline printsid=-.docs/d3d12_vulkan.mddescribes the field.pipeline_keynow takes its state from the samekey_graphics_statefunction and hashes the same bytes(checked against the previous function on a sample description).
How it relates to #2220 and #2260
#2220 (mine, open) records the order of first pipeline requests under
order_key:GetCachedBlob's key with theMS hash folded in. #2260 reads that log at startup. Both say the limit themselves: a root signature the runtime does
not know is hashed by its address, so that key can change between runs and the pipeline is then not found.
id=overlaps withorder_keyon purpose and differs in three points: the root signature is not in it at all (sothat limit does not apply), an AS stage is in it, and so are the back face's stencil masks and the depth bounds
test of a stream. It is not a cache key and replaces nothing here. This pull request does not touch the order log;
whether the log should later name pipelines by
idinstead is a question for #2220 and #2260, not decided here.What it does not change
GetCachedBlob,key=, theCachedPSOcheck: unchanged.creation.
Test
graphics_identity_test(CPU only, synthetic DXBC headers with invented checksums):address, flags or cached blob: same identity;
render target or depth format, sample count, topology, strip cut, input element, or another checksum or size of
any stage: different identity;
topology a description carries: ignored.
On
mainit does not build (nod3d12_graphics_identity.h). With the MS stage left out of the identity (whatkey=does) it fails 2 checks; with the root signature put in, it fails 2 other checks. It passes with the change.Ran with ctest next to
pso_stream,native_pso_blend,native_pso_depth,native_pso_fallback,d3d12_pso_validation,d3d12_pipeline_workers(both) andd3d12_stub_pipelines: all pass.gta6rtbuilds.python -I scripts/check_no_game_data.pyon the changed files: clean. No game data in the test, the code or thistext.
GPUs tested: none; this was not run on a GPU and the game was not run. The log lines were not read from a run.
Next
Not in this pull request: a graphics prebuild outside the game (
gta6rt --precompile-graphics: a resumable listof the pipelines a run drew, then a build of them through the same
create_graphicsandbuildthe title uses).This identity is the key such a list needs.
AI-assisted: yes (Claude Code)
🤖 Generated with Claude Code
Independently checked head
830d50203on Windows 11 Pro 26200, MSVC 2022 (19.44.35230.0, RelWithDebInfo, Ninja), Vulkan SDK1.4.363.0, WSLllvm-mc 21.1.8, no game files.Local build & dual-GPU verification:
graphics_identity_testandd3d12_m2_textured_testwith zero new warnings in the PR-modified files.graphics_identity_test: all passed.d3d12_m2_textured_testwithLEONIDA_VK_VALIDATION=1:616.64): 4096/4096 pixels matched (error 0), 0 validation errors.25.10.30.02): 4096/4096 pixels matched (error 0), 0 validation errors.Code review notes:
KeyBuilderavoids struct padding leaks, float bit-patterns usememcpy, null stream-outputSemanticNameentries hash safely, mesh pipelines skip ignored IA/topology fields, frozen cache-key tests pin the on-disk key, andid=placement afterkey=keepsscripts/check_compute_journal_overlay.pymatching cleanly.key_graphics_statecurrently hashes some fields that D3D12 ignores depending on enable flags — specificallyBlendState.RenderTarget[1..7]whenIndependentBlendEnable == FALSE,RTVFormats[i >= NumRenderTargets],LogicOpwhenLogicOpEnable == FALSE, and stencil masks/ops whenStencilEnable == FALSE. If a title leaves ignored fields uninitialized on the stack, the same pipeline could produce differentid=values across runs. Sincekey_graphics_statemust stay frozen forpipeline_key, normalizing a local copy of the desc insidegraphics_identityonly (zeroing ignored fields before hashing) plus a test with garbage in ignored fields would make cross-runid=matching airtight.Overall looks clean and well-scoped. AI-assisted.
measurement for the "Next" step of this PR (
--precompile-graphics), @MoonEyes: how much of a cold start an offline graphics precompile would remove, from seven 600 s boots on an RTX 3090 24 GB (NVIDIA 621.40, Windows 11), counts only. AI-assisted (Claude Code).LEONIDA_TRACE_PIPELINE_COMPILE=1(triggersdrawanddraw-worker; a "compile" ishit=0and at least 250 ms; identity =(key, variant), or the shader-list/size proxy wherekey=-).key=is set: 431 of 460 keyed pipelines appear in two or more runs, each key with one shader set and size. Butkey=is empty on the console-stream path for a large share (166 of 447 compiles in the cold run), which your stableid=would cover.--precompile-pipelinesbuilt 3,772 compute pipelines in 1,692 s on 10 threads on the same machine.Happy to test
--precompile-graphicson this machine (profile L) when it exists.PortBridge checked
3663559on Continued main431cebaand with #2527; both Git comparisons are clean. AnyXboxX #541 separately fingerprints a compiled artifact using backend, adapter and driver. As a precompile acceptance control, two fresh processes with different native addresses should still emit the same logicalid=. Switching backend or driver may independently reject the old compiled artifact. This separates an ID useful for comparing the seven boot reports from one safe to use for native cache admission.Exact comparisons and controls. If this workflow is useful, your team or agent can send the next public PR URL, target SHA, and behavior to preserve via PortBridge #98. No install is needed.
#2437 | head 36635599f8a8e64652492cc8ebca6e188d6e28d7 (merged cleanly with main adfb3821a23612263c1c5b195453ed01c4c114db — no conflicts on current
main) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^(graphics_identity|pso_stream|d3d12_pso_validation|d3d12_draw|d3d12_mesh|d3d12_compute)$" --output-on-failure(LEONIDA_VK_VALIDATION=1,LEONIDA_TRACE_PIPELINE_COMPILE=1) | red mutation: omittingkey_shader(key, "ms", ...)inruntime/shims/d3d12_graphics_identity.hfailsgraphics_identity(FAILED: 3across frozen identity and mesh-stage checks) | green on PR+main:6/6CTests (graphics_identity,pso_stream,d3d12_pso_validation,d3d12_draw,d3d12_mesh,d3d12_compute) pass in3.41 son RTX 3090 with0Khronos validation errors; liveLEONIDA_TRACE_PIPELINE_COMPILE=1traces emit78graphics/meshpipeline-compilelines with 64-hexid=(including4stream-path VS & mesh compiles withkey=-, pluspipeline-uselines carryingid=<64-hex> variant=0) and10uncached compute compile trace lines carryingid=-;test_docs_encoding.py&test_docs_repo_paths.py(6/6 OK) andcheck_no_game_data.py(0violations) pass | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yesIndependent check on Windows (not the author), at
36635599f.graphics_identity_testand ran it: all passed — back-face masks keep the identity, depth-bounds changes it, a mesh pipeline ignores the description's input layout/topology, and another root signature keeps a mesh identity.Environment: Ryzen 9 7950X3D, Windows 11 Pro 10.0.26200.9711.
AI-assisted: yes (opencode).
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.