You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[OFFICIAL] Looking for PRs with shaders optimization #1269
We have to optimize shaders a lot. They are main problem right now. We are open for big PRs aiming to optimize shaders compilation time etc. It should be done by skipping EXEC emulation and compiling shaders directly into DXIL I believe. Post PRs here, thank you.
Reacted by Ausbloke, MysticSaba, Nk, Kole, N9emiec., Arya Anish, Phraios, project516, jimokulou2-ops, David zhao and 29 more
Reacted by Somka000, YufeiV, René, HissingCat, Mathias, dxbi, retrope13, vitor127wt, GreemSC, LRF17 and 56 more
Reacted by Filip Michalski, HissingCat, dxbi, retrope13, vitor127wt, ferreirovski, Nyives, Mortaal339, Rodrigo Torreão, Phraios and 25 more
Reacted by DepriSheep, dxbi, Obi Newman, Mortaal339, DevCaptainAnas, GothamSystems, Ausbloke, Nk, Kole, Arya Anish and 8 more
Plan from our side, to avoid duplicate work: measurements first, no code yet.
On a retail shader pack (26 503 records, 2 689 compute programs) and an RTX 4080 (32-lane waves, so the split wave64 form), I will post here:
Per compute program: instructions, HLSL size and translation time, for the split wave64 form and the native wave64 form side by side. That shows what the split form costs in source size on 32-lane GPUs.
DXC time and DXIL size against HLSL size for a sample spread over the size range, both forms, and at -O1 / -O3 around the 1 MB switch.
The programs that never finish:xcl shaders --precompile --only cs stops advancing after record 22 600 on three NVIDIA machines (Shaders: save offline compute pipelines to the runtime driver cache #744: one compile, over 33 minutes on one thread, memory growing past 14 GB). I will find which programs are still missing from the DXIL cache after those passes and what they have in common (size, loops, memory windows, cross-half exchanges).
Counts and timings only, no shader names or code. If the numbers point at a specific construct that makes DXC or the driver slow, I will propose a small PR for that one here before writing it. Direct DXIL emission is more than I will start on without a design agreed with you.
AI use: Claude Code (Claude Fable 5.2) will run the measurements and write the reports.
Reacted by Michael Pfundt, ferreirovski, GreemSC, Just-Owen, retrope13, CortexReaver, ofc0urse, Di Maso, Pedro Nunes, Nk and 7 more
First numbers (parts 1 and 3 of the plan above). main47efa2e, a retail pack's 2 689 compute programs, translated as a 32-lane GPU gets them (split wave64, 4 memory windows) and as a 64-lane GPU does; DXIL cache as two days of title runs and three stalled --precompile --only cs passes left it. A temporary local test, not for a PR; counts only.
Where the precompile pass stops: the -O0 fallback, not the split form
programs
instructions
HLSL
DXIL in the cache
all compute programs
2 689
median 2 277, 735 over 10 000, max 88 863
3.83 GB in total
1 164 cached
HLSL over 8 MB (compiled at -O0, dxc.rs)
6
44 430 – 88 863
9.9 – 31.0 MB each
three cached: 14.1, 29.6 and 29.8 MB
The three cached ones are records 22 616 – 22 618 of the pack: exactly where --precompile --only cs --pipelines stops advancing on the RTX 4080, 4090 and 5080 (Shaders: save offline compute pipelines to the runtime driver cache #744). DXC finishes them; it is the driver that is then handed a 14 – 30 MB DXIL and does not come back (33 minutes on one thread and still growing past 14 GB when I stopped it).
At -O0 the DXIL is 0.92 – 0.96 of the HLSL size. For everything compiled with optimisation it is 0.27 – 0.28 (median, 1 161 programs). So these programs are about 3.4 times bigger than they would be optimised, on top of being the biggest sources.
The other 1 525 uncached programs are all after record 22 989: not reached, not failed. Their largest are 5.3 – 10.4 MB of HLSL (19 600 – 46 700 instructions).
What the split wave64 form and the memory windows cost in source
HLSL, all 2 689 programs
ratio per program
native wave64 form, 4 windows
3.82 GB
–
split wave64 form, 4 windows
3.83 GB
1.05 median, 1.10 at the 90th percentile, 1.12 max (the 1 208 wave64 programs)
split form, 1 window
3.47 GB
4 windows cost 1.12 median, 1.27 at the 90th percentile, 1.36 max
The split form adds about 5 % of source; the memory-window switch adds 12 – 36 %. Neither is where the size comes from.
The size is per instruction: about 240 bytes of HLSL per RDNA2 instruction (median over programs of more than 2 000 instructions), plus a fixed ~45 KB per program (the 50 smallest programs: 14 instructions and 47 KB median).
Translation itself is not a cost: 84 s for all 2 689 programs on 8 threads, in either form.
Read (inference): on 32-lane and 64-lane GPUs alike, what DXC and the driver are given is roughly 240 bytes of source and 65 bytes of DXIL per console instruction; a program of 20 000 instructions is 5 MB of HLSL and 1.2 MB of DXIL however EXEC is handled. The -O0 threshold then makes the six largest programs worse instead of safer for the driver.
Next from me (trimmed so it does not repeat others' parts): DXC time with and without the comments and indentation, -O1 against -O3 under 8 MB, and the NVIDIA Windows driver's compile time against DXIL size from the title runs I already have. Not from me: -O0 / -O1 on the six largest and RADV driver times (@frozht), the direct backend (@gefydev), the synthetic benchmark (@BetterJdue).
AI use: Claude Code (Claude Fable 5.2) wrote the measurement, ran it and wrote this.
Update: where the HLSL bytes go (same 2 689 programs in the split form; the split by the emitter's // pc: mnemonic lines is @upipibi's idea from the comment below. I wrote my own script along those lines rather than run theirs, so any error in the numbers is mine.)
part of the source
MB
share
prelude, before main
111.5
2.9 % (41.5 KB per program)
main before the first instruction (register loads)
11.1
0.3 %
main, the instructions
3 703.5
96.8 % (238 bytes per instruction, 15 588 842 instructions)
Inside main, counting the matched text itself:
MB
share of all HLSL
leading indentation
1 175.0
30.7 %
comment lines (one // pc: mnemonic operands per instruction)
the exec select wrapper, both forms: select(lanebit(exec_lo, exec_hi), in wave64 programs and select((((exec_lo >> lane_id) & 1u) != 0u), in wave32 ones
398.2
10.4 % (9 211 332 uses: 712 377 + 8 498 955)
pc dispatch lines
6.8
0.2 %
cross-half exchange calls
1.4
0.04 % (95 375)
By opcode group:
group
instructions
MB
share
bytes per instruction
VALU other than compares
9 447 630
1 764.2
46.1 %
187
scalar other than loads and branches
3 925 320
928.8
24.3 %
237
s_load_*
528 223
363.8
9.5 %
689
buffer_* / global_* / flat_*
257 595
291.1
7.6 %
1 130
v_cmp*
735 088
179.3
4.7 %
244
image_*
149 724
106.6
2.8 %
712
branches
528 028
64.8
1.7 %
123
The single opcodes on top: v_mul_legacy_f32 431 MB (2.1 M uses, 204 bytes each), s_load_dwordx4 259 MB (635 each), v_fmac_f32 230 MB, v_fma_f32 184 MB, s_buffer_load_dword 158 MB (796 each), s_buffer_load_dwordx4 131 MB (951 each).
What follows from this:
More than half of what DXC is handed is indentation and comments (55.7 %). That does not reach the DXIL, so what it costs is DXC's front end; I am timing the same programs with and without it now.
The -O1 and -O0 thresholds in dxc.rs are on the source length, comments and indentation included. A program at the 8 MB -O0 limit has about 3.5 MB of code. The six programs over it are 44 000 – 89 000 instructions. -O0 against -O1 for those six is @frozht's part 2 above, so I leave it to them and time only programs under 8 MB.
The exec select wrapper, the thing "skipping EXEC emulation" would remove from the source, is 10.4 % of it: 9.21 M selects for 9.45 M VALU instructions other than compares, i.e. practically every vector write. (Corrected: I first wrote 0.6 % and 712 377, because my pattern matched only the wave64 form of the guard; @ASThome00 pointed out below that wave32 programs spell it differently. What it costs after optimisation I still cannot tell from source size.)
Reacted by Michael Pfundt, ofc0urse, CortexReaver, Nk and belIadonna
A data point for the largest programs, from a 32-lane NVIDIA card with 8 GB (RTX 4060 Ti, driver 32.0.16.2124, i5-14400F, 32 GB RAM, retail 1.0.2.1).
On this machine those programs do more than make the load slow: they end the run. In the world load, a few compute programs of about 1 MB of DXIL took 60 to 97 s each in the driver, and process commit went from about 31 GB to 84.7 GB until Windows ran out of commit (numbers in #560 (comment)).
With a local patch that is not meant for upstream (compute programs of 768 KB of DXIL or more get the fallback CS instead of the driver's compile, XCL_SKIP_CS_KB=768), 11 programs are refused per run, commit stays flat at about 31 GB, and the title gets through the world load. Today, with #640 and #1252 on top, that is far enough to draw world geometry on this card. So for an 8 GB NVIDIA machine, what happens to those few programs decides whether the world loads at all.
I have not measured which of them are among the six over 8 MB of HLSL in your table.
AI use: Claude Code (Claude Opus 5.5) ran the runs and wrote this.
Reacted by Michael Pfundt, Nk, HissingCat and belIadonna
Plan from our side, to complement @throny's numbers on AMD rather than repeat them: measurements first, no code yet.
Setup: RX 7900 XT (RDNA3, native 64-lane waves), RADV (Mesa 26.2.6), vkd3d-proton under Wine 11.22 Staging, Ryzen 9 5900X, main47efa2e. On a retail title, the stall that ends our runs is compute pipelines built on the game's threads at a loading fade: about 240 compute PSOs, the large ones (150–533 KB DXIL) taking 3.8–12 s each in vkd3d-proton plus RADV, so this issue is our blocker too.
What I will post here, from the xcl shaders CLI and the title's own pipeline cache (no game runs):
Driver compile time against DXIL size on RADV for the compute programs the title builds at that fade, i.e. part 4 of the plan above on AMD. That includes host memory per compile, to see whether the ~1 MB DXIL programs that exhaust commit on @ofc0urse's 8 GB card cost the same on RADV.
-O0 against -O1 for the programs whose HLSL is over 8 MB (the ones that compile at -O0 in dxc.rs): DXC time, DXIL size, and RADV's compile time on each result.
-O1 against -O3 for a sample in the 1–8 MB range, judged by the driver's compile time as well as DXC's.
Counts and timings only, no shader names or code. If (2) shows -O1 is better on both vendors, a small PR to drop the -O0 fallback would be the natural follow-up; I will propose it here before writing it.
AI use: Claude Code (Claude Opus 5.5) wrote this plan and will run the measurements and write the reports.
Hey! I’m not a dev or anything, but I’d really love to help out with XCL.
Here’s my PC setup:
• Ryzen 5 5600X
• RTX 3060 OC 12GB
• 16GB RAM
• Windows 11
I was wondering if you guys could use an extra pair of hands for testing, finding bugs or collecting performance data.
I’m down to help out however I can, even though I don’t know how to code. Really appreciate the work you guys are putting into this project. Keep it up
Reacted by hexgeon1, Michael Pfundt, Kole, ski522, ChAlanA, Darwin Xue, kxng., Nk, Alex, Z0G1M0N and 3 more
Reacted by mishkashishka0, Kole, ludtuypop-lab, Darwin Xue, abirhossan65-hub, Anjum9694, HissingCat and Mortaal339
Reacted by ski522, The-Vanillax, Kole, Darwin Xue, Vaahtopahvi and Mortaal339
@throny a tool for the next step of your plan, if it helps. You found about 240 bytes of HLSL per console instruction. This script splits that by opcode and by construct, using the // pc: mnemonic line the emitter writes before every instruction. Run it over a folder from xcl shaders <pack> --recomp with XCL_DUMP_HLSL=<dir> XCL_DUMP_EVERY=1. It prints counts and byte totals only, nothing of the programs. It uses only the standard library: python -I hlsl_bytes.py <dir> --top 30.
It reports:
prelude vs main bytes, and bytes per instruction;
the share of the exec selects (select(lanebit(exec_lo, exec_hi), …), one per VALU write), comment lines (gone in DXIL, so DXC parse time only), cross-half exchanges, loop guards and memory-window switches;
the opcodes that cost the most HLSL in total, with count and bytes per instruction.
On a hand-built 19-instruction program it gives 110–160 bytes per VALU or store. In this form an exec select costs about 30 bytes per write, and lanebit is recomputed at every write. Which opcodes reach the 240-byte average in real programs (my guess is buffer and image accesses with their bounds and window code) is what the top-30 table would show, and that is where a size cut would pay.
hlsl_bytes.py
"""Where the HLSL of translated console programs goes: bytes per RDNA2 opcode and perconstruct, over a folder of `XCL_DUMP_HLSL` files (`xcl shaders <pack> --recomp` with`XCL_DUMP_HLSL=<dir> XCL_DUMP_EVERY=1`). Prints counts only, nothing of the programs. python -I hlsl_bytes.py <dump folder> [--top 30]"""importcollectionsimportosimportreimportsysINST=re.compile(r"^\s*// ([0-9a-f]{4,}): (\S+)", re.M)
CONSTRUCTS= {
"exec select `select(lanebit(exec_lo, exec_hi), ...)`": re.compile(r"select\(lanebit\(exec_lo, exec_hi\), "),
"exec test `lanebit(exec_lo, exec_hi)` (all uses)": re.compile(r"lanebit\(exec_lo, exec_hi\)"),
"comment lines (all; gone in DXIL)": re.compile(r"^\s*//[^\n]*\n", re.M),
"cross-half exchanges `xcl_x_*(`": re.compile(r"xcl_x_[a-z_]+\("),
"loop guards": re.compile(r"if \(xcl_budget == 0u\) break; xcl_budget--;"),
"memory-window switches `xcl_w`": re.compile(r"\bxcl_w\b[^;\n]*;"),
}
defmain():
args=sys.argv[1:]
top=30if"--top"inargs:
i=args.index("--top")
top=int(args[i+1])
delargs[i:i+2]
folder=args[0]
per_op=collections.defaultdict(lambda: [0, 0]) # mnemonic -> [count, bytes]construct=collections.Counter()
total=prelude=body=files=insts=0fornameinsorted(os.listdir(folder)):
ifnotname.endswith(".hlsl"):
continuetext=open(os.path.join(folder, name), encoding="utf-8", errors="replace").read()
files+=1total+=len(text)
marks=list(INST.finditer(text))
ifnotmarks:
prelude+=len(text)
continuestart=text.rfind("\n", 0, marks[0].start()) +1main_at=text.rfind("void main", 0, start)
prelude+=main_atifmain_at>=0elsestartbody+=len(text) - (main_atifmain_at>=0elsestart)
fork, minenumerate(marks):
end=marks[k+1].start() ifk+1<len(marks) elselen(text)
op=per_op[m.group(2)]
op[0] +=1op[1] +=end-m.start()
insts+=1forlabel, rxinCONSTRUCTS.items():
forhitinrx.finditer(text):
construct[label] +=1iflabel.startswith("exec test") elselen(hit.group(0))
ifnotfiles:
sys.exit("no .hlsl files in "+folder)
print(f"{files} programs, {insts} instructions, {total/1e6:.1f} MB of HLSL")
print(f"before main (prelude, declarations): {prelude/1e6:.1f} MB ({100*prelude/total:.0f} %)")
print(f"main: {body/1e6:.1f} MB ({100*body/total:.0f} %), {body/max(insts, 1):.0f} bytes per instruction")
print()
print("constructs (bytes of the construct's own text; the exec test is a count):")
forlabel, vinconstruct.most_common():
print(f" {label}: {v:,}"+ (""iflabel.startswith("exec test") elsef" bytes ({100*v/total:.1f} %)"))
print()
print(f"top {top} opcodes by HLSL bytes (from their `// pc:` line to the next):")
print(f" {'opcode':<28}{'count':>10}{'bytes':>14}{'share':>7}{'per inst':>9}")
forop, (n, b) insorted(per_op.items(), key=lambdakv: -kv[1][1])[:top]:
print(f" {op:<28}{n:>10,}{b:>14,}{100*b/total:>6.1f}% {b/n:>9.0f}")
if__name__=="__main__":
main()
AI-assisted (Claude Code); tried only on my own hand-built programs.
and the thread dump has xcl-pso-5 … xcl-pso-14 all in ntdll.dll+0xa49f4 (a wait), none in DXC. Process commit stays around 14 GB and flat — nothing like the 84.7 GB @ofc0urse measured on the 8 GB card.
So on this machine the few large programs do not exhaust commit; the workers simply never come back. That fits their conclusion from the other side: the same programs, blocked, with enough RAM to hide the symptom. If that is right, a fix that keeps those compiles off the title's threads (or bounds them) would show up here as the queue starting to drain, not as a memory change — and that is easy to measure.
Offering: I have the title and a 4-minute build/run loop on this card. Happy to run any of these if useful — driver compile time for the specific large programs, -O0 vs -O1 vs -O3 on them on a 16 GB Blackwell card, or a patch that caps/refuses the oversized ones to see whether the queue drains (0 running → anything) and whether the world load completes. Counts and timings only.
1. The stall is compile throughput, not something else. Runs hold ~30 fps to about 70 s into the world load, fall to 7–8 fps, and the title's watchdog fires at 145–166 s. With XCL_PSO_WAIT_MS=5000 it still fires (166 s; 89 dispatches skipped). Thread stacks at the watchdog: 5 of the title's threads, the render submission thread among them, wait in pso_async::resolve_within ← resolve_for_bind ← bind::set_pipeline_state / execute_indirect. 3 xcl-pso workers wait for DXC (dxc::compile) and 3 are inside amdxc64.dll. No title thread is anywhere else.
2. DXC costs as much as the driver. One compute program of the size the world load builds (≈21 000 instructions, 5.7 MB HLSL, 4 heap windows, structured): DXC 23.6 s (-O1), 1 042 KB DXIL, then 30.2 s in the AMD driver. In two title runs the slowest driver builds were 850 KB DXIL in 64 s, 1 094 KB in 29.6 s, 975 KB in 26.2 s, 727 KB in 21.7 s. The driver blob cache across runs works (those come back in 2–9 ms the next run), but every run reaches programs it has not built yet.
3. On this driver, removing the guards makes the driver slower. Same program, one variant of the emitted HLSL at a time, each a distinct program so the driver's disk cache does not answer:
variant
DXIL
DXC
AMD driver
as emitted
1 042 KB
23.6 s
30.2 s
window index without NonUniformResourceIndex
1 042 KB
23.4 s
48.4 s
window buffer not globallycoherent
1 042 KB
23.6 s
28.4 s
no xcl_w >= 4 guard
922 KB
19.8 s
32.1 s
no exec select on vector writes
896 KB
19.0 s
45.0 s
Read (inference): on AMD Windows the gain of a direct backend should come mostly from not running DXC at all (the 23.6 s, and the workers queued behind it), not from fewer guards; a program with fewer guards was not cheaper for this driver. @gefydev this may be worth measuring on the driver side before turning the new path on by default.
What I can take on. I have what the direct backend's checklist cannot be tested on elsewhere so far: native 64-lane waves and the full title. Two offers, whichever helps, after you agree, so nothing is done twice:
the wave operations item for native wave64 (with GPU tests run through both paths on this card);
running your branch on the full title on AMD as soon as it is pushed, with DXC / driver times and the run's outcome.
AI use: Claude Code (Claude Opus 5.5) ran the measurements and wrote this.
@brainhay5 the first mode shows up on the 8 GB card too, so I think your split holds. From a thread dump at 600 s in a world load last night (an older local build: main508a0c7 plus #690 and local patches, so not today's main): a title thread was in pso_async::resolve_wait (via bind::graphics_bound) waiting for a graphics pipeline, while all 15 xcl-pso workers were idle and one xcl-dxc thread was inside dxcompiler on a ~25 MB DXIL compute program. That wait cleared by about 1000 s, so it was slow rather than stuck. On this card both modes happen in the same run: the idle workers, and the commit growth when the driver gets the largest programs.
AI use: Claude Code (Claude Opus 5.5) read the old dump and wrote this.
Cold compute pipeline timings on Linux — RTX 5070 Ti
I tested both memory-window modes of #680 at 95f34c1 with the synthetic nv680 split-wave64 compute probe. Each row is the median of three paired seeds. DXC used -O1, and each pipeline was created in a fresh Wine process with the vkd3d-proton and NVIDIA disk caches disabled. All 12 PSOs were created successfully.
Rounds per shader
DXC, switch → heap
DXIL, switch → heap
PSO creation, switch → heap
250
0.60 → 0.50 s
147 → 98 KiB
3.38 → 2.98 s
500
1.60 → 1.20 s
294 → 196 KiB
21.13 → 26.74 s
At 500 rounds the heap form produced one-third less DXIL and spent 27% longer in CreateComputePipelineState on vkd3d-proton 3.1.0. For the direct-DXIL work, this is a concrete case for timing cold PSO creation separately and comparing more than one shader size. The comparison here uses the current HLSL-to-DXIL path and synthetic shaders. Full test report and commands
Follow-up with the same DXIL
On the same RTX 5070 Ti and driver, changing vkd3d-proton reversed the result for the larger sample. These are 500-round medians across two paired seeds, with cold caches. The DXIL files were identical across builds. Upstream build
vkd3d-proton
D3D12 PSO creation, switch → heap
Vulkan pipeline feedback, switch → heap
3.1.0 (4522cc1)
21.2 → 24.9 s
7.6 → 8.9 s
ec207194 (dxil-spirv 7c04863)
17.1 → 1.8 s
15.5 → 1.5 s
For the direct-DXIL work, record the exact vkd3d-proton revision on Wine and keep DXIL generation, total D3D12 PSO latency, and Vulkan pipeline feedback as separate measurements. Full follow-up, method and CPU samples
I reproduced the read-select idea locally from pr1sm-dev's description. The four root UAVs stay bound. Each read uses its actual offset in the selected window and offset zero in the other three, then selects the value. An invalid window returns zero. Stores and atomics retain the switch. Original experiment
For compilation, I reused the synthetic split-wave64 HLSL from the #68095f34c1 benchmark above, with two seeds per size. I compared switch, #680 heap, and a local HLSL transformation; the four-window inputs otherwise match. Native DXC 1.9.2609.5 used -E main -T cs_6_6 -HV 2021 -O1. Each nv680 create <shader.dxil> ran in a fresh Wine process on vkd3d-proton ec20719452e916b (dxil-spirv 7c04863), with VKD3D_SHADER_CACHE_PATH=0, __GL_SHADER_DISK_CACHE=0 and VKD3D_CONFIG=pipeline_library_log. All 12 PSOs were created successfully and Vulkan feedback reported no cache reuse.
Rounds
Form
DXC wall
DXIL bytes
D3D12 PSO
Vulkan feedback
250
Switch
0.53–0.54 s
150,920
3.42–3.44 s
3.07–3.09 s
250
Heap
0.39 s
101,120–101,124
0.63–0.67 s
0.56–0.59 s
250
Read-select
0.53–0.58 s
161,516
1.71 s
1.49–1.50 s
500
Switch
1.38–1.39 s
301,100–301,104
17.30–20.31 s
15.79–18.75 s
500
Heap
0.97–0.98 s
201,208–201,212
1.85–1.89 s
1.54–1.57 s
500
Read-select
1.39 s
322,956–322,960
5.72–5.78 s
4.77–4.83 s
For execution I used a separate SM 6.6 wave32 shader, with four non-overlapping buffer regions and a dependent scalar read in each iteration. Each dispatch used 64 groups of 128 threads and 512 reads per lane. The CPU reference matched all 8,192 output words in all three modes with wave-uniform and wave-divergent window selection, and in a separate 17-iteration check that includes out-of-range IDs. Memory outside the output region was unchanged.
Form
Uniform window, ms/dispatch
Divergent window, ms/dispatch
Switch
0.123
0.164
Heap
0.112
0.104
Read-select
0.114
0.276
These are medians of three 64-dispatch batches per mode and pattern, with rotated order. I timed submission to fence completion and divided by 64. That interval includes the GPU buffer copies, UAV barriers, and queue/fence overhead. I discarded the D3D12 timestamps because their intervals did not scale reliably with the batch size on this stack. In this divergent workload, read-select cost about 69% more per dispatch than the switch, even though its cold PSOs built sooner. This dispatch test covers scalar loads on synthetic data.
Same Ryzen 7 9700X, RTX 5070 Ti and driver 620.73.04, Wine 11.22 and CachyOS kernel 7.3.5-2-cachyos. The dispatch helper was a Windows MSVC release cross-build based on #68095f34c1d1a24f644d0c4895810a7c36910b123e8 with local changes to bind the four regions and wait on the fence.
AI use — Codex (GPT-6, exact variant unavailable) ran the cross-build, measurements and profiling and drafted the report. Codex also reproduced the read-select accessor and ran the timed dispatch checks.
Numbers from AMD on Linux (RADV), on today's main and with 16 GB of RAM. @frozht is on the same GPU and driver with main47efa2e and is doing the per-program RADV driver times (their part 1), so I leave that to them. What follows is what changed between 384f7f7 and 930e8b4, which their runs and @Sr-0w's (b8b1f49) do not cover. Counts and timings only.
Setup: RX 7900 XT (RDNA3, wave64), Mesa RADV 26.2.5, i7-12700K, 16 GB RAM, CachyOS, Proton-CachyOS Wine, vkd3d-proton 0bb64c5 rebuilt with dxil-spirv 53aac41 (the #611 fix that #775 carries). Retail title, same scripted run each time (A every 4 s from 22 s, 240 s), XCL_PSO_PRELOAD=0.
XCL main 930e8b4 against main 384f7f7, both with the same local patches: #871, #684 and the sparse.rs part of #203. 2 runs on 384f7f7, 3 on 930e8b4 (1 with a cold cache, because b8b1f49 translates the shaders again, and 2 warm).
1. On a 16 GB machine, 9a272d4 + 25c6f7e remove a DXC stall that comes before the driver one.
On 384f7f7, world loading stopped with the title waiting for 5 xcl-dxc threads: one was compiling and the others were in the wait_for_memory queue. With 16 GB, less than 6 GB of commit is free at that point.
On 930e8b4, the DXC queue is empty when the run stops (1–2 of 19 DXC workers busy, at most 2 PSO workers busy). The title also reaches more of the load: 244–260 compute pipelines in the warm runs, against 142–185 before.
2. Behind it is the stall @frozht describes: the title's own thread builds big compute pipelines in RADV.
In each 930e8b4 run, one or more of the title's threads are inside build_compute → finish_pso → RADV when the run stops.
Example, one title thread back to back: 522 KB of DXIL in 11.2 s, 262 KB in 5.8 s, 234 KB in 4.8 s, then a next one still building at the stop. No frame is presented during these builds.
The title's hang watchdog (+0x23cf683) fires about 28–30 s after the last frame. With 930e8b4 the title gets to that stall sooner: at 158 s (cold run), 136 s and 134 s, against 185 s and 188 s on 384f7f7.
Peak RAM + swap of the game: ~12 GB.
3. b8b1f49 shows no visible change in RADV's time per KB. These are from the compute PSO … (N B DXIL, T ms) lines; builds that reused a driver blob are left out.
That is about 7–10 ms per KB above 128 KB, on both commits. b8b1f49 reports 95 s → 6 s for a Windows AMD driver; I do not see a change of that kind on RADV.
These are not the same programs on both sides, though: this is not a per-program comparison.
On 384f7f7, the time logged for a big build also includes its wait for the big-build slot (fixed in 25c6f7e). Those builds are few (3 at 256–512 KB).
The longest RADV build I saw was 11.2 s. These runs did not reach the ~1 MB programs.
Not tested: Windows, other AMD generations, a per-program before/after comparison (same DXIL hash on both commits), and xcl shaders --precompile --pipelines under Wine.
AI use: Claude Code (Claude Opus 5.5) ran the measurements and wrote this report. I checked it before posting.
Linux / NVIDIA (vkd3d-proton) numbers for this issue: where a compute pipeline's compile time goes, what b8b1f49 did to xcl pipelines, and the three screen-probe programs under Wine. Measurements only, no code.
Setup: RTX 3080 Ti 12 GB, NVIDIA 620.73.04 (Linux), i7-11700KF (8 cores / 16 threads), 32 GB RAM + 36 GB swap, CachyOS. Proton Experimental's Wine. vkd3d-proton masterec207194 (dxil-spirv 7c04863, which has dxil-spirv #371) with #257's patch. DXC 1.9.2609.5. Release, x86_64-pc-windows-msvc. Retail 1.0.2.1's journal (pipelines.bin, 58 745 pipelines: 56 011 graphics, 2 734 compute) and xcl pipelines (#759) under Wine, in a cgroup capped at 25 GB RAM + 32 GB swap.
1. Where the CPU time goes.perf record -F 199 on the xcl pipelines process for 30 s, 12 driver compiles and the DXC workers busy, about 83 500 samples. Tree: main930e8b4 + #688 + #759 + #684. This was ordinary 0.1–1 MB compute programs, none of the three below.
module
all samples
of the driver-compile (xcl-warm-*) threads
NVIDIA's compiler back end (libnvidia-gpucomp.so)
56.5 %
~88 %
NVIDIA's SPIR-V front end (libnvidia-glvkspirv.so)
3.2 %
~5 %
libc (allocator)
2.9 %
~4.5 %
vkd3d-proton incl. dxil-spirv (d3d12core.dll)
1.3 %
~2 %
DXC (dxcompiler.dll, on the xcl-dxc-* threads; Wine maps it anonymously, so perf shows [JIT])
35.9 %
–
So on Linux, with dxil-spirv #371, translating DXIL to SPIR-V is a small share. As on Windows, the time is in NVIDIA's compiler back end, so a smaller or simpler DXIL should help Linux about as much as Windows. DXC was the other third here, because b8b1f49 changed many programs and their DXIL was compiled again.
2. b8b1f49 on this machine, measured as xcl pipelines throughput on the same journal's compute part. Not a controlled A/B: the settings were tuned between runs, and the set of programs left differs a little.
930e8b4-based stack, same machine, same journal: 38–48 a minute in the same part (8–12 compiles at once), 11–25 GB, mostly no swap.
3. The three screen-probe programs under Wine. These are the ones @throny and @bstillbstill found at records 22 616–22 618: console CS 56c0cd3b82a00c6e (ActivateProbes, 29.75 MB DXIL), 958400d2caf07244 (ActivateProbesTarget, 29.6 MB) and 95cc13288a27a96e (ActivateRays, 14.1 MB), on 930e8b4. In this journal exactly one pipeline uses each.
When xcl pipelines reached them, the process went from 25 GB RAM + 5.8 GB swap to 25 GB + 26.5 GB in about a minute. I stopped it there.
With only ActivateProbes skipped (marked done) and the other two still in the batch, it passed 17 GB of swap within 40 s of the restart.
With all three marked done, the same run continued at 11.9 GB and no swap.
I didn't isolate a single one of them, so this is the three together, plus 9–11 ordinary compiles beside them. But on this stack they grow memory far faster than the 4.6 GB in 14 min @bstillbstill measured for ActivateRays with the Windows driver. On a 32 GB Linux machine they end a precompile pass within a minute or two, and the same would happen in a title run that starts one. I haven't profiled which module grows: NVIDIA's compiler or dxil-spirv (whose thread allocator frees nothing until a conversion ends, #611).
Not tested: Windows on this card. The three programs one at a time. #1278 / #1279. A title run on 930e8b4 (next, with and without #1288 + #1278).
AI use: Claude Code (Claude Opus 5.5) ran the builds, xcl pipelines, perf and the memory measurements, and wrote this comment. The runs are mine, on the hardware above.
@Kalmarv thanks, I will add that arm to the same two programs: XCL_DIRECT_DXIL=1 on #2126's head 3283da4, cold, on the RTX 4090, next to the default form and forced compact. If its compute split: line does not count them, I will add #2107's head d4b8717 as a fourth arm. Results will be in a new comment here.
AI use: Claude Code with Claude Opus 5.5 wrote this.
Claiming the direct DXIL lowering of v_fma_legacy_f32 and v_fmac_legacy_f32 for the signed-zero case in #679. Open PR #670 covers the HLSL emitter. I will check the direct backend on the RX 580, including the rounding-mode path, and compare shader translation time on identical inputs.
AI use: Codex (gpt-6.2-astra, max reasoning) wrote this claim.
@MK5280's 19 compute records (comment) on NVIDIA Ampere: all 19 build on the direct path, and 17 also build on the HLSL path. Unlike the RX 7900 XTX, the 3090 driver does not stall on them.
Each record ran on its own, with one process per phase and a cold driver cache (a freshly named exe each time).
Each process had an empty XCL_DXIL_CACHE, XCL_PSO_DISK_CACHE=0 and XCL_PIPELINE_THREADS=1.
Phase A was xcl shaders <dir> --precompile --only cs. The driver time is phase B (the same command plus --pipelines).
Direct used XCL_DIRECT_DXIL=1 with a 600 s limit, and no record fell back to HLSL. HLSL had a 300 s limit per phase.
Indices are 0-based in xcl shaders scan order. I checked them against 23087 → 84eee477d68b6fdf, 23208 → 219287eb2f6021fe and 23389 → 0452488acc062873.
Index
Record
DXIL direct / HLSL (KB)
Direct: driver (s)
HLSL: DXC (s)
HLSL: driver (s)
23087
84eee477d68b6fdf
1002 / 1258
56.6
25.3
191.5
23088
c331fc57a9e8a44f
1056 / 1338
57.0
37.3
218.2
23093
4ecb797ee46693ee
996 / 1250
58.0
27.5
108.4
23094
1eb03aedfe08c8e4
1051 / 1327
67.7
32.9
128.2
23097
02a31c25862c1c63
990 / 1256
53.5
21.9
110.8
23099
8b337b3794e49ba0
1036 / 1289
67.7
23.5
116.0
23100
87ac056e10a4c13c
1108 / 1394
78.8
26.2
126.2
23147
f6bddeff830e4c23
995 / 1247
63.1
24.3
123.8
23148
95d5f944e6abbab0
1055 / 1337
52.3
33.6
130.7
24432
7edad59e6718c369
934 / 1175
45.4
21.5
80.4
24435
69c7e2b365277ee3
991 / 1243
76.8
24.1
125.6
24436
0dae6bc6216f975d
1061 / 1332
56.2
30.6
123.2
24438
73dc0d51029621e8
934 / 1175
50.6
47.3
86.0
24441
3563f8ea6ead8725
934 / 1175
55.2
20.9
95.6
24444
e8c5b38fbd1e95f0
934 / 1175
54.0
21.6
85.6
24447
87b6235c6c391b35
934 / 1175
85.9
22.4
92.2
23211
df45a39c275d0db5
1276 / 1565
94.1
> 300
–
23212
f9d73adcc1ad69ef
1332 / 1638
114.1
278.6
144.4
23213
7b468aa4210b1810
1397 / –
106.4
> 300
–
Direct vs HLSL: in the driver, direct is 1.2–3.8× faster (45–114 s against 80–218 s), with about 20% smaller DXIL. Peak commit per process is 1.2–1.8 GB direct and 1.7–2.9 GB HLSL.
HLSL failures: 23211 and 23213 fail on HLSL in DXC itself (still running at 300 s), not in the driver.
3090 vs RX 7900 XTX: the 3090 is slower than the RX 7900 XTX on the direct path for the same records (your 24.5–57 s).
Run conditions: another workload of unknown size was using the GPU during these runs (9–39% before each). The driver build is mostly CPU work.
RTX 3090 follow-up: ActivateRays built a cold native pipeline in 24.954 s with direct DXIL and heap windows.
Tested shader 95cc13288a27a96e on an RTX 3090 24 GiB with NVIDIA driver 621.40 and a release build from 8e87fc7b62a87ea589ccb9ea6182f514016cf7db. Both XCL_DIRECT_DXIL=1 and XCL_HEAP_WINDOWS=1 were enabled. The harness recorded one direct compute translation and zero HLSL fallbacks. ShaderCacheControl succeeded.
Translation: 622 ms
DXIL: 3,324,912 bytes
Native CreateComputePipelineState: 24.954 s
Peak process private memory: 1,701 MB across the run
Neither the 5-minute cutoff nor the 12 GiB cap triggered
This is one cold offline measurement. My earlier #1321 run took 83 min 9 s for native pipeline creation on the same RTX 3090, using a different revision and driver. The rerun JSON omitted the revision because the harness was launched outside the worktree. I verified the worktree commit separately.
AI-assisted testing and reporting. Measurements were taken on my hardware.
Test reports wanted on the compact stack's current heads. The rebase this morning moved every head, so none of the reports so far count for #1607's triage, which needs two reports on the current head:
A report on #2025's head covers the whole stack (it holds #1316 → #2018). The most useful are AMD and Intel GPUs, and NVIDIA cards other than the RTX 4090. Post the suite counts (cargo test --workspace -- --test-threads=4: N passed, N failed, N ignored, plus the SKIPPED tests) and, if you can, an xcl-smoke block, on the PR itself and naming the head commit.
AI use: Claude Code with Claude Opus 5.5 wrote this.
Results for the two mid-size compute programs I claimed in 7156092162, with the arm @Kalmarv asked for. The compact form does not help programs of this size: forced compact builds 2.4–7.8× slower than the default form.
RTX 4090, NVIDIA 617.42, release builds, one record per run: xcl shaders <one record> --precompile --only cs, then --pipelines, with a fresh DXIL cache, XCL_PSO_DISK_CACHE=0 and a new exe copy per run. Every run reports pipelines made on the GPU 1, loaded from the driver cache 0, and every driver build took over 30 s.
The default and compact arms ran with XCL_PIPELINE_THREADS=1; the direct arms with the default thread count. For the direct arms "DXC" is the translation time, and there is no DXIL size, since that route writes no .dxil file to the cache folder.
Alone, these programs take 44–53 s in the driver. In the title, the same records took 97–157 s with 20–30 driver builds running at once, so most of that was the concurrency.
AI use: Claude Code with Claude Opus 5.5 (coordination, this comment). The runs were made by a Claude Code session with Claude Sonnet 5.5, on this machine.
@Pipodi, thanks, that settles the compact question for this size. One correction for the direct rows: xcl shaders --precompile --pipelines never builds the pieces. Pipelines::make in shaders.rs passes only c.dxil, the whole program, to CreateComputePipelineState. The pieces are built only in the runtime (real.rs → dispatch_chain::build). So both direct rows are whole direct builds, and that's also why no compute split: line appears.
ef008c0f04b6261a is one of the three programs in #2126's description. On an RTX 5070 Ti, cold, with 16 threads, it builds in 1.18 s split with #2126 and 2.47 s with #2080 alone, against 14.4 s whole. A title run with XCL_DIRECT_DXIL=1 is the way to see it on your machine, as you planned. The compute split: line every 10 s counts the programs split and the pieces built.
AI use: Claude Code (Claude Opus 5.5) checked the code path and wrote this.
Tested: Completed the requested independent check at #2025f698c22623c5ef846da3d0449679921c39a1d7a9. Full workspace: RTX 5080 1191 / 0 / 46 with 26 runtime skips; RTX 2080 SUPER 1191 / 0 / 46 with 28 runtime skips. The Radeon RDNA2 iGPU compact filter passed 25 / 0 / 0 with no runtime skips. Exact-head report with full specs, commands and skip details.
Not tested: Retail smoke, game samples and compile-time performance. No code change or competing PR.
AI use
Ran via Samaritan:
OpenCode with OpenAI GPT-6.2 Sol: ran and checked the Windows tests and wrote the report.
OpenCode with Claude Opus 5.5: independently checked campaign overlap and coordination.
Tested:#2174 verification complete at df450437987e300567610ab91902f1999fd3e9e4. Full workspace: RTX 5080 1157 / 0 / 46, 25 runtime skips; RTX 2080 SUPER 1157 / 0 / 46, 27 runtime skips. The focused direct compact filter passed 8 / 0 / 0, zero skips on each NVIDIA GPU and on Radeon RDNA2. Exact-head report with commands, specs and skip details.
Not tested: Retail smoke, samples or compile and execution timings. No code change.
AI use
Ran via Samaritan:
OpenCode with OpenAI GPT-6.2 Sol: checked scope and overlap, ran the two Windows tests and verified the report.
@Kalmarv the title runs with the split, as planned in 7156809244. Both builds are local and unchanged, with XCL_DIRECT_DXIL=1, a fresh DXIL cache, 300 s, and no frame budget. RTX 4090, NVIDIA 617.42, release.
The default (HLSL) route on the same title, with the same 1 MB class of programs, had driver builds of 97–157 s each, with 20–30 at once. On the direct route with either PR, no build comes near that.
The log has no line per split program, so I can't say whether ef008c0f04b6261a or fbf107654f3805d9 was among them.
AI use: Claude Code with Claude Opus 5.5 (coordination, this comment). The runs were made by a Claude Code session with Claude Sonnet 5.5, on this machine.
@Pipodi, thanks for the runs. One question on the stop time: did the main runs that stopped at 70–76 s also use XCL_DIRECT_DXIL=1?
On our RTX 5070 Ti, maincbc296a with XCL_DIRECT_DXIL=1 stops presenting at about 64 s, the same as #2080's heads (1302–1390 frames against 1310 in 120 s). So if your main runs were on the default HLSL route, 64–66 s is the direct route's stop. If they were direct too, it's a difference I'd want to look at.
Warm GPU A/B for #2174 at df450437987e300567610ab91902f1999fd3e9e4, with a local synthetic test-only overlay (SHA-256 015950fba67ffe526ede6586fd5a51576d71f3157458cc29833e7c1c65db00c3; no runtime patch). cargo test -p xcl --lib --locked scratch_nested_compact_warm_dispatch -- --test-threads=1 --nocapture: 1 passed / 0 failed / 0 ignored / 0 SKIPPED on each adapter. Windows 11 Pro 26200; MSVC, unoptimized test profile.
Used the existing multi_class_program fixture with 509/510 distinct prefix blocks and a 16-iteration loop, adding one observable store per lane in the compute ABI (32 groups × 64 lanes, one memory window). Both arms matched the independent CPU expectation for all 2,048 output words per shape. Forced compact for both arms; Auto at 511 emitted the same bytes as flat, at 512 selected groups of 32 and emitted a different container. runner::dispatch_timed measured dispatch GPU timestamps, not PSO creation; four alternating batches per arm, first dispatch excluded from each, 64 samples per arm.
At 512 classes on this fixture, nesting was effectively unchanged on RTX 5080, 4.8% slower at the median on RTX 2080 SUPER, and 14.3× faster on the Radeon iGPU. The 2080 SUPER slowdown appeared in all four batches. The sharp flat-path step from 511 to 512 on that adapter is a difference between two fixture shapes, not evidence of a driver mechanism or an in-game regression.
Group-width follow-up: Same tested base, hardware, command and profiles as above, with overlay SHA-256 f639911b7a348a7145b20067081e054531e82f8663bf178a3685dd3724297917. All three adapters again recorded 1 passed / 0 failed / 0 ignored / 0 SKIPPED. All 2,048 words per form matched the CPU reference, the 511-class control remained byte-identical, and Auto matched explicit width 32 at 512 and 513 classes. Four counterbalanced batches of 16 retained timestamps per arm.
GPU
Classes
Flat p50 (µs)
Width 16
Auto / 32
Width 64
RTX 5080
512
67.200
67.168
67.424
67.584
RTX 5080
513
68.672
68.672
68.704
68.704
RTX 2080 SUPER
512
489.568
497.776
513.744
505.376
RTX 2080 SUPER
513
475.088
864.128
511.616
507.936
Radeon RDNA2 iGPU
512
7760.920
762.240
543.200
905.220
Radeon RDNA2 iGPU
513
7819.040
746.000
580.420
915.540
No tested width beat flat at the median on the RTX 2080 SUPER. At 513 classes some batches on that card ran about 2.3× slower than others, including flat; the ranking there is not stable enough to tune the default. Width 32 remained fastest on this Radeon fixture and all widths were close on the RTX 5080. No recommendation for a driver-specific default from one synthetic workload.
Not tested: Retail inputs, smoke, cold PSO compile, larger class counts, other drivers or release. This is synthetic warm GPU execution evidence, not a recommendation to change the default.
AI use
Ran via Samaritan:
OpenCode with OpenAI GPT-6.2 Sol: researched the measurement method, implemented the test-only probe, ran both Windows PCs, audited parity and timings, and wrote this update.
Synthetic probe diff (optional reproduction; no game data)
Save as UTF-8/LF, apply with git apply in an isolated checkout of the tested commit, then run the command above with XCL_ADAPTER set to the desired adapter.
--- a/crates/xcl/src/gpu/dxil/compact_tests.rs+++ b/crates/xcl/src/gpu/dxil/compact_tests.rs@@ -305,3 +305,84 @@
.expect("nested budget GPU run");
assert_eq!((got3.sgpr, got3.vgpr, got3.scc), (plain3.sgpr, plain3.vgpr, plain3.scc), "nested loop budget");
}
++// Scratch measurement only: not part of the submitted PR or the workspace suite.+#[test]+fn scratch_nested_compact_warm_dispatch() {+ use super::compact::{plan, Nest};+ use super::kernel::{Entry, translate_compute_scratch_nest};+ use crate::gpu::recomp::CsInterface;++ let adapter = runner::adapter().expect("physical D3D12 adapter");+ assert!(runner::wave64_programs_supported().unwrap());+ let split = runner::split_wave64();+ let options = KernelOptions { wave64: true, split, mem_windows: 1, sampler_base: 0 };+ let cs = CsInterface { threads: [64, 1, 1], user_sgprs: 2, tgid: [true, false, false],+ tg_size: false, tid_components: 1 };+ let loops = 16;+ let groups = 32u32;+ let input = [1u32, 0];+ let sentinel = vec![u32::MAX; groups as usize * 64];+ println!("probe adapter={adapter} split_wave64={split} groups={groups} threads=64 loops={loops}");++ for (extra, should_nest) in [(509usize, false), (510, true)] {+ let mut code = multi_class_program(extra, loops);+ code.truncate(code.len() - 4);+ let mut add = |name, enc, fields: &[(&str, u64)]| {+ code.extend(encode(name, enc, fields, None).unwrap());+ };+ // Store one distinct observable result per lane: byte offset = group_x*256 + lane_x*4.+ add("V_MOV_B32", "ENC_VOP1", &[("VDST", 2), ("SRC0", 2)]);+ add("V_LSHLREV_B32", "ENC_VOP2", &[("VDST", 2), ("SRC0", 136), ("VSRC1", 2)]);+ add("V_LSHLREV_B32", "ENC_VOP2", &[("VDST", 6), ("SRC0", 130), ("VSRC1", 0)]);+ add("V_ADD_NC_U32", "ENC_VOP2", &[("VDST", 6), ("SRC0", 258), ("VSRC1", 6)]);+ add("V_MOV_B32", "ENC_VOP1", &[("VDST", 7), ("SRC0", 128)]);+ add("V_ADD_NC_U32", "ENC_VOP2", &[("VDST", 1), ("SRC0", 256), ("VSRC1", 1)]);+ add("V_ADD_NC_U32", "ENC_VOP2", &[("VDST", 1), ("SRC0", 4), ("VSRC1", 1)]);+ add("GLOBAL_STORE_DWORD", "ENC_FLAT_GLBL", &[("ADDR", 6), ("DATA", 1), ("SADDR", 0x7d)]);+ add("S_ENDPGM", "ENC_SOPP", &[]);++ let cfg = super::cfg::Cfg::build(&code).unwrap();+ let leaders = cfg.blocks.iter().filter_map(|b| b.insts.first().map(|&i| cfg.insts[i].pc)).collect();+ let lw = super::lower::Lw::new(&cfg.insts, &leaders, options, &Entry::Compute(cs.clone()));+ let classes = plan(&cfg, &lw).unwrap().rep.len();+ assert_eq!(classes, extra + 2, "fixture class count");+ assert_eq!(Nest::Auto.group_size(classes).is_some(), should_nest);+ let flat = translate_compute_scratch_nest(&code, options, &cs, Nest::Flat).unwrap();+ let auto = translate_compute_scratch_nest(&code, options, &cs, Nest::Auto).unwrap();+ assert_eq!(flat.dxil != auto.dxil, should_nest, "the selected form must differ only above threshold");+ assert!(flat.static_samplers.is_empty() && auto.static_samplers.is_empty());+ let read = |dxil: &[u8]| runner::dispatch(dxil, [groups, 1, 1], &input, &sentinel).unwrap();+ let a = read(&flat.dxil);+ let b = read(&auto.dxil);+ let mut scalar = input[0];+ let mut sum = loops;+ for k in 1..=extra as u32 {+ scalar = scalar.wrapping_add(k * 7 + 3);+ sum = sum.wrapping_add(scalar);+ }+ assert_eq!(a, b, "flat and auto GPU output");+ assert!(a.iter().enumerate().all(|(idx, &x)| x == sum.wrapping_add(idx as u32 % 64)),+ "output must also match the independent CPU expectation");++ // 4 batches per arm, alternating the starting arm. Drop the first dispatch per batch.+ let mut all = [Vec::new(), Vec::new()];+ let mut batches = [Vec::new(), Vec::new()];+ for arm in [0, 1, 1, 0, 1, 0, 0, 1] {+ let dxil = if arm == 0 { &flat.dxil } else { &auto.dxil };+ let mut ms = runner::dispatch_timed(dxil, [groups, 1, 1], &input, &sentinel, 17).unwrap()+ .into_iter().skip(1).map(|t| t * 1000.0).collect::<Vec<_>>();+ assert_eq!(ms.len(), 16);+ assert!(ms.iter().all(|&x| x.is_finite() && x > 0.0));+ ms.sort_by(f64::total_cmp);+ batches[arm].push((ms[7] + ms[8]) / 2.0);+ all[arm].extend(ms);+ }+ for (arm, all_us) in all.iter_mut().enumerate() {+ all_us.sort_by(f64::total_cmp);+ println!("bench classes={classes} arm={} dxil_B={} output_words={} n={} p50_us={:.3} p95_us={:.3} batch_medians_us={:?}",+ if arm == 0 { "flat" } else { "auto" }, if arm == 0 { flat.dxil.len() } else { auto.dxil.len() },+ a.len(), all_us.len(), (all_us[31] + all_us[32]) / 2.0, all_us[60], batches[arm]);+ }+ }+}--- a/crates/xcl/src/gpu/dxil/kernel.rs+++ b/crates/xcl/src/gpu/dxil/kernel.rs@@ -128,6 +128,13 @@
Vertex(VsInterface),
Pixel(PsInterface),
Geometry(GsInterface),
+}++#[cfg(test)]+pub(super) fn translate_compute_scratch_nest(+ code: &[u8], o: KernelOptions, cs: &CsInterface, nest: super::compact::Nest,+) -> Result<Kernel, String> {+ translate_entry(code, o, Entry::Compute(cs.clone()), Some(true), Some(nest))
}
/// A compute-mode program (the CS ABI of `cs`).
@Kalmarv No: the main runs that stopped at 70–76 s were on the default HLSL route. One main run of ours (b9b6ea6) had XCL_DIRECT_DXIL=1, with a fresh cache, 300 s. It stopped at 66 s (1,317 frames), which matches your 64 s. So 64–66 s is where the direct route stops, and #2107 and #2126 don't move it. My earlier comparison with 70–76 s set two routes side by side; it doesn't show a regression.
AMD Windows, retail 1.0.2.1: with every compute pipeline precompiled (all three ScreenProbes Activate* included), the world load no longer hits the watchdog. It now waits on graphics pipelines, built one at a time on a title thread at 5–11 s each in the AMD driver. Also: a precompile pass that resumes from the driver cache gets DXGI_ERROR_DEVICE_HUNG on AMD.
XCL_DIRECT_DXIL=1 XCL_COMPACT_CS=auto XCL_COMPACT_NEST=64 XCL_NETWORK=0, no heap windows. The three giants go to the compact form and every other compute program is direct.
One exe file name for the precompile and the title runs, because the AMD driver's own cache is keyed on it (@bielfreedom's A26).
RX 9060 XT 16 GB (driver 32.0.32029.2010), Ryzen 5 5600X, 64 GB RAM, Windows 11. No input after launch.
Precompile:xcl shaders shaders.rpf --precompile --only cs --pipelines at XCL_PIPELINE_THREADS=1–2.
All 2,689 compute programs translated. Every pipeline was built, except the 277 whose root signature the pass can't make.
The three ScreenProbes programs took 60.7 / 13.2 / 11.2 s.
The slowest single build was a CS_RaytracingResolve variant at 73.9 s. ~1 MB RaytracingResolve variants are most of the remaining driver time.
Then the full pack (--precompile): 25,808 translated, 19 errors (mesh shader validation).
Title runs (sequential, same caches)
run
presents stop
compute PSOs at runtime
graphics PSOs at runtime
end
1
~77 s
223, all from cache, 1.1 s in total
23 built, 7–11 s each, 171 s in total, one at a time from 109 s to 389 s
alive at 390 s (window closed), no watchdog
2
~60 s
(same)
run 1's 23 load in 1–3 ms; then 15 new ones, 5.4–8.5 s each (so far)
in progress
Before this, on the same machine (47efa2e, nothing precompiled), the title's watchdog killed it at 135–192 s in 3 of 3 runs, while title threads waited on compute builds.
With compute warm, no draw or dispatch is skipped and nothing is removed. Audio keeps playing, but the screen stays black: each run gets further into the world load and then waits on the next graphics pipelines.
The graphics pipelines are 270–370 KB of DXIL each, and the title thread builds them one after another.
The driver cache works across runs, so each run warms the next. Only new pipelines cost time.
Device hang on a resumed precompile (AMD)
After stopping a --pipelines pass mid-build, every later pass in a new process lost its device within ~1 minute.
In the first runs it was after 650–1,085 fast blob loads. With blob loads skipped, it was after 2–3 builds.
CreateComputePipelineState returned 0x887A0005, with GetDeviceRemovedReason0x887A0006 (DXGI_ERROR_DEVICE_HUNG). The System log has no TDR, and the process submits no GPU work.
Every failing program builds fine alone, the largest in 49.8 s.
What got it through:
4420b0d logs the error and the removed reason.
4420b0d also adds XCL_PRECOMPILE_SKIP_CACHED=1, which skips programs whose blob is on disk.
A loop that restarts the pass at 1 thread. The second pass then ran 4 h with 893 builds and no hang.
So the hang may have been a driver state left over from the stopped build. I have not reproduced it from a clean boot.
Precompiling graphics pipelines (they need the title's state), or building them off the title thread in parallel, is what would move the world load forward now.
Run 3 and the end of run 2 will show whether the world load finishes once graphics are warm too, or whether it meets the device removal @throny sees on NVIDIA. I'll edit this comment with those results.
Activity
throny commentedon Nov 24, 2026
Plan from our side, to avoid duplicate work: measurements first, no code yet.
On a retail shader pack (26 503 records, 2 689 compute programs) and an RTX 4080 (32-lane waves, so the split wave64 form), I will post here:
-O1/-O3around the 1 MB switch.xcl shaders --precompile --only csstops advancing after record 22 600 on three NVIDIA machines (Shaders: save offline compute pipelines to the runtime driver cache #744: one compile, over 33 minutes on one thread, memory growing past 14 GB). I will find which programs are still missing from the DXIL cache after those passes and what they have in common (size, loops, memory windows, cross-half exchanges).xcl pipelinespass (Shaders: xcl pipelines compiles a run's queued pipelines outside the title #759), for the compute programs the world load uses.Counts and timings only, no shader names or code. If the numbers point at a specific construct that makes DXC or the driver slow, I will propose a small PR for that one here before writing it. Direct DXIL emission is more than I will start on without a design agreed with you.
AI use: Claude Code (Claude Fable 5.2) will run the measurements and write the reports.
throny commentedon Nov 24, 2026
First numbers (parts 1 and 3 of the plan above).
main47efa2e, a retail pack's 2 689 compute programs, translated as a 32-lane GPU gets them (split wave64, 4 memory windows) and as a 64-lane GPU does; DXIL cache as two days of title runs and three stalled--precompile --only cspasses left it. A temporary local test, not for a PR; counts only.Where the precompile pass stops: the
-O0fallback, not the split form-O0,dxc.rs)--precompile --only cs --pipelinesstops advancing on the RTX 4080, 4090 and 5080 (Shaders: save offline compute pipelines to the runtime driver cache #744). DXC finishes them; it is the driver that is then handed a 14 – 30 MB DXIL and does not come back (33 minutes on one thread and still growing past 14 GB when I stopped it).-O0the DXIL is 0.92 – 0.96 of the HLSL size. For everything compiled with optimisation it is 0.27 – 0.28 (median, 1 161 programs). So these programs are about 3.4 times bigger than they would be optimised, on top of being the biggest sources.What the split wave64 form and the memory windows cost in source
Read (inference): on 32-lane and 64-lane GPUs alike, what DXC and the driver are given is roughly 240 bytes of source and 65 bytes of DXIL per console instruction; a program of 20 000 instructions is 5 MB of HLSL and 1.2 MB of DXIL however EXEC is handled. The
-O0threshold then makes the six largest programs worse instead of safer for the driver.Next from me (trimmed so it does not repeat others' parts): DXC time with and without the comments and indentation,
-O1against-O3under 8 MB, and the NVIDIA Windows driver's compile time against DXIL size from the title runs I already have. Not from me:-O0/-O1on the six largest and RADV driver times (@frozht), the direct backend (@gefydev), the synthetic benchmark (@BetterJdue).AI use: Claude Code (Claude Fable 5.2) wrote the measurement, ran it and wrote this.
Update: where the HLSL bytes go (same 2 689 programs in the split form; the split by the emitter's
// pc: mnemoniclines is @upipibi's idea from the comment below. I wrote my own script along those lines rather than run theirs, so any error in the numbers is mine.)mainmainbefore the first instruction (register loads)main, the instructionsInside
main, counting the matched text itself:// pc: mnemonic operandsper instruction)…_ea = …,xcl_w = …)select(lanebit(exec_lo, exec_hi),in wave64 programs andselect((((exec_lo >> lane_id) & 1u) != 0u),in wave32 onespcdispatch linesBy opcode group:
s_load_*buffer_*/global_*/flat_*v_cmp*image_*The single opcodes on top:
v_mul_legacy_f32431 MB (2.1 M uses, 204 bytes each),s_load_dwordx4259 MB (635 each),v_fmac_f32230 MB,v_fma_f32184 MB,s_buffer_load_dword158 MB (796 each),s_buffer_load_dwordx4131 MB (951 each).What follows from this:
-O1and-O0thresholds indxc.rsare on the source length, comments and indentation included. A program at the 8 MB-O0limit has about 3.5 MB of code. The six programs over it are 44 000 – 89 000 instructions.-O0against-O1for those six is @frozht's part 2 above, so I leave it to them and time only programs under 8 MB.ofc0urse commentedon Nov 24, 2026
A data point for the largest programs, from a 32-lane NVIDIA card with 8 GB (RTX 4060 Ti, driver 32.0.16.2124, i5-14400F, 32 GB RAM, retail 1.0.2.1).
On this machine those programs do more than make the load slow: they end the run. In the world load, a few compute programs of about 1 MB of DXIL took 60 to 97 s each in the driver, and process commit went from about 31 GB to 84.7 GB until Windows ran out of commit (numbers in #560 (comment)).
With a local patch that is not meant for upstream (compute programs of 768 KB of DXIL or more get the fallback CS instead of the driver's compile,
XCL_SKIP_CS_KB=768), 11 programs are refused per run, commit stays flat at about 31 GB, and the title gets through the world load. Today, with #640 and #1252 on top, that is far enough to draw world geometry on this card. So for an 8 GB NVIDIA machine, what happens to those few programs decides whether the world loads at all.I have not measured which of them are among the six over 8 MB of HLSL in your table.
AI use: Claude Code (Claude Opus 5.5) ran the runs and wrote this.
frozht commentedon Nov 24, 2026
Plan from our side, to complement @throny's numbers on AMD rather than repeat them: measurements first, no code yet.
Setup: RX 7900 XT (RDNA3, native 64-lane waves), RADV (Mesa 26.2.6), vkd3d-proton under Wine 11.22 Staging, Ryzen 9 5900X,
main47efa2e. On a retail title, the stall that ends our runs is compute pipelines built on the game's threads at a loading fade: about 240 compute PSOs, the large ones (150–533 KB DXIL) taking 3.8–12 s each in vkd3d-proton plus RADV, so this issue is our blocker too.What I will post here, from the
xcl shadersCLI and the title's own pipeline cache (no game runs):-O0against-O1for the programs whose HLSL is over 8 MB (the ones that compile at-O0indxc.rs): DXC time, DXIL size, and RADV's compile time on each result.-O1against-O3for a sample in the 1–8 MB range, judged by the driver's compile time as well as DXC's.Counts and timings only, no shader names or code. If (2) shows
-O1is better on both vendors, a small PR to drop the-O0fallback would be the natural follow-up; I will propose it here before writing it.AI use: Claude Code (Claude Opus 5.5) wrote this plan and will run the measurements and write the reports.
Mortaal339 commentedon Nov 24, 2026
Hey! I’m not a dev or anything, but I’d really love to help out with XCL.
Here’s my PC setup:
• Ryzen 5 5600X
• RTX 3060 OC 12GB
• 16GB RAM
• Windows 11
I was wondering if you guys could use an extra pair of hands for testing, finding bugs or collecting performance data.
I’m down to help out however I can, even though I don’t know how to code. Really appreciate the work you guys are putting into this project. Keep it up
gefydev commentedon Nov 24, 2026
The direct DXIL backend's progress report has moved to the bottom of the thread, where it is edited in place from now on: #1269 (comment)
upipibi commentedon Nov 24, 2026
@throny a tool for the next step of your plan, if it helps. You found about 240 bytes of HLSL per console instruction. This script splits that by opcode and by construct, using the
// pc: mnemonicline the emitter writes before every instruction. Run it over a folder fromxcl shaders <pack> --recompwithXCL_DUMP_HLSL=<dir> XCL_DUMP_EVERY=1. It prints counts and byte totals only, nothing of the programs. It uses only the standard library:python -I hlsl_bytes.py <dir> --top 30.It reports:
mainbytes, and bytes per instruction;select(lanebit(exec_lo, exec_hi), …), one per VALU write), comment lines (gone in DXIL, so DXC parse time only), cross-half exchanges, loop guards and memory-window switches;On a hand-built 19-instruction program it gives 110–160 bytes per VALU or store. In this form an exec select costs about 30 bytes per write, and
lanebitis recomputed at every write. Which opcodes reach the 240-byte average in real programs (my guess is buffer and image accesses with their bounds and window code) is what the top-30 table would show, and that is where a size cut would pay.hlsl_bytes.py
AI-assisted (Claude Code); tried only on my own hand-built programs.
brainhay5 commentedon Nov 24, 2026
A data point that may separate two failure modes.
main47efa2e, retail 1.0.2.1.Hardware: RTX 5070 Ti (Blackwell, 15,997 MiB VRAM), Ryzen 7 5800X3D, 64 GB RAM, Windows 11 22631, driver 32.0.16.1088, DXC 1.9.2602.17. 32-lane waves.
Pack statistics (
xcl shaders shaders.rpf --top 8, 4.5 s):The pool stalls without any memory pressure. During a world load, XCL's overlay at 95 s:
and the thread dump has
xcl-pso-5…xcl-pso-14all inntdll.dll+0xa49f4(a wait), none in DXC. Process commit stays around 14 GB and flat — nothing like the 84.7 GB @ofc0urse measured on the 8 GB card.So on this machine the few large programs do not exhaust commit; the workers simply never come back. That fits their conclusion from the other side: the same programs, blocked, with enough RAM to hide the symptom. If that is right, a fix that keeps those compiles off the title's threads (or bounds them) would show up here as the queue starting to drain, not as a memory change — and that is easy to measure.
Offering: I have the title and a 4-minute build/run loop on this card. Happy to run any of these if useful — driver compile time for the specific large programs,
-O0vs-O1vs-O3on them on a 16 GB Blackwell card, or a patch that caps/refuses the oversized ones to see whether the queue drains (0 running→ anything) and whether the world load completes. Counts and timings only.AI use: OpenCode, DeepSeek V4.1 Flash 1017.
Sr-0w commentedon Nov 24, 2026
AMD on Windows (native 64-lane waves): where the world-load stall comes from, and one result that matters for the direct backend
Setup: RX 7800 XT (RDNA3, native wave64), AMD driver on Windows 11, 64 GB RAM, DXC 1.9.2602.17.
mainb8b1f49+ #889 + #570 + #680 (XCL_HEAP_WINDOWS=1), retail 1.0.2.1. Counts and timings only.1. The stall is compile throughput, not something else. Runs hold ~30 fps to about 70 s into the world load, fall to 7–8 fps, and the title's watchdog fires at 145–166 s. With
XCL_PSO_WAIT_MS=5000it still fires (166 s; 89 dispatches skipped). Thread stacks at the watchdog: 5 of the title's threads, the render submission thread among them, wait inpso_async::resolve_within←resolve_for_bind←bind::set_pipeline_state/execute_indirect. 3xcl-psoworkers wait for DXC (dxc::compile) and 3 are insideamdxc64.dll. No title thread is anywhere else.2. DXC costs as much as the driver. One compute program of the size the world load builds (≈21 000 instructions, 5.7 MB HLSL, 4 heap windows, structured): DXC 23.6 s (
-O1), 1 042 KB DXIL, then 30.2 s in the AMD driver. In two title runs the slowest driver builds were 850 KB DXIL in 64 s, 1 094 KB in 29.6 s, 975 KB in 26.2 s, 727 KB in 21.7 s. The driver blob cache across runs works (those come back in 2–9 ms the next run), but every run reaches programs it has not built yet.3. On this driver, removing the guards makes the driver slower. Same program, one variant of the emitted HLSL at a time, each a distinct program so the driver's disk cache does not answer:
NonUniformResourceIndexgloballycoherentxcl_w >= 4guardselecton vector writesRead (inference): on AMD Windows the gain of a direct backend should come mostly from not running DXC at all (the 23.6 s, and the workers queued behind it), not from fewer guards; a program with fewer guards was not cheaper for this driver. @gefydev this may be worth measuring on the driver side before turning the new path on by default.
What I can take on. I have what the direct backend's checklist cannot be tested on elsewhere so far: native 64-lane waves and the full title. Two offers, whichever helps, after you agree, so nothing is done twice:
AI use: Claude Code (Claude Opus 5.5) ran the measurements and wrote this.
ofc0urse commentedon Nov 24, 2026
@brainhay5 the first mode shows up on the 8 GB card too, so I think your split holds. From a thread dump at 600 s in a world load last night (an older local build:
main508a0c7 plus #690 and local patches, so not today'smain): a title thread was inpso_async::resolve_wait(viabind::graphics_bound) waiting for a graphics pipeline, while all 15xcl-psoworkers were idle and onexcl-dxcthread was inside dxcompiler on a ~25 MB DXIL compute program. That wait cleared by about 1000 s, so it was slow rather than stuck. On this card both modes happen in the same run: the idle workers, and the commit growth when the driver gets the largest programs.AI use: Claude Code (Claude Opus 5.5) read the old dump and wrote this.
vitor127wt commentedon Nov 24, 2026
Cold compute pipeline timings on Linux — RTX 5070 Ti
I tested both memory-window modes of #680 at
95f34c1with the syntheticnv680split-wave64 compute probe. Each row is the median of three paired seeds. DXC used-O1, and each pipeline was created in a fresh Wine process with the vkd3d-proton and NVIDIA disk caches disabled. All 12 PSOs were created successfully.At 500 rounds the heap form produced one-third less DXIL and spent 27% longer in
CreateComputePipelineStateon vkd3d-proton 3.1.0. For the direct-DXIL work, this is a concrete case for timing cold PSO creation separately and comparing more than one shader size. The comparison here uses the current HLSL-to-DXIL path and synthetic shaders. Full test report and commandsFollow-up with the same DXIL
On the same RTX 5070 Ti and driver, changing vkd3d-proton reversed the result for the larger sample. These are 500-round medians across two paired seeds, with cold caches. The DXIL files were identical across builds. Upstream build
4522cc1)ec207194(dxil-spirv7c04863)For the direct-DXIL work, record the exact vkd3d-proton revision on Wine and keep DXIL generation, total D3D12 PSO latency, and Vulkan pipeline feedback as separate measurements. Full follow-up, method and CPU samples
Environment — RTX 5070 Ti (16,303 MiB), NVIDIA Linux driver 620.73.04, Ryzen 7 9700X, 30 GiB RAM visible to Linux, CachyOS kernel
7.3.5-2-cachyos, Wine 11.22, DXVKv2.7.1-498-ga6764047e587178, vkd3d-proton 3.1.0 (4522cc1a8b1347f), DXC 1.9.2609.5, Rust 1.100.0 (Windows MSVC debug cross-build).Read-select windows on the RTX 5070 Ti
I reproduced the read-select idea locally from pr1sm-dev's description. The four root UAVs stay bound. Each read uses its actual offset in the selected window and offset zero in the other three, then selects the value. An invalid window returns zero. Stores and atomics retain the switch. Original experiment
For compilation, I reused the synthetic split-wave64 HLSL from the #680
95f34c1benchmark above, with two seeds per size. I compared switch, #680 heap, and a local HLSL transformation; the four-window inputs otherwise match. Native DXC1.9.2609.5used-E main -T cs_6_6 -HV 2021 -O1. Eachnv680 create <shader.dxil>ran in a fresh Wine process on vkd3d-protonec20719452e916b(dxil-spirv7c04863), withVKD3D_SHADER_CACHE_PATH=0,__GL_SHADER_DISK_CACHE=0andVKD3D_CONFIG=pipeline_library_log. All 12 PSOs were created successfully and Vulkan feedback reported no cache reuse.For execution I used a separate SM 6.6 wave32 shader, with four non-overlapping buffer regions and a dependent scalar read in each iteration. Each dispatch used 64 groups of 128 threads and 512 reads per lane. The CPU reference matched all 8,192 output words in all three modes with wave-uniform and wave-divergent window selection, and in a separate 17-iteration check that includes out-of-range IDs. Memory outside the output region was unchanged.
These are medians of three 64-dispatch batches per mode and pattern, with rotated order. I timed submission to fence completion and divided by 64. That interval includes the GPU buffer copies, UAV barriers, and queue/fence overhead. I discarded the D3D12 timestamps because their intervals did not scale reliably with the batch size on this stack. In this divergent workload, read-select cost about 69% more per dispatch than the switch, even though its cold PSOs built sooner. This dispatch test covers scalar loads on synthetic data.
Same Ryzen 7 9700X, RTX 5070 Ti and driver 620.73.04, Wine 11.22 and CachyOS kernel
7.3.5-2-cachyos. The dispatch helper was a Windows MSVC release cross-build based on #68095f34c1d1a24f644d0c4895810a7c36910b123e8with local changes to bind the four regions and wait on the fence.AI use — Codex (GPT-6, exact variant unavailable) ran the cross-build, measurements and profiling and drafted the report. Codex also reproduced the read-select accessor and ran the timed dispatch checks.
GreemSC commentedon Nov 24, 2026
Numbers from AMD on Linux (RADV), on today's
mainand with 16 GB of RAM. @frozht is on the same GPU and driver withmain47efa2e and is doing the per-program RADV driver times (their part 1), so I leave that to them. What follows is what changed between 384f7f7 and 930e8b4, which their runs and @Sr-0w's (b8b1f49) do not cover. Counts and timings only.Setup: RX 7900 XT (RDNA3, wave64), Mesa RADV 26.2.5, i7-12700K, 16 GB RAM, CachyOS, Proton-CachyOS Wine, vkd3d-proton 0bb64c5 rebuilt with dxil-spirv 53aac41 (the #611 fix that #775 carries). Retail title, same scripted run each time (A every 4 s from 22 s, 240 s),
XCL_PSO_PRELOAD=0.XCL main 930e8b4 against main 384f7f7, both with the same local patches: #871, #684 and the
sparse.rspart of #203. 2 runs on 384f7f7, 3 on 930e8b4 (1 with a cold cache, because b8b1f49 translates the shaders again, and 2 warm).1. On a 16 GB machine, 9a272d4 + 25c6f7e remove a DXC stall that comes before the driver one.
xcl-dxcthreads: one was compiling and the others were in thewait_for_memoryqueue. With 16 GB, less than 6 GB of commit is free at that point.2. Behind it is the stall @frozht describes: the title's own thread builds big compute pipelines in RADV.
build_compute→finish_pso→ RADV when the run stops.+0x23cf683) fires about 28–30 s after the last frame. With 930e8b4 the title gets to that stall sooner: at 158 s (cold run), 136 s and 134 s, against 185 s and 188 s on 384f7f7.3. b8b1f49 shows no visible change in RADV's time per KB. These are from the
compute PSO … (N B DXIL, T ms)lines; builds that reused a driver blob are left out.Not tested: Windows, other AMD generations, a per-program before/after comparison (same DXIL hash on both commits), and
xcl shaders --precompile --pipelinesunder Wine.AI use: Claude Code (Claude Opus 5.5) ran the measurements and wrote this report. I checked it before posting.
itsd-effex commentedon Nov 24, 2026
Linux / NVIDIA (vkd3d-proton) numbers for this issue: where a compute pipeline's compile time goes, what
b8b1f49did toxcl pipelines, and the three screen-probe programs under Wine. Measurements only, no code.Setup: RTX 3080 Ti 12 GB, NVIDIA 620.73.04 (Linux), i7-11700KF (8 cores / 16 threads), 32 GB RAM + 36 GB swap, CachyOS. Proton Experimental's Wine. vkd3d-proton
masterec207194(dxil-spirv7c04863, which has dxil-spirv #371) with #257's patch. DXC 1.9.2609.5. Release,x86_64-pc-windows-msvc. Retail 1.0.2.1's journal (pipelines.bin, 58 745 pipelines: 56 011 graphics, 2 734 compute) andxcl pipelines(#759) under Wine, in a cgroup capped at 25 GB RAM + 32 GB swap.1. Where the CPU time goes.
perf record -F 199on thexcl pipelinesprocess for 30 s, 12 driver compiles and the DXC workers busy, about 83 500 samples. Tree:main930e8b4+ #688 + #759 + #684. This was ordinary 0.1–1 MB compute programs, none of the three below.xcl-warm-*) threadslibnvidia-gpucomp.so)libnvidia-glvkspirv.so)d3d12core.dll)dxcompiler.dll, on thexcl-dxc-*threads; Wine maps it anonymously, so perf shows[JIT])So on Linux, with dxil-spirv #371, translating DXIL to SPIR-V is a small share. As on Windows, the time is in NVIDIA's compiler back end, so a smaller or simpler DXIL should help Linux about as much as Windows. DXC was the other third here, because
b8b1f49changed many programs and their DXIL was compiled again.2.
b8b1f49on this machine, measured asxcl pipelinesthroughput on the same journal's compute part. Not a controlled A/B: the settings were tuned between runs, and the set of programs left differs a little.47efa2e-based stack (Shaders: isolate DXC compiler heaps for parallel AOT #688, Shaders: save offline compute pipelines to the runtime driver cache #744, Shaders: xcl pipelines compiles a run's queued pipelines outside the title #759, D3D12.X: XCL_BIG_COMPILES sets how many big compute pipelines the driver builds at once #820, XG: fix CopyFromSubresource 7-argument ABI and guard destination span #684): 3.5–11 compute pipelines a minute in the part after ~50 800 of 58 745 (4–11 big compiles at once). With 7–11 at once, it needed 25 GB RAM + 5–18 GB swap, and single compiles ran 9–13 min.930e8b4-based stack, same machine, same journal: 38–48 a minute in the same part (8–12 compiles at once), 11–25 GB, mostly no swap.3. The three screen-probe programs under Wine. These are the ones @throny and @bstillbstill found at records 22 616–22 618: console CS
56c0cd3b82a00c6e(ActivateProbes, 29.75 MB DXIL),958400d2caf07244(ActivateProbesTarget, 29.6 MB) and95cc13288a27a96e(ActivateRays, 14.1 MB), on930e8b4. In this journal exactly one pipeline uses each.xcl pipelinesreached them, the process went from 25 GB RAM + 5.8 GB swap to 25 GB + 26.5 GB in about a minute. I stopped it there.I didn't isolate a single one of them, so this is the three together, plus 9–11 ordinary compiles beside them. But on this stack they grow memory far faster than the 4.6 GB in 14 min @bstillbstill measured for ActivateRays with the Windows driver. On a 32 GB Linux machine they end a precompile pass within a minute or two, and the same would happen in a title run that starts one. I haven't profiled which module grows: NVIDIA's compiler or dxil-spirv (whose thread allocator frees nothing until a conversion ends, #611).
Not tested: Windows on this card. The three programs one at a time. #1278 / #1279. A title run on
930e8b4(next, with and without #1288 + #1278).AI use: Claude Code (Claude Opus 5.5) ran the builds,
xcl pipelines,perfand the memory measurements, and wrote this comment. The runs are mine, on the hardware above.803 remaining items
Pipodi commentedon Nov 25, 2026
@Kalmarv thanks, I will add that arm to the same two programs:
XCL_DIRECT_DXIL=1on #2126's head3283da4, cold, on the RTX 4090, next to the default form and forced compact. If itscompute split:line does not count them, I will add #2107's headd4b8717as a fourth arm. Results will be in a new comment here.AI use: Claude Code with Claude Opus 5.5 wrote this.
philip-roy-jones commentedon Nov 25, 2026
Claiming the direct DXIL lowering of
v_fma_legacy_f32andv_fmac_legacy_f32for the signed-zero case in #679. Open PR #670 covers the HLSL emitter. I will check the direct backend on the RX 580, including the rounding-mode path, and compare shader translation time on identical inputs.AI use: Codex (gpt-6.2-astra, max reasoning) wrote this claim.
PracticalStudios commentedon Nov 25, 2026
@MK5280's 19 compute records (comment) on NVIDIA Ampere: all 19 build on the direct path, and 17 also build on the HLSL path. Unlike the RX 7900 XTX, the 3090 driver does not stall on them.
Setup: RTX 3090 24 GB, driver 621.24, Ryzen 7 9800X3D,
maincbc296a release, default root-windows form.XCL_DXIL_CACHE,XCL_PSO_DISK_CACHE=0andXCL_PIPELINE_THREADS=1.xcl shaders <dir> --precompile --only cs. The driver time is phase B (the same command plus--pipelines).XCL_DIRECT_DXIL=1with a 600 s limit, and no record fell back to HLSL. HLSL had a 300 s limit per phase.xcl shadersscan order. I checked them against 23087 →84eee477d68b6fdf, 23208 →219287eb2f6021feand 23389 →0452488acc062873.afpruivo commentedon Nov 25, 2026
RTX 3090 follow-up: ActivateRays built a cold native pipeline in 24.954 s with direct DXIL and heap windows.
Tested shader
95cc13288a27a96eon an RTX 3090 24 GiB with NVIDIA driver 621.40 and a release build from8e87fc7b62a87ea589ccb9ea6182f514016cf7db. BothXCL_DIRECT_DXIL=1andXCL_HEAP_WINDOWS=1were enabled. The harness recorded one direct compute translation and zero HLSL fallbacks.ShaderCacheControlsucceeded.CreateComputePipelineState: 24.954 sThis is one cold offline measurement. My earlier #1321 run took 83 min 9 s for native pipeline creation on the same RTX 3090, using a different revision and driver. The rerun JSON omitted the revision because the harness was launched outside the worktree. I verified the worktree commit separately.
AI-assisted testing and reporting. Measurements were taken on my hardware.
Pipodi commentedon Nov 25, 2026
Test reports wanted on the compact stack's current heads. The rebase this morning moved every head, so none of the reports so far count for #1607's triage, which needs two reports on the current head:
7fadd0895e8abc5040ea1f698c22A report on #2025's head covers the whole stack (it holds #1316 → #2018). The most useful are AMD and Intel GPUs, and NVIDIA cards other than the RTX 4090. Post the suite counts (
cargo test --workspace -- --test-threads=4: N passed, N failed, N ignored, plus the SKIPPED tests) and, if you can, anxcl-smokeblock, on the PR itself and naming the head commit.AI use: Claude Code with Claude Opus 5.5 wrote this.
Pipodi commentedon Nov 25, 2026
Results for the two mid-size compute programs I claimed in 7156092162, with the arm @Kalmarv asked for. The compact form does not help programs of this size: forced compact builds 2.4–7.8× slower than the default form.
RTX 4090, NVIDIA 617.42, release builds, one record per run:
xcl shaders <one record> --precompile --only cs, then--pipelines, with a fresh DXIL cache,XCL_PSO_DISK_CACHE=0and a new exe copy per run. Every run reportspipelines made on the GPU 1,loaded from the driver cache 0, and every driver build took over 30 s.fbf107654f3805d9: DXIL / DXC / driver / peakef008c0f04b6261a: DXIL / DXC / driver / peakXCL_COMPACT_CS=0)main568e7db+ #1931 + #929 + #1316 → #2025 (f698c22)XCL_COMPACT_CS=1,XCL_COMPACT_NEST=0)XCL_DIRECT_DXIL=1)3283da4XCL_DIRECT_DXIL=1)d4b8717XCL_PIPELINE_THREADS=1; the direct arms with the default thread count. For the direct arms "DXC" is the translation time, and there is no DXIL size, since that route writes no.dxilfile to the cache folder.compute split:line is written only on the runtime dispatch path (real/dispatch_chain.rs), soxcl shaders --pipelinesnever prints it. The direct route is 5–35 % faster in the driver here and uses less memory. A title run of Recompiler: give a compute loop above the split target its own dispatch piece #2107 withXCL_DIRECT_DXIL=1comes next, to read the split line.compact_wantedto this size. The thresholds in Recompiler: XCL_COMPACT_NEST=auto nests programs of 512 cases or more #2018 / Recompiler: nest the compact dispatch of big programs by default #2025 stay as they are.AI use: Claude Code with Claude Opus 5.5 (coordination, this comment). The runs were made by a Claude Code session with Claude Sonnet 5.5, on this machine.
Kalmarv commentedon Nov 25, 2026
@Pipodi, thanks, that settles the compact question for this size. One correction for the direct rows:
xcl shaders --precompile --pipelinesnever builds the pieces.Pipelines::makeinshaders.rspasses onlyc.dxil, the whole program, toCreateComputePipelineState. The pieces are built only in the runtime (real.rs→dispatch_chain::build). So both direct rows are whole direct builds, and that's also why nocompute split:line appears.ef008c0f04b6261ais one of the three programs in #2126's description. On an RTX 5070 Ti, cold, with 16 threads, it builds in 1.18 s split with #2126 and 2.47 s with #2080 alone, against 14.4 s whole. A title run withXCL_DIRECT_DXIL=1is the way to see it on your machine, as you planned. Thecompute split:line every 10 s counts the programs split and the pieces built.AI use: Claude Code (Claude Opus 5.5) checked the code path and wrote this.
itsSio commentedon Nov 25, 2026
Tested: Completed the requested independent check at #2025
f698c22623c5ef846da3d0449679921c39a1d7a9. Full workspace: RTX 5080 1191 / 0 / 46 with 26 runtime skips; RTX 2080 SUPER 1191 / 0 / 46 with 28 runtime skips. The Radeon RDNA2 iGPU compact filter passed 25 / 0 / 0 with no runtime skips. Exact-head report with full specs, commands and skip details.Not tested: Retail smoke, game samples and compile-time performance. No code change or competing PR.
AI use
Ran via Samaritan:
board: A50 result
itsSio commentedon Nov 25, 2026
Tested: #2174 verification complete at
df450437987e300567610ab91902f1999fd3e9e4. Full workspace: RTX 5080 1157 / 0 / 46, 25 runtime skips; RTX 2080 SUPER 1157 / 0 / 46, 27 runtime skips. The focused direct compact filter passed 8 / 0 / 0, zero skips on each NVIDIA GPU and on Radeon RDNA2. Exact-head report with commands, specs and skip details.Not tested: Retail smoke, samples or compile and execution timings. No code change.
AI use
Ran via Samaritan:
board: A50 result
Pipodi commentedon Nov 25, 2026
@Kalmarv the title runs with the split, as planned in 7156809244. Both builds are local and unchanged, with
XCL_DIRECT_DXIL=1, a fresh DXIL cache, 300 s, and no frame budget. RTX 4090, NVIDIA 617.42, release.compute split:at the endd4b87173283da4ef008c0f04b6261aorfbf107654f3805d9was among them.main. This is without D3D12.X: add opt-in per-frame PSO wait budget (XCL_PSO_FRAME_WAIT_MS) #1931's frame budget, so the title waits on its pipelines at the stop.AI use: Claude Code with Claude Opus 5.5 (coordination, this comment). The runs were made by a Claude Code session with Claude Sonnet 5.5, on this machine.
Kalmarv commentedon Nov 25, 2026
@Pipodi, thanks for the runs. One question on the stop time: did the
mainruns that stopped at 70–76 s also useXCL_DIRECT_DXIL=1?On our RTX 5070 Ti,
maincbc296awithXCL_DIRECT_DXIL=1stops presenting at about 64 s, the same as #2080's heads (1302–1390 frames against 1310 in 120 s). So if yourmainruns were on the default HLSL route, 64–66 s is the direct route's stop. If they were direct too, it's a difference I'd want to look at.AI use: Claude Code (Claude Opus 5.5) wrote this.
itsSio commentedon Nov 25, 2026
Tested
Warm GPU A/B for #2174 at
df450437987e300567610ab91902f1999fd3e9e4, with a local synthetic test-only overlay (SHA-256015950fba67ffe526ede6586fd5a51576d71f3157458cc29833e7c1c65db00c3; no runtime patch).cargo test -p xcl --lib --locked scratch_nested_compact_warm_dispatch -- --test-threads=1 --nocapture: 1 passed / 0 failed / 0 ignored / 0 SKIPPED on each adapter. Windows 11 Pro 26200; MSVC, unoptimized test profile.32.0.16.1088, split wave64)32.0.16.1088, split wave64)32.0.21043.5001, native wave64)Used the existing
multi_class_programfixture with 509/510 distinct prefix blocks and a 16-iteration loop, adding one observable store per lane in the compute ABI (32 groups × 64 lanes, one memory window). Both arms matched the independent CPU expectation for all 2,048 output words per shape. Forced compact for both arms;Autoat 511 emitted the same bytes as flat, at 512 selected groups of 32 and emitted a different container.runner::dispatch_timedmeasured dispatch GPU timestamps, not PSO creation; four alternating batches per arm, first dispatch excluded from each, 64 samples per arm.At 512 classes on this fixture, nesting was effectively unchanged on RTX 5080, 4.8% slower at the median on RTX 2080 SUPER, and 14.3× faster on the Radeon iGPU. The 2080 SUPER slowdown appeared in all four batches. The sharp flat-path step from 511 to 512 on that adapter is a difference between two fixture shapes, not evidence of a driver mechanism or an in-game regression.
Group-width follow-up: Same tested base, hardware, command and profiles as above, with overlay SHA-256
f639911b7a348a7145b20067081e054531e82f8663bf178a3685dd3724297917. All three adapters again recorded 1 passed / 0 failed / 0 ignored / 0 SKIPPED. All 2,048 words per form matched the CPU reference, the 511-class control remained byte-identical, andAutomatched explicit width 32 at 512 and 513 classes. Four counterbalanced batches of 16 retained timestamps per arm.No tested width beat flat at the median on the RTX 2080 SUPER. At 513 classes some batches on that card ran about 2.3× slower than others, including flat; the ranking there is not stable enough to tune the default. Width 32 remained fastest on this Radeon fixture and all widths were close on the RTX 5080. No recommendation for a driver-specific default from one synthetic workload.
Not tested: Retail inputs, smoke, cold PSO compile, larger class counts, other drivers or release. This is synthetic warm GPU execution evidence, not a recommendation to change the default.
AI use
Ran via Samaritan:
Synthetic probe diff (optional reproduction; no game data)
Save as UTF-8/LF, apply with
git applyin an isolated checkout of the tested commit, then run the command above withXCL_ADAPTERset to the desired adapter.board: A52 result
Pipodi commentedon Nov 25, 2026
@Kalmarv No: the
mainruns that stopped at 70–76 s were on the default HLSL route. Onemainrun of ours (b9b6ea6) hadXCL_DIRECT_DXIL=1, with a fresh cache, 300 s. It stopped at 66 s (1,317 frames), which matches your 64 s. So 64–66 s is where the direct route stops, and #2107 and #2126 don't move it. My earlier comparison with 70–76 s set two routes side by side; it doesn't show a regression.AI use: Claude Code with Claude Opus 5.5.
DTsordas commentedon Nov 25, 2026
AMD Windows, retail 1.0.2.1: with every compute pipeline precompiled (all three ScreenProbes
Activate*included), the world load no longer hits the watchdog. It now waits on graphics pipelines, built one at a time on a title thread at 5–11 s each in the AMD driver. Also: a precompile pass that resumes from the driver cache getsDXGI_ERROR_DEVICE_HUNGon AMD.Follow-up to the
XCL_COMPACT_NESTnumbers. This is the AMD half of @throny's NVIDIA result.Setup
game-compact4420b0d. It contains Recompiler: route compute programs through a compact backend (XCL_COMPACT_CS) #1316 + Recompiler: compact cases share code whose branch targets differ #1448 + Recompiler: compact dispatch can switch in two levels (XCL_COMPACT_NEST) #1692 (as of9c09c8f), merged withmain20cf130, plus my precompile tools.XCL_DIRECT_DXIL=1 XCL_COMPACT_CS=auto XCL_COMPACT_NEST=64 XCL_NETWORK=0, no heap windows. The three giants go to the compact form and every other compute program is direct.Precompile:
xcl shaders shaders.rpf --precompile --only cs --pipelinesatXCL_PIPELINE_THREADS=1–2.CS_RaytracingResolvevariant at 73.9 s. ~1 MBRaytracingResolvevariants are most of the remaining driver time.--precompile): 25,808 translated, 19 errors (mesh shader validation).Title runs (sequential, same caches)
47efa2e, nothing precompiled), the title's watchdog killed it at 135–192 s in 3 of 3 runs, while title threads waited on compute builds.Device hang on a resumed precompile (AMD)
--pipelinespass mid-build, every later pass in a new process lost its device within ~1 minute.CreateComputePipelineStatereturned0x887A0005, withGetDeviceRemovedReason0x887A0006(DXGI_ERROR_DEVICE_HUNG). The System log has no TDR, and the process submits no GPU work.4420b0dlogs the error and the removed reason.4420b0dalso addsXCL_PRECOMPILE_SKIP_CACHED=1, which skips programs whose blob is on disk.What this suggests
AI use: Claude Code (Claude Opus 5.5) wrote the code, ran the measurements and wrote this report.