startup: cache translated graphics pipelines #3837
Open
Leyukaka wants to merge 10 commits from
upstream-pr/3837 into main
pull from: upstream-pr/3837
merge into: R0Y00:main
R0Y00:main
R0Y00:codex/indirect-large-backed-views
R0Y00:codex/word3-preflight-check
R0Y00:codex/vertex-table-two-records
R0Y00:codex/live-index-alias
R0Y00:codex/copied-vertex-buffer-srv
R0Y00:codex/windows-stage-test-output
R0Y00:codex/preserve-live-srv-retirement
R0Y00:codex/share-render-target-tracking
R0Y00:codex/sgd5-negative-offset-fixture
R0Y00:coverage-dashboard
R0Y00:codex/mesh-loose-root
R0Y00:codex/mesh86-cache-padding
R0Y00:codex/xmem-scatter-preflight
R0Y00:codex/mesh-depth-ps
R0Y00:codex/indirect-dispatch-refresh
R0Y00:codex/compute-container-index
R0Y00:codex/startup-compute-formatted-load
R0Y00:codex/compute-indirect-producer
R0Y00:codex/compute-atomic-soffset
R0Y00:codex/mesh-dual-handoff
R0Y00:codex/startup-run-sh-watcher-control
R0Y00:codex/queue31-page-alias
R0Y00:codex/indexed-indirect-compute-root
R0Y00:codex/typed-buffer-view-metadata
R0Y00:codex/translated-indexed-address-alias
R0Y00:codex/fixed-mesh-create-result
R0Y00:codex/xmem-section-lease
R0Y00:codex/startup-slot86-mesh-cache
R0Y00:codex/restore-mesh-barrier-iteration
R0Y00:codex/translated-indirect-upload-index
R0Y00:codex/xapu-completion-opt-in
R0Y00:codex/translated-indexed-rect
R0Y00:codex/translated-indexed-indirect
R0Y00:codex/startup-mesh-lds-integration
R0Y00:codex/startup-console-ms24
R0Y00:codex/startup-slot57-mesh-request
R0Y00:codex/indirect-copy-provenance
R0Y00:codex/present-color-producer-trace
R0Y00:codex/compute-dispatch-binding-trace
R0Y00:codex/translated-indirect-table-buffers
R0Y00:codex/indirect-copy-provenance-base
R0Y00:codex/mix-half-literal-source
R0Y00:codex/translated-indirect-draw
R0Y00:codex/xmem-scatter-diagnostics
R0Y00:codex/slot148-recording-upload
R0Y00:codex/slot70-loading-art-verified
R0Y00:codex/command-list-upload-arena
R0Y00:codex/recover-failed-command-list
R0Y00:codex/startup-heap-timing-notes
R0Y00:codex/align-audio-input-timeline
R0Y00:codex/synthetic-depth-export-control
R0Y00:codex/startup-texture1d-on-windows
R0Y00:codex/1629-packed-position-fixture
R0Y00:codex/cpu-srv-refresh
R0Y00:codex/stream-root-srv-draw
R0Y00:codex/audio-mixer-timer
R0Y00:codex/startup-reload-published-shader
R0Y00:codex/priority-integrate-1284
R0Y00:codex/guest-sixteen-page-record
R0Y00:codex/aot-placed-dxr-batch
R0Y00:codex/guest-directory-selection
R0Y00:codex/gamesave-enumerate-read
R0Y00:codex/readme-archive-to-pixels
R0Y00:codex/pe-placed-view-draw
R0Y00:codex/archive-directory-gpu
R0Y00:codex/slot133-dxr-build
R0Y00:codex/materialize-placed-vertex-view
R0Y00:codex/dstorage-directory-offsets
R0Y00:codex/xg-nine-bc-copy
R0Y00:codex/xg-slot10-bc64-arrays
R0Y00:codex/dxr-guest-address-readback
R0Y00:codex/gpu-va-high-bits
R0Y00:codex/clarify-diagnostic-startup-scope
R0Y00:codex/xg-six-levels
R0Y00:codex/typed-derived-blend
R0Y00:codex/english-legal-text-progress
R0Y00:codex/address-bc-4ks
R0Y00:codex/dstorage-bounded-file-read
R0Y00:codex/wide-srv-offsets-menu
R0Y00:codex/startup-memory-srv
R0Y00:codex/bound-view-tail
R0Y00:codex/language-selector-readback
R0Y00:codex/setup-menu-progress
R0Y00:codex/cpu-plane-refresh
R0Y00:codex/startup-ubyte-vertex
R0Y00:codex/presenter-window-selection
R0Y00:codex/startup-uniform-buffer-lane
R0Y00:codex/intro-loop-timing
R0Y00:codex/static-clzero-loops
R0Y00:codex/document-rtx-intro
R0Y00:codex/startup-insertq
R0Y00:codex/nv12-startup-texture
R0Y00:codex/stream-stage-draw
R0Y00:codex/startup-null-uav-format
R0Y00:codex/startup-draw-capture
R0Y00:codex/shorten-windows-checks
R0Y00:codex/dstorage-rfc1950
R0Y00:codex/startup-dump-fence
R0Y00:codex/pr1135-review-base
R0Y00:codex/startup-stream-requests
R0Y00:codex/startup-chroma-view
R0Y00:codex/readme-graphics-pipeline-streams
R0Y00:codex/static-crt-free-tls
R0Y00:codex/arc-140t-rtx-5080-laptop-gpu-reports
R0Y00:codex/main-startup-progress-entry
R0Y00:codex/signed-dxil-catalogue
R0Y00:codex/reloc-free-preferred-base
R0Y00:codex/quad-dpp-bit-mask
R0Y00:codex/raw-srv-bounds
R0Y00:codex/rx9070-31044-hardware-report
R0Y00:codex/gpu-page-source-provenance
R0Y00:codex/runtime-placeholder-interior
R0Y00:codex/gpu-copy-queue-tile-order
R0Y00:codex/pe-pin-external-providers
R0Y00:codex/xmem-placeholder-reservations
R0Y00:codex/xmem-shared-physical-pages
R0Y00:codex/pe-package-startup
R0Y00:codex/xmem-tools-memory-query
R0Y00:codex/cpu-stack-output-import
R0Y00:codex/pe-load-security-cookie
R0Y00:codex/record-three-bvh-retests
R0Y00:codex/cpu-rbp-frame-anchor
R0Y00:codex/xmem-default-startup
R0Y00:codex/record-rtx-3050-ti-9597
R0Y00:codex/docs-readme-start-here
R0Y00:codex/check-compute-mad24-truncation
R0Y00:codex/docs-discord-community
R0Y00:codex/bound-rcx-branch-mutants
R0Y00:codex/rtx5060ti-bvh-62114
R0Y00:codex/837-neutral-readme-disclaimer
R0Y00:codex/record-rtx-3070-ti
R0Y00:codex/title-neutral-public-wording
R0Y00:codex/exe-shadow-frame-submissions
R0Y00:codex/exe-shadow-runtime-chain
R0Y00:codex/readme-polish
R0Y00:codex/gpu-coverage-nov23
R0Y00:codex/spirv-minlod
R0Y00:codex/shadow-shim-device
R0Y00:codex/exe-two-shadow-frames
R0Y00:codex/shim-dispatch-cleanup
R0Y00:codex/fix-spirv-cache-probe
R0Y00:codex/sampler-use
R0Y00:codex/ballot-bit-extract
R0Y00:codex/packed-fma-release
R0Y00:codex/cpu-packed-fma-o2
R0Y00:codex/publish-coverage-dashboard
R0Y00:codex/mesh-cbv-binding-order
R0Y00:codex/spirv-window-fixture
R0Y00:codex/ps-e32-float-uint
R0Y00:codex/ps-cbuffer-reads
R0Y00:codex/fixed-profile-rescan
R0Y00:codex/shim-compute-integration
R0Y00:codex/readme-visible-coverage
R0Y00:codex/readme-research-navigation
R0Y00:codex/integrate-pr-256
R0Y00:codex/indexed-mesh
R0Y00:codex/sampled-coverage
R0Y00:codex/first-ms
R0Y00:codex/dual-ps
R0Y00:codex/ps-attribute
R0Y00:codex/compute-first
R0Y00:codex/ps-export
R0Y00:codex/readme-research-status
R0Y00:codex/ps-layout
R0Y00:codex/blast-window
R0Y00:codex/chart-caption
R0Y00:codex/reviewer-roles
R0Y00:codex/blast-aot
R0Y00:codex/archive-program
R0Y00:codex/crc-stream-program
R0Y00:codex/exe-image-data-chain
R0Y00:codex/local-cpu-fixture-coverage
R0Y00:codex/exe-bound-frame-chain
R0Y00:codex/exe-mapped-comparison
R0Y00:codex/contribution-dependencies
R0Y00:codex/exe-entry-aot
R0Y00:codex/bink-frame-heap-integration
R0Y00:docs/hardware-seven-reports
R0Y00:codex/bink-custom-heap
R0Y00:codex/bink-heap-callers
R0Y00:codex/discussions-entry-points
R0Y00:codex/gpu-community-batch-64
R0Y00:codex/ffx-scratch-writers
R0Y00:codex/generic-project-documentation
R0Y00:codex/ffx-dispatch-rcas
R0Y00:codex/four-windows-gpu-reports
R0Y00:codex/title-neutral-project-wording
R0Y00:codex/community-coverage-provenance
R0Y00:codex/rcas-packed-texels
R0Y00:codex/community-gpu-retests
R0Y00:codex/community-build-and-gpu-reports
R0Y00:codex/ffx-provider-loop
R0Y00:codex/ffx-recurrent-views
R0Y00:codex/ffx-recurrent-resource
R0Y00:codex/amd-wave64-reports
R0Y00:codex/ffx-backend-slots
R0Y00:codex/upscaler-device-init
R0Y00:codex/ffx-context-lifecycle
R0Y00:codex/ffx-version-query
R0Y00:codex/ffx-provider-contract
R0Y00:codex/typed-object-callback
R0Y00:codex/cpu-ordinal-import
R0Y00:codex/chained-cpu-ranges
R0Y00:codex/cpu-import-call
R0Y00:codex/cpu-direct-call
R0Y00:codex/cpu-leaf-aot
R0Y00:codex/community-project-status
R0Y00:codex/script-state-path-replay
R0Y00:codex/script-state-evidence
R0Y00:codex/bc7-resident-tail
R0Y00:codex/bcpack-mip-tail
R0Y00:codex/bc7-texture-draw
R0Y00:codex/asset-ranges
R0Y00:codex/pixel-constants
R0Y00:codex/pixel-aot
R0Y00:codex/pre-exe-workloads
R0Y00:codex/root-signature-device-coverage
R0Y00:engineering/packed-bvh-leaves
R0Y00:engineering/bvh-build-and-update
R0Y00:engineering/intake-root-roundtrip
R0Y00:community/gpu-check-release
R0Y00:community/english-contributor-entry
No reviewers
Labels
Clear labels
No items
No labels
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.
Reference
R0Y00/Xbox2Windows!3837
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3837"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T08:12:17Z.
Takes over #1641 by @lambirou with his commits. #1641 was closed after the rebase request of 11-25, and the question asked there on 12-01 has had no reply so far. His three commits are kept with their authorship and messages; the conflicts with current
mainare resolved inside them, mechanically. @lambirou, if you would rather continue this yourself, say so and I will close this PR.Problem
The translated draw path creates each desktop graphics PSO again on every run and keeps only an in-process table.
X2W_SHADER_CACHEstores the translated shader bytecode, but not the driver's compiled pipelines, so every run pays the driver's pipeline compile again.Change
The cache is opt-in: it needs
X2W_D3D12_PSO_LIBRARY=1andX2W_SHADER_CACHE. With the switch unset, nothing constructs the library or hashes the key, andpipeline_forcallsCreateGraphicsPipelineStateexactly asmaindoes.From #1641 (see its description for the full design and the review history):
src/startup_stubs/graphics_pipeline_cache.h: anID3D12PipelineLibrarycache inX2W_SHADER_CACHE\pso_<adapter>.lib, with a versioned header, a checksum and an adapter/driver identity. The file is replaced atomically.pipeline_fortriesLoadGraphicsPipelinefirst and falls back toCreateGraphicsPipelineStateon a miss, a corrupt or truncated file, a driver or adapter mismatch, or a missingID3D12PipelineLibrary. A cache failure never fails a draw.Added here:
1dd7a9deb: the library gets its own name, distinct from the in-processpso_state_key. The name covers the translated VS/PS bytes, the blend and depth blocks the PSO really uses, the rasterizer state, the input layout, the geometry stage bytes, the sample mask, the sample description and the topology type.f17ba72f3(maintainer): theX2W_D3D12_PSO_LIBRARY=1opt-in gate.cde52a18b,7784dee76: the write schedule.file loaded,file neworfile unset.2e40b1d35: on process exit the cache follows thed3d12_teardown.hboundary. Nothing is serialized, written or released, and stores made since the last write are compiled again by the next run.135ea1b57: a Present smoke test, the move of the registration totests/cmake/startup_pso_cache.cmake, and theprpreset entries.As #1641 states, the implementation uses only the public Microsoft
ID3D12PipelineLibraryAPI.Validation
Windows, MSVC, head
135ea1b57.Result:
startup_pso_cache,startup_pso_library_present_warpandstartup_pso_library_present_hardwarepassed (3/3).startup_pso_cache(WARP) covers:startup_pso_library_present_{warp,hardware}runs thestartup_stream_depthdraws plus one guest Present, three times on one cache directory:prpreset runsstartup_pso_cacheandstartup_pso_library_present_warp.Known limits
X2W_PSO_RECIPE_DIR) are still created directly and bypass the cache.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T08:25:50Z.
Review: CHANGES_REQUESTED
Reviewed
1dd7a9deby reading the diff; not built or run.Verdict: changes requested. The cache logic is careful: names, fallbacks, atomic replace and the extended key are all handled. But it becomes active on every render run, the flush is synchronous on the present thread, and it has not been tested on hardware.
X2W_D3D12_PSO_LIBRARY=1) until it is measured on a physical adapter.run.ps1 -Renderalways setsX2W_SHADER_CACHE(tools/startup/run.ps1:83), so with this PR every render run uses the library. The two items below are unmeasured, as the Known limits say. The other D3D12 runtime switches started opt-in and moved into the presets with run evidence. This should follow the same path.PersistLibraryfromqueue_present(d3d12_xs_device.cpp:8923):GetSerializedSize+Serializeof the whole library, two heap copies of it (payload + header copy, up to 2 × 256 MB), thenFlushFileBuffersandMOVEFILE_WRITE_THROUGH. During a load, most frames add PSOs, so the file is rewritten nearly every frame and the transient commit grows with the library. Throttling (every N s, or at exit) and serializing into one buffer would bound both.CreateGraphicsPipelineState.GetOrCreateGraphicsPipelinetakeslock_exclusively for the whole driver compile (graphics_pipeline_cache.h:319), andFlushtakes it for the whole write.pipeline_forruns underdraw_lock, so a flush stalls the draw path, and concurrent pipeline creation is serialized. Locking only aroundLoadGraphicsPipelineandStorePipelineavoids both.tests/cmake/startup_pso_cache.cmake(pertests/cmake/README.md) rather than inCMakeLists.txt.startup_pso_cacheis also not in theprpreset filter, so CI does not run it.LoadGraphicsPipelinevalidates the desc, and a duplicateStorePipelineis counted and kept out.shared_ptrkeeps an old cache alive through a concurrent flush after a device change.pso_state_keystays the in-process key.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T19:48:37Z.
Review: COMMENTED
I reran
ctest --preset dev --no-tests=error -j 1 --output-on-failure -R '^startup_pso_cache$'on1dd7a9dewith MSVC Debug. The WARP library fixture passed (1/1), including its warm-library and bad-file controls. It calls the cache helper directly. It does not exercise the presenter flush or establish the hardware frame cost, so the open opt-in request still applies.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T21:07:28Z.
Review: COMMENTED
Additional independent hardware result on
1dd7a9de: the unmodified WARP fixture passed. In a local copy oftests/startup_pso_cache_check.cpp, I selected the RTX 4060 Laptop (32.0.16.1656, Windows 11 build 26300) viacreate_device(false, unmatched). The fixed color oracle then reportedff407fffversus WARP'sff4080ff. Cold-create and warm-load pixels matched byte for byte on NVIDIA. Allowing the one-step green difference only in the fixed oracle gave a full hardware fixture pass, including the bad-file and disabled-interface controls. This tests the helper and the driver library. The review request to start with an explicit opt-in and measure synchronous Present-thread flushing still applies.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T21:33:44Z.
Review: COMMENTED
I pushed
f17ba72fto address the opt-in request. The runtime now requiresX2W_D3D12_PSO_LIBRARY=1before it constructs the library or hashes the on-disk key. With MSVC Debug on Windows 11 build 26300, a localstartup_stream_depthvariant called guest Present after drawing. With the switch unset, the WARP and RTX 4060 Laptop runs drew correctly and neither wrote a library. With it set, both wrote the library during Present. A fresh process then logged warm hits and reproduced every source-built color/depth readback byte for byte (2/2 fixtures in each mode). Cold misses emitted D3D12 warning 971 with the debug layer on, as expected for missing names. The warm runs emitted no warnings. The local Present variant does not measure frame-time cost. Please re-review the opt-in gate on this head.Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T21:57:48Z.
Thank you for the gate and for the runs. I re-reviewed
f17ba72fby reading the diff; I have not built or run this head.Verdict: the gate is correct. With
X2W_D3D12_PSO_LIBRARYunset, nothing constructs the library or hashes its key:graphics_pipeline_library_enabled()(src/startup_stubs/d3d12_draw.inl:161) readsx2w_local::env_ononce. It parses like the other switches: the value must start with1.load_translationskipstranslated_code_key(d3d12_draw.inl:850).pipeline_cache_forreturns before its mutex (d3d12_draw.inl:1595). The only construction site ofGraphicsPipelineCacheis behind it (:1604), so the file is never opened.flush_pipeline_cache, called fromqueue_present(d3d12_xs_device.cpp:9102), returns immediately (d3d12_draw.inl:1618).pipeline_forcallsCreateGraphicsPipelineStatedirectly, as main does (d3d12_draw.inl:1877-1889). The only visible difference is the, cache offsuffix in the log line.tests/native_rtv_variant_check.py:303matches a prefix of that line.Non-blocking:
startup_pso_cachecalls the helper directly, so it does not pass through the gate.docs/startup-runtime.md:1994but has no row in the environment table.CMakeLists.txt:1392, not intests/cmake/, and is not in theprfilter.A follow-up for the two remaining SHOULD items is ready locally as two commits on top of
f17ba72f. It is not pushed and leaves your gate unchanged:cde52a18bstartup: throttle pipeline library writes and compile outside the lockCreateGraphicsPipelineStaterun outside the cache lock.startup_pso_cachegains a throttle check.2e40b1d35startup: detach the pipeline library on process exitd3d12_teardown.h: when the process is terminating, nothing is serialized or released.Validation: these two commits have not been built or run on your head yet. My earlier runs were on my previous head (
1dd7a9de). I will runstartup_pso_cacheon the new base and report before asking for a merge.Would you like them pushed to this branch, or opened as a separate PR?
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T22:44:30Z.
Thanks for rechecking the default-off gate. Please add the throttled writes and the process-exit detach to this PR after testing them on top of
f17ba72f. They are part of the behavior of the same opt-in cache, and the detach should be checked before landing it. Please include a Present smoke test with the switch unset and set, then a fresh-process warm-cache readback. If the test can run in PR CI, register it undertests/cmake/and add the applicable WARP case to theprpreset.Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-12-02T22:47:46Z.
Review: CHANGES_REQUESTED
Re-review on
f17ba72f: full diff and test read, built and run this time.Verdict: changes requested, for one point. My earlier MUST (opt-in) is resolved. The remaining one is the process-exit detach, which @R0Y00 already asked for here.
X2W_D3D12_PSO_LIBRARYunset, nothing constructs the library, hashes the code key or flushes, andpipeline_forcreates the PSO directly.static std::shared_ptrinpipeline_cache_forrunsShutdown(serialize, write, release) in this module's CRT teardown.d3d12_teardown.hdocuments why the other caches release nothing at that point (0xC0000409 through the AMD driver). This is by reading: the twostartup_stream_depthprocesses below exited with code 0 with the cache on.startup_pso_cacheone flush after eight small PSOs took 17.1 and 13.4 ms here (WARP, two runs), before any title-sized library.lock_.GetOrCreateGraphicsPipelinestill holds it acrossCreateGraphicsPipelineState.Flushclearsdirty_even whenPersistLibraryfails, so those entries are not retried until the next store.file presentwhenever the directory is set; it printsconfigured(), not whether the file exists.X2W_SHADER_CACHE.Run: Windows 10 19045, RTX 3080 Ti (32.0.16.1047) and WARP 10.0.19041.7811, MSVC Release, full build.
=1startup_pso_cachestartup_frame_copy_{warp,hardware}startup_stream_depth_{warp,hardware}native_rtv_variant_{warp,hardware}startup_stream_depthfails only becausestartup_stream_depth_check.py:71rejects every warning, and each cold miss emits id 971. It stops before its pixel comparison, so this run says nothing about pixels with the switch set. The requested Present smoke test will need to allow 971 on the cold run.native_rtv_variant_warpfails on this host in both modes because the in-box runtime rejects the shader model (id 68); I did not trace the hardware one.Not measured: hardware frame cost, and a warm run in a title.
AI-assisted.
Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-12-02T23:22:14Z.
Thank you both. Four commits are pushed on top of
f17ba72f. The opt-in gate is unchanged.cde52a18bstartup: throttle pipeline library writes and compile outside the lock2e40b1d35startup: detach the pipeline library on process exit7784dee76startup: retry failed pipeline library writes and write the first at once135ea1b57startup: smoke-test the pipeline library through guest PresentBehaviour change: the library is first written at the first Present with a pending store, then at most every 15 s. Process exit no longer writes, so stores made after the last write are compiled again by the next run.
By review point:
d3d12_process_terminatingis set,Shutdownclearslibrary_,blob_anddevice_and returns before anySerialize, file write orRelease(src/startup_stubs/graphics_pipeline_cache.h:311-316). This is thed3d12_teardown.hboundary. A device change or FreeLibrary still writes the pending stores and releases (:319-335).flush_pipeline_cachecallsFlushIfDue(GetTickCount64())(src/startup_stubs/d3d12_draw.inl:1622).graphics_pipeline_cache.h:486-521,persist_interval_msat:30).:494-495), so it never waits for a draw.lock_is released (:510-511).lock_.GetOrCreateGraphicsPipelinetakeslock_forLoadGraphicsPipeline(:348), releases it beforeCreateGraphicsPipelineState(:381) and takes it again only forStorePipeline(:389). Two threads that miss the same name both compile, and the second store is counted as a duplicate.dirty_on failure. A failedSerializekeeps the stores pending. A failed file replace marks them pending again, and the next due Present retries them without a new store (:507-518).file loaded(a valid file was read),file new(the library starts empty) orfile unset(d3d12_draw.inl:1609-1612,loaded_from_fileatgraphics_pipeline_cache.h:285).Tests:
tests/startup_pso_library_present_check.py.startup_stream_depthtakes a newpresentargument that calls guest Present (queue slot 32) after its fourteen cases (tests/startup_stream_depth.cpp:219,456). Three runs share one cache directory:cache offon every pipeline, nopso_*.lib.file loaded, one hit per pipeline created in the cold run, no miss, no debug-layer message. All fourteen readbacks are byte-identical to the unset run, and the library file is unchanged.tests/cmake/startup_pso_cache.cmakeregistersstartup_pso_cache(moved fromCMakeLists.txt) andstartup_pso_library_present_{warp,hardware}. Theprtest preset runsstartup_pso_cacheandstartup_pso_library_present_warp, and theprbuild preset buildsstartup_pso_cache_checkandstartup_stream_depth.startup_pso_cachealso checks the first write, the interval, and a write blocked by a directory in place of the file, retried once the directory is removed (tests/startup_pso_cache_check.cpp:635-714).Validation: Windows, MSVC, head
135ea1b57.startup_pso_cache,startup_pso_library_present_warpandstartup_pso_library_present_hardwarepassed (3/3).Not covered: no test fails if the detach is removed. The smoke test only shows that all its processes exit with code 0 with the switch set. The frame cost of a write on a physical adapter is still not measured.
Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-02T23:30:58Z.
Review: CHANGES_REQUESTED
I independently built and ran
ctest --preset dev --no-tests=error -j 1 -V -R '^(startup_pso_cache|startup_pso_library_present_(warp|hardware))$'on135ea1b57: 3/3 passed, no skips. Inbox WARP and RTX 4060 Laptop both produced 14 byte-identical readbacks and seven warm hits in a fresh process with the debug layer enabled. The process-exit branch now avoids Serialize and Release.The new Present path can still block on draw-side work in two places.
pipeline_cache_for(device, false)takes the ordinary mutex while cache creation/replacement uses that same mutex, so Present can wait for library creation or the old cache's final write. InPersist(false), a file replacement failure takeslock_withAcquireSRWLockExclusiveafter releasing the first try-lock, so a concurrentLoadGraphicsPipelineorStorePipelinemay also delay Present on the failure path. Please use a nonblocking lookup for Present and preserve the failed-write retry without a blocking reacquire on that path. The existing failure retry case is a good baseline for the change.The current main merge conflicts only in
CMakePresets.json. Keepmesh57_integer_aluandnative_heap_token_texture, then add the two PSO test selections and their build targets.Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-12-03T07:14:20Z.
I independently built and ran
startup_pso_cache_checkwith MSVC against135ea1b57. The WARP fixture passed, including cold store, warm load, corrupted/unsupported fallback, throttling and retry. This is the cache helper fixture. The runtime Present/fresh-process proof still needs the rebased head: againstmainat29bb2aed, Git conflicts inCMakePresets.jsonandd3d12_draw.inl. In the latter, please keep #3874’s candidate-failure injection and same-process retry outside the library load path, and derive the library key from the VS/PS blobs of the translation actually used for each attempt. That preserves the disk fallback when the candidate fails.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.