D3D12.X: a translated compute program built again gets the driver's blob of its first build #636
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!636
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/636/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?
@ofc0urse on GitHub · 2026-11-24 02:45 UTC · original
ofc0urse:perf/compute-pso-driver-blob→main· +100 −3 · 1 files · 1 commits · merged 2026-11-24 02:49 UTCPart of #505. A retail title creates some of its big compute pipelines more than once while it loads its world (the "built once or twice" in #505). Each creation went through the driver's compiler again, with the title's thread waiting. On an RTX 4060 Ti, 14 programs of 105 – 222 KB of DXIL were each built twice: 3 – 6 s the first time, 13 – 30 s the second.
After a translated compute PSO of 16 KB of DXIL or more is built, its
GetCachedBlobis kept in memory, keyed by the DXIL's hash, the root signature and the flags (512 MB in all at most). When the same program is built again, the blob goes in asCachedPSO. A blob the driver does not take is dropped and the program is compiled as before. Programs under 16 KB are not kept: the driver builds them in milliseconds.What is in it
crates/xcl/src/hle/d3d12x/real.rs:translated_compute_psolooks the program up (compute_blob), passes the blob asCachedPSO, falls back to a plain build when the driver refuses it (forget_compute_blob), and keeps the blob of a new build (keep_compute_blob, the adopted PSO's PCGetCachedBlobthroughorig_fn). A program waiting for a blob does not take aBIG_COMPILESslot. The PSO's log line now gives the build time and says when a blob was used.a_blob_is_found_only_for_the_same_program_root_signature_and_flags_and_is_forgotten.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4onb9f3d0f: 681 passed, 0 failed, 41 ignored. SKIPPED on this adapter (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.105004 B DXIL, 2 ms, the driver's blob of an earlier buildand31940 B DXIL, 0 ms, …where the same programs had taken 13 – 30 s the second time in the run before. No blob was refused by the driver.Regression run
The 60 s run does not reach the world, where the title builds programs a second time, so these show the change does no harm early on; the first run of the PR head showed 1019 frames (its last 6 s at 5 fps), a second run 1417, the block below.
Not tested
GetCachedBlob/CachedPSO.AI use
🤖 Generated with Claude Code
@MesshM on GitHub · 2026-11-24 02:55 UTC · original
Test run of
b9f3d0f3a7d717dcb17229ccac0d0a777bba83fdon AMD RDNA4; the PR was tested on NVIDIA only. I merged it onto currentmain18c105alocally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 690 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 650 passed, 0 failed, 21 ignoredSKIPPED;a_blob_is_found_only_for_the_same_program_root_signature_and_flags_and_is_forgottenpasses. Nothing on this machine builds the same big compute program twice, so the reuse path itself was not exercised here.Review: A refused blob is forgotten and the program compiled as before, and a reused build skips the
BIG_COMPILESslot, which is right since no compile happens. Overlap with #634: both keepGetCachedBlobof translated compute PSOs and both edittranslated_compute_psoaroundfinish_pso, so they will conflict. This one keeps blobs in memory for the run, keyed by DXIL hash, root signature and flags; #634 keeps them on disk between runs, keyed by the DXIL alone. They could be one change (disk-backed, with this PR's fuller key), or stacked.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@thehollowedone on GitHub · 2026-11-24 02:58 UTC · original
Tested
Confirmed a same-process D3D12 driver blob hit on merge
dd2ae9a. I extendedgpu_compute_e2ein a scratch copy with 320 additional output regions and built and dispatched the same synthetic shader twice through the stock XCL pipeline hook. WithXCL_ASYNC_PSO=0, the translated shader was 31,916 bytes of DXIL. XCL logged the first build at 121 ms and the second at 39 ms withthe driver's blob of an earlier build. Those timings are from one pair.Both dispatches matched all 493,056 expected 32-bit values. The focused test passed (1 passed, 0 failed, no runtime skip). The D3D12 debug layer logged no errors and reported live objects at process exit.
Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, DXC 1.8.2502.11, Rust 1.99.1 MSVC, debug. Command
cargo test --offline --locked -p xcl --test gpu_compute_e2e console_wave64_compute_through_the_pso_hook_dispatch_and_read_back -- --exact --nocapture --test-threads=1.Not tested
Async pipeline scheduling, blob rejection, AMD, and retail behavior.
AI use
Codex with GPT-6.2 Sol adapted the test, ran it, and drafted this report.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175