Recompiler: large compute programs call shared helpers instead of inlining them #1901
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!1901
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1901"
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?
@SamG-Coder on GitHub · 2026-11-24 22:48 UTC · original
SamG-Coder:recomp/shared-helpers→main· +206 −32 · 3 files · 1 commits · draftPart of #1269. Replaces draft #1867, which combined this with other changes. Large compute programs call one shared copy of the memory-window accessors, the split-wave64 exchange and the typed-format conversions instead of having DXC inline them at every use. On six retail compute programs of 1.3 – 6.7 MB HLSL, pipeline creation is 2.1 – 5.9× faster with the default memory windows and 1.13 – 3.7× faster with
XCL_HEAP_WINDOWS=1, and the DXIL 4 – 28 % smaller (tables below).What is in it
Em::finishtakes the program's instruction count. From 1 024 instructions (compute and kernel mode), the memory-window accessors and the split-wave64 exchange functions are[noinline], with scalar parameters andoutresults, which SM 6.6 DXIL keeps as calls. Vector loads and stores go through one scalar_sharedfunction per width.fmt_value,fmt_pack_shared,st_bytes_shared) are[noinline]in the same way.fmt_compis split so the conversion takes scalars;fmt_packandst_byteskeep their signatures as wrappers. The store logic is unchanged.XCL_HEAP_WINDOWS=1) keep their single access: only the switch form's accessors are outlined.lanebit) stays inline. As a[noinline]call it made the driver slower on every program measured (with heap windows, the 3.40 MB program: 5.83 s inline, 7.27 s as a call).gpu_large_compute_shares_wave_and_window_helperschecks that a small program stays inline, that a large one calls the shared accessors, that the outlined DXIL is smaller than the same source inlined, and that both memory windows and a vector load return the right values on the GPU.Measurements (
xcl shaders <pack> --measure-pso <record> --repeat 3: DXC, thenCreateComputePipelineStatewith the driver cache off;mainc4d37beagainst this PR on the same machine, one program at a time; a second pass agrees within 3 %)Default memory windows (switch form):
XCL_HEAP_WINDOWS=1:DXC is slower on one of the twelve (4.21 MB, default windows: +3 %).
Tested
cargo test --workspace -- --test-threads=4: 960 passed, 0 failed, 43 ignored (SKIPPED GPU tests: 12 tests, 22 cases: the wave64 cases ofgpu::recomp::lower/lower_dxilandgpu_wave32_program_in_wave64_hardware,gpu_geometry_wave32_prefix_count_over_a_maskfor no wave64 on this GPU;heap_window_out_of_memory_falls_back_to_the_switch_formfor no heap windows). Release build, aftercargo build --workspace --release.Regression run
main:
PR:
Not tested
scripts/smoke.ps1regression run yet (main or PR); required before this leaves draft.AI use
main, found and removed thelanebitslowdown by measuring each part on its own, ran the tests and measurements, and wrote this description.xcl nvprofileputs xcl.exe in an NVIDIA profile with a bigger shader heap (#2403) #2590@HKEY-Funk-Machine on GitHub · 2026-11-24 22:52 UTC · original
@SamG-Coder the device suspension I reported on #1867 (#1867) is still there on #1901 at
5064119, on an RX 9070 (RDNA4). It looks tied to the outlined switch-form window accessors: withXCL_HEAP_WINDOWS=1, where this PR leaves the accessors inline, the same program builds, and its DXIL is identical to the base's.62b584e061c05fc5c4d37be(base)5064119(this PR)Unknown pointer operation encountered during ParseAddress, then0x887A0005(device suspended)XCL_HEAP_WINDOWS=1Tested
5064119and its basec4d37be, release. One local-only change inmeasure_pso: no Windows Developer Mode here, soShaderCacheControl(DISABLE)fails (0x887A002D). I made that a warning and ran each measurement under anxcl.execopied to a new name, which gives the AMD driver a cold cache.xcl shaders <pack>/shaders.rpf --measure-pso 62b584e061c05fc5 --repeat 1, one process each.Not tested
AI use: Claude Code (Claude Opus 5.5) ran the measurements and wrote this comment.
@WebIdentity1 on GitHub · 2026-11-24 23:04 UTC · original
Synthetic isolation for the outlined switch-window accessors on an RTX 3090, exact #1901 head
5064119216a6443dead457f6a3e16cdf58bd29a8and parentc4d37bec1bb4286eb373aea963404a23f13401fa.I padded the existing
gpu_memory_windows_above_4_gibprogram with 1,024S_NOPs so this PR takes its large-compute outline path. The test already checks window-1 scalar/buffer/global reads, window-0/1 writes, and a window-1 global atomic. The overlay also accepts either switch syntax and asserts that the PR's switch form emits[noinline] void xcl_mInterlockedAdd(...); its heap form must not. This is a small public fixture an AMD tester can run to see whether a simple outlined atomic/accessor program triggers the reportedParseAddressfailure or whether that needs the larger program's structure.Tested — native Windows 10 19045, RTX 3090 driver 591.74, Ryzen 7 7800X3D, Rust 1.98.1 MSVC, DXC 1.8.2502.11;
XCL_ADAPTER=3090, HLSL path, default split-wave64 selection. Each snapshot was 303 source files and matched its SHA-256 manifest before/after. Cargo logs show a freshCompiling xclfor each snapshot.cargo test --locked -p xcl --lib gpu_memory_windows_above_4_gib -- --test-threads=1 --show-output: parent 1/0/0; PR 1/0/0. On the corrected PR overlay,outlined atomic: true, GPU result 1/0/0.cargo test --locked -p xcl --lib gpu_memory_windows_from_the_heap -- --test-threads=1 --show-output: parent 1/0/0; PR 1/0/0. On the corrected PR overlay,outlined atomic: false, GPU result 1/0/0.gpu_large_compute_shares_wave_and_window_helpers: 1/0/0 on the RTX 3090.The added test lines on #1901's
tests.rsare:Not tested: AMD, the failing retail shader, full suite, retail smoke, cold compilation time or memory. These passes show this small outlined program works on the 3090; they do not explain or dismiss the RX 9070 device suspension. I corrected and reran an initial diagnostic that looked for the wrong (
uint) helper return type; only thevoidassertion above proves the outlined path.AI use: Codex desktop (GPT-6) prepared the synthetic test overlay, ran the paired Windows checks and drafted this report from retained logs.
@CharlyRien on GitHub · 2026-11-24 23:23 UTC · original
Run time on an RTX 3090 (32-lane waves, split wave64): the programs build faster but run 1.7 – 2.7× slower, because the split-wave64 exchange helpers are now calls. With those inline again the run time is back to the base's.
The description measures DXC and pipeline creation. This adds the GPU time of the dispatches themselves, same trees.
Setup
mainc4d37be(base) andc4d37be+ this PR's commit5064119. Each carries only a local test harness (not for upstream): it builds the memory windows as the runtime does (VirtualAlloc,OpenExistingHeapFromAddress, placed buffers; views from the descriptor heap withXCL_HEAP_WINDOWS=1, root UAVs otherwise), runs one translated program with given inputs and times eachDispatchwith timestamp queries.c4d37bedeclares every compute memory windowgloballycoherent, and that alone costs seconds per dispatch on the imported host heap (see #1850 and #1640), the harness removes the qualifier from the HLSL of both trees. Otherwise the code shape cannot be seen in the timings.CreateComputePipelineStateof a copy that differs by a never-taken store, so the driver cache misses (ShaderCacheControl(DISABLE)is refused without Developer Mode).Results
Which helper costs the time (program A,
[noinline]removed from one group at a time in the PR's HLSL)xcl_x_ballot_shared,xcl_x_meet, …) go out of line from 1 024 instructions in both forms, and that is the whole slowdown there.xcl_x_ballot_sharedinline gives 13.9 / 13.5 ms; onlyxcl_x_meetleft out of line 15.6 / 13.6 ms.So on 32-lane GPUs the trade here is about half the pipeline-creation time once, against about twice the GPU time of every dispatch of a program that loops. A threshold on the number of exchange sites inside loops, or keeping the exchange inline and outlining only the accessors and the format helpers, would keep most of the build gain; I have not measured those variants.
One more thing for the cache: the typed-format code at the top of every program is rewritten for all sizes, so the HLSL of every compute program of the pack changes, including the quarter of them under 256 instructions. A translated-shader cache is rebuilt entirely.
Not tested
globallycoherentkept: not measured for the PR (program A takes about 7.4 s per dispatch on the base that way, which hides everything else).AI use: Claude Code (Claude Fable 5.2 coordinating, Claude Opus 5.5 for the port of the harness and the measurements) ran this and drafted the report.
@oni-swr on GitHub · 2026-11-24 23:27 UTC · original
RDNA3 data point for #1901 at
5064119216a6443dead457f6a3e16cdf58bd29a8vs parentc4d37bec1bb4286eb373aea963404a23f13401faon an RX 7800 XT: the same device suspension (0x887A0005) reproduces on RDNA3 — including on this PR's own GPU unit test and underXCL_HEAP_WINDOWS=1whenever any[noinline]internal DXIL function remains.Unlike RDNA4's
Unknown pointer operation encountered during ParseAddress, the RDNA3 driver printsunsupportedto stdout/stderr right beforeCreateComputePipelineStatereturns0x887A0005.Results
PR unit test (
gpu_large_compute_shares_wave_and_window_helpers, added in5064119, not present onc4d37be):cargo test --release -p xcl --lib gpu_large_compute_shares_wave_and_window_helpers -- --test-threads=1 --nocapture(XCL_ADAPTER="7800 XT"): FAILED — printsunsupported, then panics atCreateComputePipelineState: The GPU device instance has been suspended... (0x887A0005).Three retail compute records (
xcl shaders <record>.bin --measure-pso <hash> --split 0 --windows 4 --repeat 3, one process per measurement, 5 s wait after each device suspension):c4d37be(base)5064119(this PR)dxc -dumpbin)9136eb6afa6d8a2e(postfx_aces:CS_BakeACES...)unsupported→0x887A0005xcl_mLoad,xcl_mLoad4_shared,xcl_loadx4_shared)9136eb6afa6d8a2eXCL_HEAP_WINDOWS=1@mainonly)d10c0a5491f60cad(indirect_light_probes:CS_IrradianceCache...)unsupported→0x887A0005xcl_m*,xcl_loadx4_shared,fmt_value,st_bytes_shared,fmt_pack_shared)d10c0a5491f60cadXCL_HEAP_WINDOWS=1unsupported→0x887A0005fmt_value,st_bytes_shared,fmt_pack_shared)de83041b451429d1(sr_tracing:CS_ResolveGBuffer_Opaque)unsupported→0x887A0005xcl_mLoad,xcl_mLoad4_shared,xcl_loadx4_shared,fmt_value)de83041b451429d1XCL_HEAP_WINDOWS=1unsupported→0x887A0005fmt_value)DXIL validation & isolation finding
IDxcValidator(dxil.dll1.8.2502.11,hr=0x0) and disassemble cleanly withdxc -dumpbin.de83041b451429d1withXCL_HEAP_WINDOWS=1isolates the failure beyond switch-form memory windows andoutpointer parameters:dxc -dumpbinshows its only non-entry function isdefine internal fastcc i32 @"\01?fmt_value@@YAIIII@Z"(i32 %v, i32 %w, i32 %ty)— a pure scalar arithmetic helper with noi32*outparameters and no resource accesses, invoked viacall fastcc i32— and it still triggersunsupported→0x887A0005.9136eb6afa6d8a2ewithXCL_HEAP_WINDOWS=1) had zero internal functions in DXIL (same size asc4d37be). On the switch-window variants, the outlined vector/atomic accessors (xcl_mLoad4_shared,xcl_loadx4_shared,xcl_mLoad3_shared,xcl_mInterlockedAdd) also emiti32* noalias nocapture dereferenceable(4)outparameters.Tested
c4d37bec1bb4286eb373aea963404a23f13401fa(base) and5064119216a6443dead457f6a3e16cdf58bd29a8(PR #1901 head), release builds (cargo build --release --bin xcl -j 4andcargo test --release -p xcl --lib).ShaderCacheControl(DISABLE)failure inmeasure_psoto a warning on both trees and ran each measurement from a freshly copied and renamedxcl.exeto ensure a cold AMD driver cache (ShaderCacheControl(DISABLE)actually succeeded without warning on this machine, and all 3 repeats per run measured cold).--split 0), driver32.0.31035.1003(2026-07-24), AMD Ryzen 7 5700X3D, 64 GB RAM, Windows 11 Pro 26200 (10.0.26200), Rust1.100.0(0ef1bc386), DXCdxcompiler.dll1.8.2502.11 /dxil.dll1.8.2502.11 (Windows SDK 10.0.26100.0).Not tested
cargo test --workspace,scripts/smoke.ps1/ retail title runs,--split 1(split-wave64), other AMD driver versions, or NVIDIA / Intel / Linux.AI use: Antigravity (Gemini 4 Neon) built both trees, ran the measurements and wrote this comment.
@Rednaxeh on GitHub · 2026-11-24 23:57 UTC · original
RDNA3 run of this PR, since the numbers in the description are NVIDIA's: on an RX 7800 XT the device is removed within the first 2–3 s, twice, with this commit;
mainalone runs 300 s.Setup: AMD Radeon RX 7800 XT 16 GB (driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 Pro 26300, Rust 1.100.0, DXC 1.9.2602.17, release, retail title,
XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_PSO_TRACE=1, warm DXIL cache formain, empty for this PR's translations (its DXIL is new).main689f2db, same command, 300 s5064119on its basec4d37beCreateGraphicsPipelineStateanswers0x887a0005at 3.4 s (the device already gone),D3D12 device removed: 0x887a0020logged at 30.7 s5064119cherry-picked onmain20cf130(2daacb6locally),XCL_DRED=1D3D12 device removed: 0x887a0020at 2.045 s,DRED page fault at GPU VA 0x0; allocations there: []; recently freed: [], then the title's own C++ exception (0xe06d7363) and exit. 30 driver compiles before it, the largest a 582 060 B compute program "finished" in 44 ms.So the driver takes the outlined DXIL (no PSO is refused) and the GPU faults at address 0 on the first work that runs it; I cannot tell from here which program.
0x887a0020isDXGI_ERROR_DRIVER_INTERNAL_ERROR. The maintainer's merge run is on RDNA4 with a near driver, so this is worth a look before that. Logs of both runs kept; I can post them, and rerun with a change.Not tested: the suite on this tree;
XCL_HEAP_WINDOWS=1; other AMD drivers.AI use: Claude Code (Claude Fable 5.1) built the trees, read the logs and wrote this; the runs were mine.
@DavidM1911 on GitHub · 2026-11-25 02:07 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!
@milesah3ad on GitHub · 2026-11-25 02:21 UTC · original
Run time on Blackwell (RTX 5080, 32-lane waves, split wave64): on these synthetic programs the GPU time stays within 5 % of the base or drops, even with exchanges inside a loop. Driver builds are 6–28× faster in the switch form, and every output matches the base bit for bit. This adds a second NVIDIA generation next to @CharlyRien's RTX 3090 numbers. It doesn't reproduce his slowdown, so the cost may depend on the GPU generation or on his program's shape (50 ballots and 75 lane reads in loops, real inputs), which these programs don't have.
Setup: RTX 5080 16 GB, driver 621.24, Ryzen 7 9800X3D, Windows 11 Pro 26300, rustc 1.100.0, DXC 1.9.2609.5, release. Trees: this head
5064119and its parentc4d37be, each with the same local example (not for upstream). The example generates split-wave64 compute programs (128 threads, 4 memory windows) from @QemmHD's #156 generator, with every memory access at the thread's own address so one group's output is deterministic. Shapes:base: a divergentifevery 4th round, which is an EXEC ballotwave: av_readlaneevery roundatomic: a returning atomic every roundloop: a uniform 4-trip loop around a loadloopx: the same loop with av_readlaneand a ballot (v_cmp+s_and_saveexec_b64+ restore) inside it, every tripFor each program, in this order:
CreateComputePipelineStatein a fresh process (ABI root signature, new seed; the two trees' DXIL differs, so no driver-cache hits)runner::dispatch_timed, in video memory, sogloballycoherentcosts nothing here)Trees interleaved per program. All programs pass the 1,024-instruction threshold: the PR's HLSL has 42
[noinline]functions in the switch form and 7 in the heap form; the parent's has none.waveand onbase/loop/loopxwith heap windows. The largest base-to-PR increase isloop1000 switch at +4.9 %.loopx1000) and 1.4–6.4× with heap windows.cargo test -p xcl --lib -- gpu::recomp --test-threads=4: 262 passed, 0 failed, 18 ignored (SKIPPED: wave64-only cases, and the direct path's refused f16/cvt forms, as onmain).gpu_large_compute_shares_wave_and_window_helperspasses on its own.So on this GPU the trade that @CharlyRien measured on Ampere, half the build time against double the run time, isn't visible for these shapes. Whether his program A behaves the same on Blackwell is the open question. A run of that captured dispatch on an RTX 40 or 50 would settle whether a threshold on exchange sites in loops is needed per generation or everywhere.
Not tested: retail programs, real inputs (these use zero-filled memory and own-slot accesses, so their memory traffic is lighter than a real program's), the coherent window or
globallycoherenton host memory, AMD (where #1901 has device-removal reports), the title, release-to-release repeats beyond one interleaved run per program.AI use: Claude Code (Claude Opus 5.5) wrote the probe, ran it on the machine above and wrote this report. I checked the numbers against the logs.
@zohaiblazuli on GitHub · 2026-11-25 09:25 UTC · original
RTX 3060 12 GB, a larger program than the six in the description (7.05 MB HLSL, 25,107 instructions): pipeline creation 1.26× faster with the default windows, 1.04× with heap windows.
Head
5064119against its parentc4d37be, each built clean in its own worktree, release. Same machine, one program, run one after the other.Setup: NVIDIA GeForce RTX 3060 12 GB (driver 617.42, 32-lane waves, split wave64), Intel i5-14600K, Windows 11 build 26300, rustc 1.94.0, DXC 1.8.2502.11 from the Windows SDK (
10.0.26100.0).Command:
xcl shaders shaders.rpf --measure-pso 062468c09af883b9 --repeat 2(driver cache off).XCL_HEAP_WINDOWS=1The two runs of each PSO measurement agreed within 1 %.
Not tested: run time of the dispatches (see @CharlyRien's 3090 numbers), AMD, a title run with this change, DXC 1.9.
Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@brandostrong on GitHub · 2026-11-25 09:52 UTC · original · edited 2026-11-25 10:01 UTC
Ada (RTX 4090) data point: the build win is bigger on the title's own programs than the description shows, and the run-time cost @CharlyRien measured on Ampere reproduces here — but only in the split-wave64 exchange helpers. A knob that keeps those inline keeps both, and I measured it. The PR does not merge into current
main(5064119on689f2db4, mergeable: false); the rebase onto568e7dbtouches onlycrates/xcl/src/gpu/recomp/tests.rs, where the added test appends after another test's successor, and every number below is from that rebase (afbc413).Cold driver compile, the title's own compute outliers, HLSL path (
XCL_DIRECT_DXILunset,ShaderCacheControl(IMPLICIT_DRIVER_MANAGED | IMPLICIT_D3D_CACHE_FOR_DRIVER, DISABLE), freshXCL_DXIL_CACHEper tree, oneCreateComputePipelineStateeach,--test-threads=1):dx.opcallsef008c0f04b6261a568e7dbef008c0f04b6261aafbc413(this PR rebased)2d2bbb32f64e4801568e7db2d2bbb32f64e4801afbc413e7784c44a8db17d7568e7dbe7784c44a8db17d7afbc413e1453fc963ba30e7568e7dbe1453fc963ba30e7afbc413Driver time 1.63 – 3.84× faster across the four, with the biggest factor on the two largest. The asymmetry is the point: on
ef008c0f, −11 % instructions and −18 % bytes bought −74 % driver time, because what the driver is handed stops containing a copy of the window switch and the typed-format chain at every use site (dx.opcalls −58 %, phis −36 %). The568e7dbleg of the three smaller records ran alongside a build, so it is being rerun with nothing else on the machine; theafbc413legs were alone.These are not harness-only numbers: a 180 s run of the title on this rig with the implicit caches cold logs its own cold compute compiles at the same sizes and the same order of magnitude —
console CS (1 121 012 B DXIL, 89 977 ms,console CS (362 168 B DXIL, 12 282 ms,console CS (272 432 B DXIL, 8 478 ms, which areef008c0f,e7784c44ande1453fc9by DXIL size. The 90 s is a stall the player waits through.The same four records measured with XCL's own tool,
xcl shaders <pack> --measure-pso <hash> --repeat 1, one process per record,XCL_DXIL_CACHEwiped per tree,%LOCALAPPDATA%\NVIDIA\DXCacheemptied before each record, the tool's ownShaderCacheControldisable,XCL_DIRECT_DXILunset:568e7dbDXIL / DXC / driverafbc413DXIL / DXC / driveref008c0f04b6261a2d2bbb32f64e4801e7784c44a8db17d7e1453fc963ba30e7Same DXIL bytes as the harness table above, bigger ratios — this is the pairing I would keep if only one were quoted, and it is a command a reviewer can run. The same tool with
XCL_OUTLINE_EXCHANGE=0returns byte-identical DXIL for all four (917 068 / 1 131 876 / 270 684 / 196 096 B) at 13.484 / 20.239 / 5.929 / 2.119 s, straddling the outlined legs; the 2× spread one7784c44for identical bytes is the noise floor on the smaller records.What the class looks like. Exporting the HLSL of the ten largest compute programs of this title that have no driver blob (15 011 KB down to 4 461 KB of HLSL) and counting helper call sites: eight of the ten have no split-wave64 exchange sites at all (
xcl_x_ballot,xcl_x_meet,xcl_x_rla_*all zero) and 318 – 467xcl_mLoadsites plus ~205 – 237fmt_compsites; the two exceptions are both of the shadow-cascade family (73fb752d7f62c3a51 030 ballot + 109 lane-read sites,062468c09af883b9982 + 55). The largest,95cc13288a27a96e, is its own case: 7 561fmt_compsites, which is why its DXIL is 10.9 MB onmain. @zohaiblazuli's RTX 3060 report above is one of those two (062468c09af883b9, 1.68 → 1.49 MB, PSO 34.1 → 27.1 s), so the program with the exchange sites is also the one where the build win is smallest — 1.26× there against 1.63 – 3.84× on the four above.Why this class matters right now: #2120 reroutes compute programs whose HLSL exceeds 8 MiB, which is two records of this title's set (
56c0cd3b82a00c6e,95cc13288a27a96e). The reports there name what is left as the blocker —590cef5cfe51c7ac(1.2 MB, 89 s),b8755fc12d3163fc(1.0 MB, 53 s),b7a408ccdd229979(1.1 MB, unfinished) — and those are this class: HLSL under 8 MiB, so they stay on this path and this PR is what changes them.GPU time of the same program, both trees (a 32 768-iteration loop, 2^18 threads, timestamps, median of 9, 1 024
S_NOPs so both trees' threshold state is the same and the only difference is inline vs[noinline]):So on Ada the window-accessor and format outlining is free to slightly positive, and the cost is in
xcl_x_meet/xcl_x_ballot/xcl_x_rla_*going out of line — the same helper group @CharlyRien isolated on Ampere, at 1.73× instead of 1.7–2.7×. Blackwell (@milesah3ad) does not show it, so this looks like a per-generation cost on the halves' rendezvous, not a shape artifact.The cost this PR pays on a title that is already warm. The typed-format prelude is rewritten for every compute program (the
XCL_FORMAT_FNmarker is substituted with nothing for small programs, butfmt_compis split intofmt_offset/fmt_value/fmt_oneeither way), so the HLSL of every compute program changes, including the ones below both thresholds. Everything downstream of the HLSL is keyed by content, so on this machine the whole stack for the title goes cold with it: 3.6 GB of translated DXIL (XCL_DXIL_CACHE), 2 204 driver blobs / 883 MB (driver_cache, namedfnv64(dxil)-len-flags.pso), and 453 files / 12 GB in%LOCALAPPDATA%\NVIDIA\DXCache. A first run after taking this PR pays all of that, and #2096's manifest / milestone-AOT work has to regenerate its blob set after it. That is a one-off, and the 1.6 – 3.8× above is what it buys per pipeline afterwards, but it is the cost and it should be in the record.The variant @CharlyRien suggested and nobody has measured: keep the split-wave64 exchange helpers inline and outline only the window accessors and the format conversions. One line in
Em::finish—self.x64_prelude(&mut h, outline && outline_exchange()), withXCL_OUTLINE_EXCHANGE=0selecting it, so one build measures both forms. Same tree, same binary, only the environment differs; the same loop as above:=0)568e7dbSo the inline form gives back the whole run-time cost — 1.015×
maininstead of 1.75× on the case that regressed, and it is at or belowmainon the other three — while keeping the outlining that buys the compile win. For these four records it costs nothing at all on the build side either: with the exchange inline the DXIL is byte-identical to this PR's (917 068 / 1 131 876 / 270 684 / 196 096 B, same instruction, phi anddx.opcounts), because none of them contains an exchange site — the only thing the switch changes is the HLSL of programs that read lanes. Cold driver compiles of the same four with the exchange inline: 20.668 / 36.926 / 5.391 / 3.178 s, against 28.608 / 26.553 / 3.066 / 3.474 s for the same bytes in the previous leg of the same binary — the spread between two runs of identical DXIL on this machine, which is the variance any single number here carries.On the one program of the ten that does read lanes the switch is not free, and it goes the other way.
73fb752d7f62c3a5(1 030 ballot + 109 lane-read sites), same tree, only the environment differing, cold driver each leg:dx.op568e7dbXCL_OUTLINE_EXCHANGE=0)So on the program that has the exchange sites, keeping the exchange inline gives the outlining back and then some: 21 % more DXIL and 14 – 24 % more driver time than the outlined form, 7 % more DXIL and 8 % more driver time than
568e7db, and 2.5× the DXC time of the outlined form. Outlining the accessors and the format conversions still removes the 1 826 duplicated window switches either way (6 left); what the inline rendezvous adds back is bigger than what the outlining takes off at 1 030 sites. The knob is a per-class decision, not a free setting: byte-identical and free on the eight programs with no exchange sites, and on the two with them it trades about 1.1× of build time for the 1.73× of dispatch time. (568e7db's DXC time for this record is a cache hit from an earlier run and is being redone withxcl shaders --measure-psoon all three trees; the two cold legs above are the same tree and are comparable.)Measurement conditions worth stating: each pair was measured under the same process layout (the
ef008c0fpair had that program alone in the process, the other three were the first program of their process), and the same DXIL has been timed at 75.5 s, 78.5 s and 98.3 s on this machine, so treat single runs as ±30 % and the paired columns as the comparison. Nothing else was running during theafbc413legs.Regression run —
scripts/smoke.ps1 -Seconds 180on the same title build (title: 3c290c16), same rig, each tree built clean at the commit named, each on a data root copied from the same snapshot, each withXCL_DXIL_CACHEwiped for that tree and%LOCALAPPDATA%\NVIDIA\DXCacheemptied first:A second pair of the same two trees, run before that one with the shared cache each tree had already warmed (1530 frames / 35 647 MB on
main, 1558 / 31 310 MB here), and a third tree with the exchange helpers kept inline reached 1719 frames in the cold set. All six runs end the same way: the title stops presenting between 90 and 102 s and stays that way to the timeout, with 0 device removals and 0 crashes, so the frame counts compare the same screen and none of them is a speed result.What the logs do separate is the per-pipeline cost. In the warm pair,
mainbuilt 117 compute pipelines totalling 76.6 MB of DXIL in 111.2 s of driver time with its worst single one at 76 358 ms (an earlier run of it logged 89 977 ms for the same program); this PR's tree, whose blobs are all invalidated by the HLSL change, built 23 totalling 10.6 MB in 181.9 s with its worst at 16 897 ms. Same total, opposite shape: 17 s of driver time per MB of DXIL againstmain's 1.4 s/MB with blobs from earlier runs, and nothing in the PR's run longer than 17 s against a 76 s stall onmain. In the cold pair, where both trees re-translate everything, the driver is no longer the bottleneck and the two are within 4 % of each other's frames.Tested
XCL_DXIL_CACHEfresh per tree (so DXC compiled cold in the paired legs), XCL's own driver blobs not used by this harness (it callsCreateComputePipelineStateitself), the implicit D3D/driver caches disabled throughID3D12Device9::ShaderCacheControl. The rerun leg also empties%LOCALAPPDATA%\NVIDIA\DXCachebefore each measurement, becauseShaderCacheControldoes not cover it and this machine holds 12 GB in it — the first legs did not clear it, which is the likeliest source of the spread noted above. @itsSio's cache-control check on #2088 finds the NVIDIA driver cache follows the executable's basename rather than its directory, so a new cache directory is not by itself a cold control; the per-compile clearing is.568e7db(currentmain) and568e7db+ this PR's commit rebased (afbc413; the rebase touches onlycrates/xcl/src/gpu/recomp/tests.rs, where the added test is appended aftergpu_scalar_sext_mulhi_and_vector_i64_shifts_co_ci_u32's successor).cargo build --release --offline --workspacethencargo test --release --offline --workspace -- --test-threads=4onafbc413: 1155 passed, 0 failed, 46 ignored, exit 0 (lib target 1099 / 0 / 26, plus the integration and e2e targets). 23SKIPPEDlines, allno wave64or the direct path's refused f16 / f32-conversion forms, the same setmainproduces on this adapter.gpu_large_compute_shares_wave_and_window_helperspasses.#[cfg(test)]module incrates/xcl/src/shaders.rsthat translates named records throughrecomp::pso::console_to_dxil_for, disassembles the DXIL, counts instructions / phis / switches /dx.opcalls, and callsCreateComputePipelineStateonce; and a second test that builds the exchange loop withgpu::rdna2::encode, translates it throughrecomp::translateand times dispatches withrunner::dispatch_timed. No game launch in these numbers.xcl shaders <pack> --measure-pso <hash> --repeat 1on each tree's release build for the four records, plusafbc413withXCL_OUTLINE_EXCHANGE=0. Its DXIL byte counts match the harness numbers for every record, which is what makes the two tables one measurement and not two.Not tested
unsupported→0x887A0005and the RDNA4ParseAddressfailures reported above; every number here is NVIDIA and none of my runs had a device removal. Worth noting for whoever does: @HKEY-Funk-Machine'sXCL_HEAP_WINDOWS=1result puts the RDNA4 failure in the outlined switch-form accessors, which is the group that also carries the build win here — the two cannot be separated by the exchange switch alone. @oni-swr's RX 7800 XT run adds that the RDNA3 suspension follows any remaining[noinline]internal function, underXCL_HEAP_WINDOWS=1too and including this PR's own GPU unit test, so the exchange switch below does not address the AMD failures: with the exchange inline the accessors and the typed-format helpers are still[noinline].XCL_HEAP_WINDOWS=1), where this PR leaves the accessors inline.AI use: Claude Code (Claude Opus 5.5) built both trees, ran the measurements and wrote this; the runs are ours.
@ettehn on GitHub · 2026-11-25 10:33 UTC · original
I tested the >8 MiB outlier
95cc13288a27a96eon Windows, CPU-side only, on exact head5064119and parentc4d37be. Each used an empty cache, DXC 1.8.2502.11, one record andxcl shaders <record-dir> --precompile --only cs --split 1 --windows 4. A Windows job limited each run to 3 GiB of commit and 50 s.[noinline]attributes, parent → PRXCL_HEAP_WINDOWS=1)All four runs reached the time limit without writing DXIL. In a separate control on #2120
8dcc56d, the same switch-form record took the automatic direct route and emitted 3,824 KiB DXIL in 18.2 s, with 316.0 MiB peak job commit. The outlining lowers memory use within this observation window. The shader still exceeds the direct-route size threshold, so the two changes address different parts of the problem here. No driver PSO or title execution.AI use — OpenAI Codex (GPT-6.2 Sol) ran the tests and wrote this report.
@gefydev on GitHub · 2026-11-25 13:02 UTC · original
Test report: cold driver build time on a GTX 1650 (Turing, 4 GB), four of the title's largest compute programs. The PR's head against its own base, same machine, one program at a time.
Tested
5064119(Recompiler: large compute programs call shared helpers instead of inlining them) against its base689f2db; both built from a clean worktree,cargo build --release -p xcl --bin xcl. The branch conflicts with current main ingpu/recomp/tests.rs, so I did not test a merge.xcl shaders <the title's shaders pack> --measure-pso <record> --repeat 3, with no other environment variable set (default memory windows, HLSL path, noXCL_DIRECT_DXIL). The tool turns the driver's shader cache off itself. Per program, base first and then the PR, one process each.e1453fc963ba30e7e7784c44a8db17d7ef008c0f04b6261a2d2bbb32f64e4801The DXIL is 18 – 26 % smaller on all four, DXC is faster on all four, and the driver builds the two largest in about a quarter of the time. That is the same direction as the PR's own tables and @brandostrong's numbers on an RTX 4090, on a card and driver neither has used.
Not tested
CreateComputePipelineStatewas timed, not GPU time of the dispatches. The outlined exchange and accessors are the part others report as slower at run time, so this report says nothing about it.XCL_HEAP_WINDOWS=1, the direct DXIL path, any of the six programs of the PR's own tables, and the title in game (scripts/smoke.ps1was not run for this report).AI use
@jordi-vancuijlenborg-vinci on GitHub · 2026-11-25 16:46 UTC · original · edited 2026-11-25 17:23 UTC
On my RTX 3080 setup, two GTA VI compute shaders compiled faster with #1901 and both produced smaller DXIL.
This does not address the RX 9070 device suspension reported above:
62b584e061c05fc5is the same record, with the default four switch windows. On NVIDIA it passeddxvand the runs below had no device removal, but I did not measure driver PSO creation, so this says nothing about the AMD driver.Tested
Windows 11 25H2 (26200.9974), i7-9700F, GeForce RTX 3080 10 GB, NVIDIA 621.01, Rust 1.100.0 MSVC, release, DXC 1.9.2609.5. I compared
5064119216a6443dead457f6a3e16cdf58bd29a8with its parentc4d37bec1bb4286eb373aea963404a23f13401fa.I picked two records from a previous story-load log. I used
xcl shaders <pack> --export-hlsl <dir> --record-hash <hash> --split 1with four memory windows, thendxc -E main -T cs_6_6 -HV 2021 -O1 -Fo <out> <in>. Times are median wall times for three DXC invocations per record and build, with the build order alternated.62b584e061c05fc58994bb33444988e6These sizes come from exported HLSL compiled with
dxc -O1, not from--measure-pso, so they are not comparable with the sizes in the RX 9070 table. All four outputs passeddxv. On the PR,cargo test --locked --offline --release -p xcl --lib -- --exact gpu::recomp::tests::gpu_large_compute_shares_wave_and_window_helpers --nocapture --test-threads=1gave 1 passed, 0 failed, 0 ignored, 0 skipped (933 filtered out).Story load
I ran
scripts/smoke.ps1 -Game <folder> -Seconds 360 -Xcl <release-exe> -Title retail-1.0.2.1on GTA VI 1.0.2.1 (Series X). Each run started from a separate, byte-identical copy of the same save and pre-existing shader cache. Networking was off, the PSO wait was left at its default, andXCL_PRESS_A_AT=52,65selected the profile.All three runs exited at the timer with code 0, zero crashes, zero device removals, and zero presents in each of the final three samples. The PR fell within the spread of the two control runs. I could reproduce the DXC improvement on these records. Whether players get through the story load faster remains open.
Not tested
Cold driver PSO creation time.
--measure-psoon the parent stopped atShaderCacheControlwith0x887A002D. AMD / RDNA4. One retail run on the PR, two shader records picked locally, default memory windows only. I did not run the full workspace test suite.OpenAI Codex (GPT-6.2 Astra Extra High) ran the tests and helped draft this report; Claude Code (Claude Opus 5.5) checked the figures against the raw outputs and edited the draft.
Smoke output
Parent, run 1
Parent, run 2
#1901
I also tested
XCL_HEAP_WINDOWS=1on the RTX 3080. With the same starting save and shader cache, the parent (c4d37be) showed 9,898 frames in six minutes and peaked at 20,644 MB of process commit. The PR (5064119) showed 10,368 frames and peaked at 18,411 MB. Both exited at the timer without a crash or device removal.Both builds were still presenting frames and processing DirectStorage requests in the final minute. One run per build, with manual menu input enabled. Time to playable gameplay remains unverified.
OpenAI Codex (GPT-6.2 Astra Extra High) ran the comparison and helped draft this update.
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.