D3D12.X: empty shader slots keep a two-pass mesh pipeline's cache key #2975
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!2975
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2975"
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?
@treybertram06 on GitHub · 2026-11-27 06:13 UTC · original
treybertram06:nv-two-pass-mesh-key→nvidia-dev· +38 −0 · 1 files · 1 commits · openTarget:
nvidia-dev. Part of #2688 and #2088.two_pass_stream_keygave up on any shader subobject whose code it couldn't read. The retail title's mesh pipelines carry empty DS, HS and GS slots (D3D12_SHADER_BYTECODEof length 0) beside the MS and PS. So the passthrough mesh pass of every two-pass pipeline never had a cache key, never kept a driver blob, and was compiled again on every launch.A shader slot with no code (null pointer, length 0) is no shader. It's now skipped, as zero stream-output, input-layout and view-instancing subobjects already are. A slot that names an address with length 0 is refused by the driver (
E_INVALIDARG), so it keeps no key and can't take a valid pipeline's cached blob (thanks @luckyteagirl). A slot that names code that can't be read still has no key.What is in it
D3D12.X: empty shader slots keep a two-pass mesh pipeline's cache key(hle/d3d12x/real/two_pass_identity.rs), with the testempty_shader_slots_do_not_take_the_key_away. The test fails without the fix (two_pass_stream_keyreturnsNone), and its live-pointer, zero-length assertion fails under a length-only rule.Tested
RTX 3080 10 GB (driver 621.40), Ryzen 9 5900X, 64 GB RAM, Windows 11 26300. Debug tests, release title runs.
How it was found: a local diagnostic logged the subobjects of every mesh pass without a key. All of them were
0 25(MS) 2(PS) 14 3 4 5 8 9 10 21 17 12 15 16, with types 3, 4 and 5 (DS, HS, GS) empty.Retail title, warm cache, the same settings, up to 700 s:
The fast ones still compile: they're below the keep threshold by design. The "after" run also had
XCL_TEXTURE_LEVEL_PAGES=1, so the wait times aren't a clean A/B. The compile time is.cargo test --workspace --no-fail-fast -- --test-threads=4, withXCL_DXC_DIRset to DXC 1.9, at this PR's head4e52050c: 1822 passed, 11 failed, 48 ignored.nvidia-deva5e2d851without this change. I checked each one there:two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs,async_compute_pso_registers_real_pso_and_not_standin,split_compute_prefers_the_offline_whole_pipeline(2),console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, the threetest_title_*debug-layer and DRED e2e tests, andtexture_upload::tests::{gpu_parts_of_a_texture_go_up_and_the_rest_stays, pieces_hold_the_texels_of_their_levels}.SKIPPED: theno wave64tests, plus one that needsXCL_HEAP_WINDOWS=1.cargo test -p xcl --lib two_pass_identity: 5 passed. The new test fails without the fix.Regression run
Base, a commit of
main:b49be183, the lastmaincommit before #2555's launch preparation gate. On currentmainthat gate takes hours with this title on this card. The PR's base onnvidia-dev,a5e2d851, made 1,448 frames with a peak commit of 17,888 MB in the same 60 s, with no removal and no crash.This PR's head:
Not tested
AI use
@andrewDoing on GitHub · 2026-11-27 06:28 UTC · original
I checked the empty DS/HS/GS slot case with native two-pass execution on RTX 5070 / NVIDIA 616.92. The same synthetic fixture was built separately against
nvidia-devparenta5e2d851a503fc0e04609f773ea53f2d2c4e3269and head346f671aba48f190d9b3661cefc018caef5af04f. Each revision used its own initially empty XCL cache.The cache counters were parent cold
0 hits / 0 rejects / 1 save, warm1 / 0 / 0; head cold0 / 0 / 2, warm2 / 0 / 0. All four processes checked both the clear color and the rendered red pixels after the compute and mesh passes. The cold admission threshold was deliberately forced to zero; the warm process used the default threshold.This is synthetic cache and GPU execution evidence. It does not resolve the broader integration-test failure reported on both revisions or establish retail startup timing.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the checks; Codex reviewed and prepared this report.
346f671abato4e52050cea@luckyteagirl on GitHub · 2026-11-27 07:18 UTC · original
On
346f671a, the length-only check can evict a valid mesh cache entry. The MS translation forwards VS/CS/GS payloads to the driver unchanged. A zero-length GS with a non-null bytecode pointer therefore gets the same key as an absent GS. When that key is warm,build_two_pass_psotries the valid blob and evicts it on failure before retrying the invalid stream without a blob.I checked this with a synthetic triangle mesh PSO on RX 6800M and Microsoft Basic Render Driver. With the baseline PSO's blob loaded, adding a null/zero GS succeeded. With a live non-null pointer and the same zero length, creation returned
E_INVALIDARGboth with and without the blob. VS and CS gave the same results.Could the key skip only null/zero slots? That preserves the empty DS/HS/GS case and leaves the non-null/zero stream on the uncached path. A unit test can vary just the pointer in the existing GS fixture.
AI use: OpenAI Codex (GPT-6.2 Sol) traced the cache path, ran the native D3D12 probe, and drafted this comment.
@treybertram06 on GitHub · 2026-11-27 07:20 UTC · original
@luckyteagirl Thanks, you're right: a slot with an address and length 0 is invalid, not empty, and must not share the key of the stream without it. Fixed in
4e52050c(squashed into the one commit). Only a slot whose pointer and length are both 0 is skipped now; a non-null pointer with length 0 leaves the stream without a key, so it takes the uncached path.empty_shader_slots_do_not_take_the_key_awaynow also builds the GS slot with a live pointer and length 0 and asserts no key. That assertion fails with the previous length-only rule and passes now (cargo test -p xcl --lib two_pass_identity: 5 passed).The title's empty DS/HS/GS slots are null and zero, since its pipelines are created, so the effect on it is unchanged. I'll rerun the smoke and the suite on the new head and update the description.
AI use: Claude Code (Claude Opus 5.5) made the change and wrote this reply.
@SzczepanGrela on GitHub · 2026-11-27 07:36 UTC · original
RX 9070 / Wine check of the stricter null/zero rule at
4e52050cea54dec0493482f429f246c1ea1e9362. The exact head passes. An automatic application to current main still keeps main's older length-only rule.Tested
RX 9070 16 GB, RADV GFX1201 / Mesa 26.3.1, Ryzen 7 7700, CachyOS 7.3.0-5, GE-Proton11-12 / Wine 11.0 Staging, vkd3d-proton
8293130ebe370b1+with local asserts-disabled build, DXC/DXIL 1.9.2602.17, Rust 1.97.1 Windows-GNU release. Network off, explicit adapter, private enabled caches. Source copies had test-only additions.The actual parent was
a5e2d851a503fc0e04609f773ea53f2d2c4e3269; the targetnvidia-devhad advanced toe0821b12. Main was83b008188efbf954b846667f48d75e3fa9310a01.Built each source with
cargo test --offline --locked --release --target x86_64-pc-windows-gnu -p xcl --lib --no-run, then ran the PE under Wine withhle::d3d12x::real::two_pass_identity::tests:: --nocapture --test-threads=1and=4. The new test was copied unchanged to parent and main; existing assertions were preserved.a5e2d8514e52050c83b00818The one-file
git merge-fileintegration returned 0 and was tested without manual repairs. It retains main'sBytecodeLength == 0continuation after adding the new guard. The failing test there isempty_shader_slots_do_not_take_the_key_away, at its final live-pointer/zero-length assertion. This needs attention when rebasing onto main.Native GPU probe
Three fresh full processes per source plus a pilot per source tested a native mesh triangle with no extra slots, individual empty VS/DS/HS/GS/CS/AS slots, all six together, and each individual slot with a live pointer and zero length. Direct native creation used the exported base PSO blob or no blob, independently of XCL key eligibility.
On this Wine/vkd3d stack, all 368 PSO creations, including seeds, succeeded. In particular, all 144 live-pointer/zero-length attempts succeeded, with and without the blob. They produced the expected image, so this stack does not reproduce the reported Windows
E_INVALIDARGbehavior.A separate Python oracle verified the canonical FNV field serialization from captured streams and shaders, all 376,832 readback words from 352 mesh draws and 16 clear-only controls, and repeat/source parity. Zero ignored or skipped tests; no device removal.
Not tested
Production two-pass cache lookup/admission/eviction, console shader translation, retail workload, smoke run, full workspace suite, native Windows or performance impact. These native blob probes establish driver behavior and pixel results, not end-to-end XCL cache reuse.
AI use
OpenAI Codex (GPT-6; exact serving variant not exposed) reviewed the public change, wrote and ran the fixture and independent verifier, and drafted this report. Publication authorized by the account owner.
@andrewDoing on GitHub · 2026-11-27 08:28 UTC · original
I checked warm-cache preservation on RTX 5070 / NVIDIA 616.92 using updated head
4e52050cea54dec0493482f429f246c1ea1e9362and a synthetic two-pass mesh stream with a live-pointer, zero-length GS slot.For each of synchronous and asynchronous pipeline creation, I used a separate empty XCL cache and three fresh processes: seed a valid null/zero-slot stream with forced admission, submit the non-null/zero stream against that warm cache, then submit the valid stream again with default admission. In both modes the seed saved compute and passthrough mesh blobs, their file SHA-256 values were unchanged after the malformed attempt, and the final valid process reused both blobs and produced the expected rendered pixels.
The malformed attempt took different paths:
E_INVALIDARG; its cache counters showed zero hits, rejects, and saves.This checks the XCL cache lifecycle in the fixture, rather than a retail workload or startup performance. The sync/async difference concerns malformed input and was not established as a regression from this PR.
AI use: OpenAI Codex with GPT-6.2 Astra built and ran the controls; Codex reviewed and prepared this report.
@Decodere on GitHub · 2026-11-27 08:29 UTC · original
Independent desktop NVIDIA verification of PR #2975 at head
4e52050cea54dec0493482f429f246c1ea1e9362(1commit; exact parent & merge-base:a5e2d851a503fc0e04609f773ea53f2d2c4e3269onnvidia-dev).Environment
7956 MiBreported by D3D12), driver32.0.16.2114(NVIDIA621.14, WDDM 3.2)31.9 GiBusable), Windows 11 Home26200(Developer Mode off)rustc 1.100.0 (0ef1bc386 2026-11-09)MSVC, DXC1.9.2609.5,--releaseTargeted release tests & build (
4e52050c)cargo test --release -p xcl --lib -- hle::d3d12x::real::two_pass_identity::tests::empty_shader_slots_do_not_take_the_key_away --exact --nocapture(3 consecutive runs)1 passed; 0 failed; 0 ignored; 1727 filtered out× 3 (0.02s× 3,0skipped — verified empty null/length-0 DS/HS/GS slots preserve the MS+PS key while null/length-16 and non-null/length-0 slots still returnNone)cargo test --release -p xcl --lib -- hle::d3d12x::real::two_pass_identity:: --test-threads=1 --nocapture(3 consecutive runs)5 passed; 0 failed; 0 ignored; 1723 filtered out× 3 (0.02s× 3,0skipped:canonical_stream_key_distinguishes_state_samplers_and_driver,canonical_stream_key_normalizes_padding_and_rejects_pointer_subobjects,empty_shader_slots_do_not_take_the_key_away,two_pass_cs_key_changes_with_samplers_and_driver,two_pass_keys_cover_mem_windows_invalid_counts_and_duplicates)cargo test --release -p xcl --lib -- hle::d3d12x::real:: --test-threads=1 --nocapture(3 consecutive runs)96 passed; 0 failed; 0 ignored; 1632 filtered out× 3 (2.79s,2.77s,2.74s,0runtime skips)cargo build --release -p xcl2m 06s, exit0,0new warnings intwo_pass_identity.rs)Paired quiet 60 s retail smoke (
title: 29640639,XCL_PREPARE=0 XCL_NETWORK=0)Exact parent & merge-base (
a5e2d851a503fc0e04609f773ea53f2d2c4e3269,XCL_PREPARE=0 XCL_NETWORK=0):PR #2975 (
4e52050cea54dec0493482f429f246c1ea1e9362,XCL_PREPARE=0 XCL_NETWORK=0):Limits of coverage
empty_shader_slots_do_not_take_the_key_away3/3, fulltwo_pass_identity::5/5× 3, and fullhle::d3d12x::real::96/96× 3,0skipped) on Windows 11 + RTX 4060.XCL_PREPARE=0(XCL_NETWORK=0), bypassing startupprepare_for_launch, and verified single-run startup/menu stability (0device removals,0crashes,18955translated draws /1024dispatches with0skipped); did not measure back-to-back multi-launch 700 s world-load mesh-pass driver cache hit time savings.AI disclosure: test execution and report drafting assisted by Google Antigravity (Gemini 4 Neon).
@JJAutoCompare on GitHub · 2026-11-27 12:17 UTC · original
Tested
Clean
4e52050cea54dec0493482f429f246c1ea1e9362on Windows 11 build 26200.9974, Ryzen 7 3800X, Rust 1.100.0 MSVC, Intel Arc A770 driver 32.0.101.9175, DXC/DXIL 1.9.2602.17. Built the exact-head library withcargo test --locked -j 2 -p xcl --lib --test gpu_two_pass_cache_e2e --no-run --message-format=jsonand ran the linkedarc-fixture.exe --nocapture --test-threads=1withXCL_ADAPTER=A770and synchronous PSO creation.Two independent cold/warm pairs used fresh cache roots. One seeded absent DS/HS/GS then passed null/zero slots on the warm run. The other ran the reverse order. Cold was 0 hits, 0 rejects, 2 saves in each pair. Warm was 2 hits, 0 rejects, 0 saves, with both driver-blob SHA-256 values unchanged. Every process matched all 64 expected clear and draw pixels and retained a healthy device.
Four passed, zero failed, ignored, or skipped. Each process held the shared Arc mutex and matched the executable hash before, under, and after the lock.
Not tested
Native parent, async path, startup timings, malformed driver input, full suite and retail smoke.
AI use
T3 Code / Codex (
gpt-6.2-sol) ran the original verification, independently reproduced the cases reported here, and wrote this report.@LocranKing on GitHub · 2026-11-27 12:20 UTC · original
Tested PR #2975 (
4e52050c) on Windows 11 againstorigin/nvidia-dev(3f39671d) across a cold/warm two-pass pair into the world plus the new unit test.Environment
32.0.16.2140)nvidia-devDXIL cache (XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=1,XCL_TEXTURE_LEVEL_PAGES=1,XCL_PREPARE_GRAPHICS=0,XCL_DRED=1), Series S (lockhart) profile,180 sscripted runs into the open world.Unit test
cargo test --locked -p xcl --lib -- empty_shader_slots_do_not_take_the_key_away --nocaptureon4e52050c:hle::d3d12x::real::two_pass_identity::tests::empty_shader_slots_do_not_take_the_key_away— ok (1 passed, 0 failed)Cold -> Warm Two-Pass Smoke Results (
180 s,lockhart)For the warm run (
33d), thedxil/drivercache produced by the first#2975run (33c) was preserved while resetting title state/used cache to the frozen seed.PresentX)passthrough mesh graphics pass PSOcompilesdriver blob supplied/absentb390e996711d4326)nvidia-devbase (3f39671d)0x00 / 01857123.34 s0driver-cache lookups logged0 / 027152 / 9914 MB#2975cold 2-pass (4e52050c)0x00 / 01911118.24 s45(39unique records)6/3913,194 ms11,398 ms(absent)27886 / 9930 MB#2975warm 2-pass (4e52050c)0x00 / 01893114.97 s45(39unique records)7/382,704 ms659 ms(supplied)28747 / 9825 MBSummary
origin/nvidia-dev(3f39671d), passthrough mesh graphics pass PSOs had no driver-cache key at all (0lookups).#2975, all45passthrough mesh graphics pass compiles (39unique records) received cache keys. On the warm second launch, the slow317,956 Bpassthrough pipeline (record b390e996711d4326) loaded its kept driver blob (driver blob supplied) and dropped from11,398 msto659 ms(17.3x faster), cutting total passthrough compile time from13,194 msto2,704 ms(-79.5%; the remaining38fast ones under ~60 ms stay uncached below the keep threshold as intended).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.