D3D12.X: preserve rect-list GS when a cached graphics PSO blob is stale #2044
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2044
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2044/head"
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?
@RandomGithub12309 on GitHub · 2026-11-25 01:48 UTC · original
RandomGithub12309:d3d12x/preserve-rect-gs-on-stale-pso-blob→main· +156 −29 · 1 files · 1 commits · merged 2026-11-25 02:03 UTCPart of #1269. Fix two caching/retry bugs in
translated_graphics_pso_once(crates/xcl/src/hle/d3d12x/real.rs) introduced with graphics PSO blob caching in #1836:rect_gsbefore retrying uncached:retry_without_rect_gsran inside the firstdriver_compile_identifiedcall whilecopy.CachedPSOwas still attached. When a cached blob was stale or rejected,retry_without_rect_gsclearedcopy.GSimmediately and retried with the staleCachedPSOstill set; the subsequent uncached retry then compiled withoutrect_gseven when the driver acceptedrect_gs, andnote_rect_list_gsskipped registering the PSO.rect_gsfallback poisoned the with-GS blob cache: when the driver rejectedrect_gsandretry_without_rect_gssucceeded withcopy.GScleared, the no-GS driver blob was still cached in memory and on disk undergkey(which hashedrect_gs = Some(...)), causing future lookups to feed a no-GS blob into a with-GS pipeline description.What is in it
crates/xcl/src/hle/d3d12x/real.rs:create_graphics_pso_cached+GraphicsPsoBuildand call it fromtranslated_graphics_pso_once:create(copy)directly without strippingrect_gs; only on failure evict the stale blob, clearcopy.CachedPSO, and fall back toretry_without_rect_gswithcopy.GSintact.cache_eligiblefalse whenrect_gswas dropped during fallback (rect_gs && copy.GS.pShaderBytecode.is_null()), so the with-GSgkey/ disk entry is never overwritten with a no-GS blob.graphics_blob_tests:stale_cached_graphics_blob_preserves_rect_list_gs_on_retryrect_list_gs_fallback_does_not_cache_under_with_gs_keyvalid_cached_graphics_blob_reuses_without_retryTested
rustc 1.100.0 (0ef1bc386 2026-11-09)stable-x86_64-pc-windows-msvc, Windows SDK DXC 1.8.2502.11 (debug for workspace build/tests, release forsmoke.ps1).cargo build --workspace: ok.cargo test -p xcl --lib hle::d3d12x::real::graphics_blob_tests -- --test-threads=1at27b54e1: 5 passed, 0 failed, 0 ignored (0 skipped).cargo test --workspace -- --test-threads=4 --skip fuzz_validate_and_gpuat27b54e1: 1110 passed, 0 failed, 46 ignored across all workspace targets (xcllib:1061 passed, 0 failed, 26 ignored; integration + e2e targets:49 passed, 0 failed, 20 ignored, includinge2e:3/0/0).SKIPPEDon this adapter (wave32-only, Developer Mode off,XCL_HEAP_WINDOWSunset): wave64-only GPU tests, per-lane wave32 f16/f32 conversion refusals,shaders::tests::pso_measurement_compiles_an_exact_synthetic_record, andheap_window_out_of_memory_falls_back_to_the_switch_form.gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_{0..3}due to the pre-existing RTX 500x8007000ECreateComputePipelineStatefailure tracked by #1905.scripts/smoke.ps1release build at27b54e1vsmain(3da2abb).Regression run
Not tested
AI use
scripts/smoke.ps1regression runs were executed on the hardware listed above.@raylitebull on GitHub · 2026-11-25 01:54 UTC · original
Code review on
27b54e1:create_graphics_pso_cachedcleanly separates cached-blob eviction (on_stale_cache+ clearingcopy.CachedPSO) fromretry_without_rect_gs, ensuring a staleCachedPSOdoes not stripcopy.GSon retry and that a no-GS fallback PSO is never cached under the with-GS key (cache_eligible = retried >= 0 && !dropped_rect_gs).stale_cached_graphics_blob_preserves_rect_list_gs_on_retry,rect_list_gs_fallback_does_not_cache_under_with_gs_key,valid_cached_graphics_blob_reuses_without_retry) cleanly pin every branch.PR descriptionis green; awaitingBuild and test+ AMD & NVIDIA verification on27b54e1.@WebIdentity1 on GitHub · 2026-11-25 01:56 UTC · original · edited 2026-11-25 01:58 UTC
Independent RTX 3090 and AMD iGPU driver/pixel verification of exact
27b54e172db07fb76233ef8408127a293b092912. The stale-cache retry keeps the rectangle GS and renders all 256 pixels; a local replay of the previous retry order drops it and renders only 120.Tested
Windows 10 Home 19045, Ryzen 7 7800X3D, Rust/Cargo 1.98.1 x64 MSVC, DXC/DXIL 1.8.2502.11, debug. GPUs selected explicitly by
XCL_ADAPTERand printed from the device's adapter: RTX 3090 driver591.74 (32.0.15.9174), AMD Radeon(TM) Graphics iGPU32.0.21030.2001.The local 99-line test-only overlay below calls the unchanged
create_graphics_pso_cachedwith realID3D12Device::CreateGraphicsPipelineState, then draws using that returned PSO viarunner::draw_on. The VS/PS are synthetic; GS comes from the project's actualemit::rect_list_gs. Three corners must fill a 16×16 target with the exact expected color in every pixel.Identical results on both GPUs:
(cached blob present, GS present, HRESULT)(false,true,S_OK)(true,true,E_INVALIDARG),(false,true,S_OK)GetCachedBlob(true,true,S_OK)reused=true; no eviction callback(true,true,E_INVALIDARG),(true,false,E_INVALIDARG),(false,false,S_OK)E_INVALIDARGis0x80070057. The 32-byte malformed blob is deliberately synthetic, not a driver-version-mismatched retail cache. The last row copies the previous two-stage retry ordering into the local test; it is not a run of a parent checkout. Each GPU performed four draws. The fixed path also avoids the old order's extra failed creation request; no timing claim.Commands:
XCL_ADAPTER=3090:cargo test --locked -p xcl --lib -- hle::d3d12x::real::graphics_blob_tests --test-threads=1 --show-output— 6 passed / 0 failed / 0 ignored / 0 skipped, including the existing five unit tests and new GPU probe.XCL_ADAPTER=AMD:cargo test --locked -p xcl --lib -- gpu_stale_rect_blob_preserves_full_rectangle --test-threads=1 --show-output— 1 / 0 / 0 / 0.All 317 source hashes matched before/after and the local worktree; XCL recompiled. Runtime source is unchanged; no competing implementation.
Not tested
Full workspace, retail smoke/gameplay, actual disk eviction/write wiring, the outer translated-console-PSO path and rectangle-PSO registration, genuine hardware rejection of a valid rectangle GS, debug-layer validation, or compile time/memory. The helper's scheduling/timing wrapper is a trivial test callback and eviction is counted, not performed against disk. The no-GS cache-eligibility fallback remains covered by the author's mock unit test, not a deliberately invalid GS on hardware. Existing full-suite/retail gates remain separate. The local diagnostic requires its GPU; it is not proposed unchanged for GPU-less CI.
AI use — Codex (GPT-6) inspected the source, wrote this test-only driver/pixel probe using existing project helpers, ran both GPUs, verified traces/pixels/source hashes, and drafted this report. The runtime fix remains the PR author's work.
Local reproduction patch, 99 test-only lines