Skip to content

[upstream #1788] Recompiler: defer cold direct DXIL during compute PSO cache probes - #346

Draft
ufoptg wants to merge 3 commits into
mainfrom
upstream-pr/1788
Draft

ufoptg wants to merge 3 commits into
mainfrom
upstream-pr/1788

Conversation

@ufoptg

@ufoptg ufoptg commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Part of xcl-dev#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.

Mirror of xcl-dev#1788 (auto-synced, do not edit).

raylitebull and others added 3 commits November 24, 2026 21:05
…-oom

dxil: eliminate giant-shader IR and CFG blowup in FormatLoad and multi-window memory
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants