Skip to content

Recompiler: defer cold direct DXIL during compute PSO cache probes - #1788

Closed
cansolele wants to merge 1 commit into
xcl-dev:mainfrom
cansolele:defer-direct-dxil-cache-probe
Closed

cansolele wants to merge 1 commit into
xcl-dev:mainfrom
cansolele:defer-direct-dxil-cache-probe

Conversation

@cansolele

@cansolele cansolele commented Nov 24, 2026 •

Copy link
Copy Markdown

Part of #1269. On a translated-cache miss, direct DXIL compute translation now defers during the cached-only probe. This lets async CreateComputePipelineState return a stand-in while keeping RAM and disk cache hits inline. Base main commit: 4178e888c0b5be50a2887eda45cdb832763b68a4.

What is in it

  • pso.rs calls dxc::defer() after the translation cache lookup and before direct compute translation. gpu_compute_e2e.rs exercises probe, cache, bind, and HLSL fallback behavior with synthetic shaders and GPU readback. README.md documents async direct compute support.

Tested

  • Ryzen 5 7500F, RTX 5060 Ti 16 GB (NVIDIA 617.42), Windows build 26300, Rust 1.96.0 (x86_64-pc-windows-gnu).
  • cargo test --workspace -- --test-threads=4 via scripts/test.ps1 on 03d321d: 892 passed, 0 failed, 42 ignored. GPU skips reported by the harness: two native wave64, one heap windows. XCL_SAMPLE_* unset.
  • cargo test --release -p xcl --test gpu_compute_e2e direct_compute_pso_cached_only -- --exact --nocapture: 1 passed with no skips. The cold probe and cold creation assertions both failed on main with the same test.
  • Synthetic release benchmark, warm driver cache, 40 samples per seed and variant, two seeds. p95 CreateComputePipelineState return fell from 2.02–2.12 ms to 0.40–0.41 ms. Time to the real PSO rose from 2.02–2.12 ms to 2.51–2.60 ms. Immediate first SetPipelineState rose from 9–13 µs to 1.81–2.08 ms.
  • Independent focused GPU regression by @vitor127wt on the PR head: 1 passed, 0 failed, 0 ignored, 0 skipped. The Windows release test binary ran under Proton Experimental 11.0 on CachyOS, with a Ryzen 7 9700X and RTX 5070 Ti (NVIDIA 620.73.04). It exercised the cached-only probe, cache hits, first bind, dispatch readback, and HLSL fallback.

Regression run

@vitor127wt ran the independent retail smoke pair on Linux under Proton using scripts/linux/smoke.sh from #257. Both runs used the same title, 150 seconds, XCL_DIRECT_DXIL=1, XCL_HEAP_WINDOWS=1, and default lazy PSOs.

The main run showed 2,126 frames and the PR run showed 1,822 frames (−14.3%). Linux cgroup peak memory rose from 14.72 GiB to 15.70 GiB. Both runs exited normally with zero crashes, device removals, or OOM kills. All 24 matching compute cache keys had byte-identical DXIL, with zero HLSL fallbacks.

The blocks below preserve the report's measurements and use the anonymized title identifier 9cc6a39e. Wine reported peak commit: 0 MB for both runs. The Linux cgroup peaks are a separate measurement. This is one pair under Proton with default lazy PSOs, so the cause of the lower frame count is undetermined. Maintainer confirmation is pending on whether the Proton smoke pair satisfies the Windows scripts/smoke.ps1 requirement.

main:

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 150
exit: 0x0
frames shown: 2126 (PresentX 2126)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

PR:

xcl-smoke v1
commit: 03d321d823ef03d70a2387c680340f0deb8b9d31
gpu: NVIDIA GeForce RTX 5070 Ti
title: 9cc6a39e
seconds: 150
exit: 0x0
frames shown: 1822 (PresentX 1822)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

Follow-up with XCL_LAZY_PSO=0

In the updated independent report, @vitor127wt reran the same title and settings under Proton with XCL_LAZY_PSO=0 on both revisions. Each attempt used a fresh prefix and empty cache. The memory scope was capped at 16 GiB with no swap.

Run End Presents Linux cgroup peak
main (4178e88) 0x3 at 100.915 s 999 in completed activity bins 10.29 GiB
main retry (4178e88) 0x3 at 101.073 s 970 in completed activity bins 9.89 GiB
PR (03d321d) 0x0 after 150 s 1,916 16.00 GiB

Both baseline attempts logged the same stack through d3d12core.dll+0x87333 and winevulkan.dll+0x11050. The early exits prevented the smoke script from producing end-of-run summaries or blocks for main. The PR's last active present interval ended at 124.035 s. The PR reached the cgroup cap and completed with zero OOM kills, crashes, or device removals.

