Repository navigation
d3d12: graphics pipelines get a stable identity, logged as id= on the pipeline-compile and pipeline-use lines (RT-GRAPHICS-PREBUILD-STUDY) - #2437
Open
MoonEyes wants to merge 3 commits into
Conversation
… pipeline-compile and pipeline-use lines The key= of those lines is the description the PC runtime matches a CachedPSO against. It names the root signature, which differs from run to run, and it is never set on the pipeline state stream path (mesh pipelines), so in one local run 279 of 598 draw-time builds were logged with key=-. It also has no MS or AS stage. Nothing named a graphics description the same way twice. graphics_identity() hashes what defines the description and nothing of the run: the decoded state blocks, the checksum and size of every stage's DXBC container (MS and AS included), the formats, the sample count, and the input layout, strip cut and topology type (left out for a mesh pipeline, as D3D12 reads it), 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. PipelineState::create_graphics computes it, which every graphics creation path goes through, and the pipeline-compile-begin, pipeline-compile and pipeline-use lines print it as id= (with variant=). pipeline_key and the driver's cache key are unchanged: pipeline_key now takes its state from the same key_graphics_state function and hashes the same bytes. Observation only. graphics_identity_test checks synthetic descriptions: equal descriptions share an identity, a changed state, shader, format or mesh stage changes it, a changed root signature or address does not. AI-assisted: yes (Claude Code) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… narrowed The test now pins the bytes key_graphics_state feeds the cache key (computed with the code of main before the function was shared) and the identity of the reference description: swapping two hashed fields used to pass every check. The docs and the header say that a root signature key can differ between runs rather than that it does, that an AS never reaches an identity (such a pipeline is refused first), and that a console stream prepared at bind time builds without the back-face stencil masks and the depth bounds test, so the same stream gets another id there. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Contributor
|
Independently checked head Local build & dual-GPU verification:
Code review notes:
Overall looks clean and well-scoped. AI-assisted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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