Direct DXIL: compute programs over 1.5 MB of plain DXIL are retried in the compact form #2301
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!2301
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2301"
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?
@Natakout on GitHub · 2026-11-25 13:05 UTC · original
Natakout:perf/direct-compact-kb→main· +49 −0 · 2 files · 1 commits · openPart of #1269. With
XCL_DIRECT_DXIL=1, a compute program belowcompact::large's 20 000 instructions can still produce plain DXIL that the NVIDIA driver never finishes compiling. On NVIDIA, the driver's compile time explodes somewhere between 2 and 4 MB of DXIL. On the retail title of #505, record95cc13288a27a96e(about 8 900 instructions, under the 20 000 cut, andcompact::wanted's duplication ratio refuses it) produces 3 916 120 B of plain direct DXIL. On an RTX 3060, the driver had not finished it after 447 s, and the title binds it during the world load. Its compact form is 1 292 052 B and compiled in 34.5 s.This PR retries such a program in the compact form and keeps whichever form is smaller. The trigger is the plain form's DXIL size, the quantity the driver's compile time actually depends on, rather than the instruction count.
What is in it
crates/xcl/src/gpu/dxil/kernel.rs:translate_entrytranslates a compute or kernel program as before (it is nowtranslate_entry_once). When the DXIL is overXCL_DIRECT_COMPACT_KB(1536 by default,0turns the retry off) andXCL_DIRECT_COMPACTis unset, it translates the program again with the compact form forced. It keeps the compact result if it is smaller, and logs[SHADER] direct DXIL: N B plain over XCL_DIRECT_COMPACT_KB, M B compact kept.XCL_DIRECT_COMPACT=0or1still forbids or forces the compact form as before. A unit test covers the default, an explicit value,0and an invalid value.crates/xcl/src/gpu/recomp/pso.rs: a non-defaultXCL_DIRECT_COMPACT_KBis part of the translated-cache identity, asXCL_DIRECT_COMPACTis.Tested
cargo build --workspacethencargo test --workspace --no-fail-fast -- --test-threads=4atc94ad8a: 1155 passed, 0 failed, 46 ignored. SKIPPED on this adapter: the wave64 GPU comparisons (no wave64), the per-lane forms refused inlower_dxil::tests, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).XCL_DIRECT_DXIL=1, 480 s per run, A pressed every 4 s from 12 to 120 s, caches carried over between runs (one run per row):95cc13288a27a96eDXILmain568e7db(run 1)mainwithcompact::largelowered to 5 000 (run 2)wantedrefuses it)The other giant of that title,
56c0cd3b82a00c6e(22 MB of DXIL through the HLSL path), is already compact onmain(484 508 B) and does not change.On this title, the world load still stops later (presents end after the
#101call, the #505 stall). This PR removes one pipeline the title waited on, not that stall.Regression run
main:This PR (
c94ad8a):Not tested
AI use
Claude (claude-opus-5-5, through Hermes) found the stalled pipeline in the logs and minidumps, wrote the change and its test, ran the builds, tests and title runs on the hardware above over SSH, and drafted this description. Maxime (Natakout) directed the work and asked for the retry to be a setting.
@luckyteagirl on GitHub · 2026-11-25 13:44 UTC · original
Independent Windows verification of exact PR head
c94ad8afe3a74693af1c8b6b98d7efbbd0cfd4dfagainst its base568e7db7729c8fa6c8f0f4b32d798faaf11462bb, using a locally owned 1.0.2.1 shader archive. No game data or generated shader binaries were uploaded.Environment: Windows 11 build 26200; Ryzen 9 5980HX; Radeon RX 6800M driver
30.0.13002.13003; Rust 1.99.0 MSVC; DXC/DXIL 1.9.2609.5. Clean detached PR worktree and isolated Cargo target.Unit/build:
cargo test --locked -p xcl --lib -j 2 the_compact_retry_is_over_1536_kib_unless_set_and_off_at_zero -- --test-threads=1 --show-outputpassed 1/0/0.cargo build --locked --workspace --release -j 2passed on the clean PR head.Exact shader record
95cc13288a27a96e: Withxcl shaders <owned shaders.rpf> --direct --hash 95cc13288a27a96e --validate --threads 1 --timeout 180 --json, the PR head found and validated one compute program. It logged3916120 B plain over XCL_DIRECT_COMPACT_KB, 1292052 B compact kept. Local DXIL dump sizes independently matched 3,916,120 B plain withXCL_DIRECT_COMPACT_KB=0and 1,292,052 B compact at the default threshold (about 67% smaller). Both PR modes returned 1 translated, 0 unsupported, 0 validator failures, 0 panics, and 0 timeouts; neither hit the external 240-second or free-memory guard. The base568e7dbtranslated and validated the same record, without the compact-retry log. These are offline translation/validation checks; they do not measure AMD driver PSO compile time or GPU execution. The local shader dumps were retained only as size evidence and were not attached.Paired owned-title smoke: Same title,
XCL_ADAPTER=6800M,XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0, fresh separate data/cache directories, release binaries, 12 seconds each. Neither run hit my external guard.Base:
PR head:
Limits: The smoke runs cover startup only and did not show this large record being compiled or bound; frame counts are not a performance comparison. I did not measure cold or warm AMD PSO compilation, compact-form GPU time, or a full workspace suite on this head. The offline translator test itself is hardware independent despite running on the RX 6800M host.
AI use: OpenAI Codex (GPT-6; exact variant not exposed in this session) ran the native Windows unit test and release build, monitored the offline shader checks and paired title runs, verified exact revisions and local output sizes, and drafted this report. No game data was uploaded.
@vitor127wt on GitHub · 2026-11-25 14:01 UTC · original
Cold PSO reproduction on RTX 5070 Ti under Proton for record
95cc13288a27a96e, using the exact clean PR headc94ad8afe3a74693af1c8b6b98d7efbbd0cfd4df(parent568e7db7729c8fa6c8f0f4b32d798faaf11462bb). I used the same executable for both conditions.XCL_DIRECT_COMPACT_KB=0disabled the retry in the control.One PSO made with zero refusals in each compact run. The compact DXIL matched byte for byte across the two runs. The control entered vkd3d-proton with the same root signature and an empty pipeline cache. Zero OOM kills in all three runs. The interval from the no-blob message in vkd3d-proton to the Vulkan feedback was 27.264 s and 27.540 s in the compact runs. The 180 s value is the process timeout.
Fresh Wine process, prefix and title-data paths per run. XCL translated and PSO disk caches, vkd3d-proton's shader cache and NVIDIA's shader disk cache were disabled. Each run used a 14 GiB Linux cgroup with swap disabled. This measures a retail compute PSO in the offline CLI. Runtime GPU cost and world-load behavior are outside this measurement.
RTX 5070 Ti (16 GB, driver 620.73.04), Ryzen 7 9700X, 32 GB DDR5, CachyOS 7.3.5-2-cachyos, Proton Experimental
experimental-11.0-20261112-x86_64, vkd3d-protonec20719452e9with #257's patch, dxil-spirv7c048638ab59, Rust 1.100.0, LLVM-MinGW 20261117 and DXC 1.9.2609.5.AI use — OpenAI Codex (GPT-6, exact variant unavailable) ran the tests and drafted this report.
@thiagocalile on GitHub · 2026-11-25 15:50 UTC · original
Independent test and 60 s smoke report for head
c94ad8afe3a74693af1c8b6b98d7efbbd0cfd4dfon an AMD Radeon RX 6600 (8 GB VRAM, RDNA2, native wave64).Tested
32.0.21045.29003,XCL_ADAPTER=radeon), AMD Ryzen 7 5700X3D, 47.9 GB RAM, Windows 11 (10.0.26200.0), Rust1.100.0(stable-x86_64-pc-windows-msvc), DXC1.8.2502.11.XCL_ADAPTER=radeon cargo test --no-fail-fast -p xcl --lib -- compact --test-threads=4: 6 passed, 0 failed, 0 ignored (0skipped).Regression run (
scripts/smoke.ps1 -Seconds 60, release builds,XCL_ADAPTER=radeon)main(06c9f55):PR
#2301(c94ad8a):Not tested: full workspace test suite on this head, NVIDIA/Intel GPUs, Linux/Wine, or world load past the 60 s smoke window.
AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report; the account owner reviewed and approved posting.
@bielfreedom on GitHub · 2026-11-25 16:11 UTC · original
AMD Windows data for #2301: on the RX 9070 XT this change makes two programs that currently build fail instead. On AMD's driver the compact form runs out of memory faster than the plain one. I'd suggest keeping the retry off on AMD, or gating it on the adapter.
Setup
568e7db;c94ad8a.fnv64) and per-CreateComputePipelineStatetime.Method
XCL_DIRECT_DXIL=1,XCL_HEAP_WINDOWS=0,XCL_PIPELINE_THREADS=1.XCL_PSO_DISK_CACHE=0and a fresh exe name per run, because the AMD driver cache is keyed on the exe file name.Census (all 2,689 retail compute programs, translation only): the retry fires on 4 programs on this adapter, and keeps the compact form for all 4.
95cc13288a27a96eActivateRaysc963276f38285bf4f839072880d49fb4219287eb2f6021fe219287eb2f6021fereached 24 GB. In the other round the base run built219287eb2f6021fefirst and reached 24 GB in 32 s, so nothing else finished.Read / inference
XCL_DIRECT_COMPACT_KBto0on AMD adapters, like the adapter guard #2076 ended up with;Not tested
XCL_DIRECT_COMPACT_KBvalues.AI use: Claude Code (Claude Opus 5.5) ran the census and measurements and drafted this. Counts and timings only, no game data.
@komglebissarov on GitHub · 2026-11-25 16:20 UTC · original
AMD RX 9070 XT with 64 GB of RAM, exact head
c94ad8a, heap windows: the retry fires for95cc13288a27a96e(3,345,980 B plain, 1,152,632 B compact kept) and the driver build passes 48 GB in 38 s. It agrees with @bielfreedom's report above and adds the heap form of the windows, a higher memory limit, and whatmain's nested dispatch (#2174) does to the same form.Setup
c94ad8aandmainat0829441, both clean when their exe was built.Method
xcl shaders <folder with the one record> --precompile --only cs --pipelines,XCL_DIRECT_DXIL=1 XCL_HEAP_WINDOWS=1 XCL_PIPELINE_THREADS=1 XCL_PSO_DISK_CACHE=0, a new emptyXCL_DXIL_CACHEand a new exe name per run.c94ad8a, defaultsmain0829441, defaultsmain,XCL_DIRECT_COMPACT=1main,XCL_DIRECT_COMPACT=1 XCL_DIRECT_COMPACT_NEST=0main,XCL_DIRECT_COMPACT=1 XCL_HEAP_WINDOWS=0main, the retried form would be nested. That is the only direct form of this program that built here, and it needs heap windows and 34 GB, so it still does not fit a 32 GB machine. Themainrows force the form withXCL_DIRECT_COMPACT=1; I did not rebase this PR.Not tested
c963276f38285bf4,f839072880d49fb4,219287eb2f6021fe).568e7db(the plain row ismain0829441), GPU output, a title run with this PR, the test suite.AI use: Claude Code (Claude Fable 5.2) made the builds and the runs and wrote this comment; the account owner asked for the report. Counts and timings only, no game data.
@iggyvilla on GitHub · 2026-11-25 16:23 UTC · original · edited 2026-11-25 16:27 UTC
Test report for
c94ad8aon AMD (RX 6650 XT, Ryzen 7 5700X, 32 GB RAM + 64 GB pagefile, Windows).Summary: the retry works exactly as described. On this AMD card, though, the compact form never finishes compiling in the driver, so the world-load stall stays.
Four 360 s world-load walks from the same save, alternating the merge base
568e7dband the PR headc94ad8a(cold then warm translated cache). All four ran withXCL_DIRECT_DXIL=1(without it the retry path is not reached),XCL_PSO_PRELOAD=0,XCL_PSO_WAIT_MS=2000,XCL_NETWORK=0.568e7dbc94ad8a3916120 B plain over XCL_DIRECT_COMPACT_KB, 1292052 B compact kept568e7dbc94ad8adirect DXIL fallback,driver refused,E_OUTOFMEMORY, device-removed or crash lines in any arm.afc5ee8(where the record reaches the driver as 2 420 640 B) showed that compile running at about 100 % of one core insideamdxc64.dllfor 466 s without finishing.The compact retry is still useful (2.4-3x smaller input), but on RDNA2 it does not bring this record under whatever makes the driver's compile not finish.
AI use: the walks were run, and the table numbers collected, by an agent on Muse Spark (Meta). The builds were made by another Muse Spark agent, and a third Muse Spark agent reviewed the diff for which env vars reach the retry path. Claude Code (Claude Sonnet 5.5) ran the 600 s main-branch profile. Claude Code (Claude Opus 5.5) wrote this comment, checked the retry line, the 1 292 052 B starts and the missing finish lines in the two PR-arm logs (the base-arm numbers were not re-checked), and posted it.
@DavidM1911 on GitHub · 2026-11-25 17:29 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Natakout on GitHub · 2026-11-26 01:02 UTC · original
Follow-up from the same machine (RTX 3060,
568e7db+ this PR,XCL_DIRECT_DXIL=1,XCL_HUGE_PSO_CONCURRENCY=8,XCL_DRED=1, warm caches). Now that95cc13288a27a96ecompiles, the world load gets further, but its first dispatches end in a device removal:0x887a0005or0x887a0006, 0.7 to 60 s after the first#101. Each time DRED reportspage fault at GPU VA 0x0; allocations there: [].56c0cd3b82a00c6e, 2 for95cc13288a27a96e), DRED's breadcrumbs stop at the DISPATCH right after the two markers of95cc13288a27a96e:DRED: list … 53 of 191 operations done, around: 0 0 15 >6 15 26.So I cannot tell yet whether the compact form of that program is wrong, or whether the program itself reads through a null buffer descriptor (base 0) that the console tolerates. In the direct path I found no bounds check on buffer loads (
num_records). I am converting this PR to a draft until that is understood. The compile-time result above stands.@Natakout on GitHub · 2026-11-26 01:24 UTC · original
Correction to the comment above. In a local build where
95cc13288a27a96eis replaced by an empty CS ([numthreads(64,1,1)] void main() {}), the device removal and thepage fault at GPU VA 0x0still happen in 2 runs out of 2, 0.5 s and 14 s after that pipeline's first bind. DRED gave no breadcrumbs in those two runs. So the fault does not come from that program's code, nor from its compact form. Its dispatch was only where the first trace stopped. I keep the PR as a draft until I know what reads VA 0.@Natakout on GitHub · 2026-11-26 07:58 UTC · original
Last follow-up. The device removal is not related to this PR, nor to the direct DXIL path. With
XCL_DIRECT_DXILrouting every program through the HLSL path, and the three big programs replaced by empty CSs (only so that the HLSL path gets past their compiles), the title ends the same way in 2 of 4 runs once the caches are warm:D3D12 device removed: 0x887a0005, thenDRED page fault at GPU VA 0x0, 0.6 s after the first#101. The other two runs stalled on pipeline compiles before reaching that point. Marking this ready for review again. The VA 0 fault belongs to #505.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.