The PR logged 117 direct compute translations and zero HLSL fallbacks. For each baseline attempt, all 100 shared compute cache keys had byte-identical DXIL. The different run lengths and frame-count sources prevent a like-for-like 150 s frame or FPS comparison. The cgroup peaks cover different amounts of runtime work. The cause of the baseline exits and of the higher PR memory peak remains open. The standalone follow-up block is in the linked report. The paired blocks above are from the original default-lazy run.

Not tested

  • AMD, native wave64, and MSVC.
  • Paired retail smoke runs using scripts/smoke.ps1 on native Windows. The Proton follow-up did not yield a completed 150 s baseline with XCL_LAZY_PSO=0.

AI use

  • Codex, GPT-6.2 Sol, development, analysis, and testing.
  • Codex (GPT-6, exact variant unavailable for this update) verified and transcribed the independent reports, analyzed the follow-up, and drafted the PR updates. The report includes its own AI disclosure.

The direct compute path bypasses DXC and its cached-only check. Defer after a translated-cache miss so async creation can return a stand-in. Translate or fall back when the PSO build runs.

On an RTX 5060 Ti with a warm driver cache, synthetic p95 CreateComputePipelineState fell from 2.02–2.12 ms to 0.40–0.41 ms. Immediate first bind rose from 9–13 us to 1.81–2.08 ms.

Assisted-by: Codex (GPT-6.2 Sol)
@cansolele

Copy link
Copy Markdown
Author

If anyone with a suitable retail title is available to help with the required paired smoke runs, I would really appreciate it.

  • Baseline: 4178e888c0b5be50a2887eda45cdb832763b68a4
  • PR head: 03d321d823ef03d70a2387c680340f0deb8b9d31
  • Same title, settings, and duration for both runs.
  • Preferably XCL_DIRECT_DXIL=1 and XCL_LAZY_PSO=0 to exercise the affected path.

Please share both xcl-smoke blocks here.

Thanks for your help!

AI use: ChatGPT assisted with drafting this comment.

@vitor127wt

vitor127wt commented Nov 24, 2026 •

Copy link
Copy Markdown

Requested retail smoke pair — RTX 5070 Ti / Proton

With XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 and default lazy PSOs, both 150 s runs exited 0x0 with no crashes or device removals. The PR showed 1,822 frames (85.7% of the base's 2,126 in this pair). The last two-second activity bin with presents ended near 106.0 s on the base and 94.2 s on the PR. Both runs used 24 matching compute cache keys, with byte-identical DXIL and zero HLSL fallbacks.

Tested

  • RTX 5070 Ti 16 GB, NVIDIA 620.73.04, Ryzen 7 9700X, 32 GB DDR5, CachyOS 7.3.5-2-cachyos, Proton Experimental 11.0 (experimental-11.0-20261112-x86_64). vkd3d-proton ec207194 with the Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257 patch, dxil-spirv 7c048638, and DXC 1.9.2609.5. Clean x64 Windows release builds using Rust 1.100.0 and LLVM-MinGW 20261117 (x86_64-pc-windows-gnullvm).
  • Built with cargo build --locked --release --target x86_64-pc-windows-gnullvm -p xcl --bin xcl. Ran scripts/linux/smoke.sh "$PROTON" "$PREFIX" "$GAME" 150 from Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #257. Each run used the same retail title, a separate fresh Wine prefix and shader cache, networking off, and A presses scheduled every three seconds. XCL PSO cache blobs and vkd3d-proton/NVIDIA disk shader caches were disabled. Both used XCL_DXC_THREADS=2, XCL_PSO_TRACE=1, and XCL_DIRECT_DXIL_STATS=1. The smoke scope was capped at 16 GiB RAM with no swap.
  • Built the integration test with cargo test --locked --release --target x86_64-pc-windows-gnullvm -p xcl --test gpu_compute_e2e --no-run. On the PR head, ran the Windows test binary in Proton Wine with direct_compute_pso_cached_only --exact --test-threads=1 --nocapture. 1 passed, 0 failed, 0 ignored, 0 skipped. This exercises the cold cache-only probe, cache hits, first bind, GPU readback, and HLSL fallback.

Regression run

The Wine smoke script generated both blocks. I abbreviated the local folder name in title.

main

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 150
exit: 0x0
frames shown: 2126 (PresentX 2126)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

PR head

xcl-smoke v1
commit: 03d321d823ef03d70a2387c680340f0deb8b9d31
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 150
exit: 0x0
frames shown: 1822 (PresentX 1822)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

Wine reported 0 MB in the Windows peak-commit field. The Linux cgroup peaks were 14.72 and 15.70 GiB, respectively, with no OOM kill. This is one title run per revision with default lazy PSOs. The focused integration test exercises the non-lazy cache-only path directly.

AI use — OpenAI Codex (GPT-6, exact variant unavailable) built and ran the checks, verified the logs, and drafted this report.

Follow-up with XCL_LAZY_PSO=0

I repeated the 150 s retail runs at the same commits and with the same settings, adding XCL_LAZY_PSO=0 to both. I repeated main once after its early exit, using another fresh prefix and empty cache. The title, scheduled inputs, Proton NVIDIA stack, XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 and the 16 GiB RAM/no-swap scope were held fixed. I checked the flags in the running Wine processes. Test request

Run End Presentations Linux scope peak
main 4178e888c0b5be50a2887eda45cdb832763b68a4 0x3 at 100.915 s 999 in completed activity bins 10.29 GiB
Same main, retry 0x3 at 101.073 s 970 in completed activity bins 9.89 GiB
PR 03d321d823ef03d70a2387c680340f0deb8b9d31 0x0 after the 150 s window 1,916 16.00 GiB

Both base attempts logged the same stack through d3d12core.dll+0x87333 and winevulkan.dll+0x11050. The early exits left the Wine smoke script without its end-of-run frame summary or an xcl-smoke block, so the two base counts come from summing the logged two-second activity bins. The PR's last bin with presents ended at 124.035 s. It reached the scope memory limit and finished with zero OOM kills, crashes, or device removals.

The PR logged 117 direct compute translations and zero HLSL fallbacks. For each base attempt, all 100 compute translation cache keys shared with the PR had byte-identical DXIL. The early exits leave the 150 s frame-count difference unresolved with lazy PSOs disabled.

The Wine smoke script generated this block for the PR. I abbreviated the local folder name in title.

xcl-smoke v1
commit: 03d321d823ef03d70a2387c680340f0deb8b9d31
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA6.Xbox.v1.0.2.1
seconds: 150
exit: 0x0
frames shown: 1916 (PresentX 1916)
presents per 2 s (last 3): 0 0 0
device removals: 0
crashes: 0
peak commit: 0 MB

AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the follow-up and checked the logs and cache entries.

@cansolele

cansolele commented Nov 24, 2026 •

Copy link
Copy Markdown
Author

Thanks, @vitor127wt, for running the paired retail smoke and focused GPU regression tests. If you have time, could you repeat both retail runs with XCL_LAZY_PSO=0 and the other settings held fixed? That would help clarify whether the frame-count drop reproduces with lazy PSOs disabled.

Maintainers, could you confirm whether the Linux/Proton xcl-smoke blocks count toward the required paired Windows scripts/smoke.ps1 runs? The original blocks report 0 MB for Wine's peak commit field, and the Linux cgroup peaks are documented separately in the PR description.

AI use: GPT-6 helped me put my thoughts into words and translate this comment into English.

@ivall ivall added the goal:world-load Bears on the retail title getting past world loading label Nov 24, 2026
@cansolele

Copy link
Copy Markdown
Author

Thanks, @vitor127wt, for rerunning both revisions and retrying main. With XCL_LAZY_PSO=0, both baseline runs exited with 0x3 near 101 s at the same reported stack, while this PR finished the 150 s window and reached the 16 GiB cgroup limit without an OOM kill, crash, or device removal. All 100 shared compute cache keys matched byte for byte in each comparison. The run lengths differ, and the cause of the baseline exits is still open.

If the logs are still available, could you share the last few PSO trace lines before each baseline exit and any timestamped memory samples around that point for both revisions? Shader hashes, timing, and counters would be enough.

@Flyander, if you have time, would you be willing to run a native Windows scripts/smoke.ps1 pair for this PR on 4178e88 and 03d321d with XCL_DIRECT_DXIL=1, XCL_LAZY_PSO=0, and identical settings and duration? An anonymized title in the smoke output would be appreciated.

AI use: GPT-6 helped analyze the evidence and draft this comment.

@cansolele

Copy link
Copy Markdown
Author

I'll be offline for a while. Maintainers, feel free to review, test, or make any necessary adjustments to this PR while I'm away.

I'm happy with either integration order for #1788 and #1809, provided the end-to-end GPU regression coverage is preserved.

The remaining testing limitations are documented in the PR description.

Thanks for your time and help!

AI use: ChatGPT assisted with drafting this comment.

@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@cansolele

Copy link
Copy Markdown
Author

The cached-only direct compute issue addressed by this PR has been resolved upstream in #1836.

I'm closing this PR to avoid duplicating changes. The end-to-end GPU regression test remains available in this branch for anyone interested in extending the existing test coverage.

Thanks to everyone who took the time to test, review, and provide feedback. I appreciate your help!

@cansolele cansolele closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

goal:world-load Bears on the retail title getting past world loading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants