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
Shaders: every split compute program starts its own piece-builder threads (verification help wanted) #2880
Could someone verify whether per-shader worker creation adds measurable time or peak thread/commit pressure during startup shader preparation or xcl shaders --precompile --only cs --pipelines on Windows?
On main at 8b957bec, precompile starts DXC compile_threads() + 2 shader workers. Each can encounter a split compute shader and create a fresh scoped group of up to min(piece_count, XCL_PIPELINE_THREADS) helpers, then wait for the group. All groups share a single Pipelines::running gate. Root-signature setup and disk blob loading happen before the gate. With XCL_DXC_THREADS=15, the default four pipeline slots and 17 simultaneous four-piece shaders, the scheduling structure permits 68 helpers for four concurrent native calls, plus the 17 shader workers and any DXC workers. Startup preparation uses this path before guest entry.
A standalone Linux probe reused the per-shader scheduling and admission code with simulated pieces and synchronized their arrival. It observed 86 live threads including probe main, the 17 shader workers and all 68 helpers, with a peak of four simulated native admissions. That shows what can overlap. How often it happens and how much it costs on real workloads are unmeasured.
Please verify with a split-heavy compute corpus on a wave32 adapter. Hold XCL_DXC_THREADS, XCL_PIPELINE_THREADS, the native inputs, and cache state constant. Compare current behavior with a bounded shared queue of piece jobs that keeps the same native-create limit. Record the number of split shaders and pieces, thread starts and peak live threads, time queued at driver admission, process peak commit, and end-to-end preparation time. Try both warm and cold driver blobs and check that both variants build the same pieces and retain equivalent cache results. If only thread counts move, that would narrow the case for changing it.
Related work includes the worker-count benchmark in #2088, cancellation in #2830, and driver admission by commit headroom in #2179.
AI use: Codex (GPT-6, exact serving variant unavailable) used Graphify, checked the source and related work, ran the scheduling probe, and drafted this report.
I measured a Windows RTX 3080 baseline on clean main at 8b957bec: 12 fresh offline-precompile processes, with three cold/warm pairs each for one and four synthetic split compute shaders. Each cold process started with an empty XCL cache. I left the NVIDIA and OS caches in place.
Cold runs
One shader
Four shaders
Pieces obtained
5
20
Median sampled peak private memory
91.805 MiB
111.914 MiB
Sampled peak thread count, range
16–31
18–34
Process elapsed time, range
459–500 ms
469–550 ms
The private-memory ranges were separate; the thread-count and elapsed-time ranges overlapped. These are sampled process peaks, so short-lived helpers could fall between observations. Changing the corpus also changes the amount of shader work. This gives a baseline for an identical-corpus scheduler A/B; it does not isolate the cost of creating per-shader helpers.
I used Codex GPT-6.2 Sol for the measurements. A separate GPT-6.2 Sol agent checked the inputs and artifacts and independently reduced the saved samples. Codex GPT-6.2 Astra wrote this comment.
Asking for a verification run of this on a wave32-only adapter (NVIDIA, Intel, or AMD with XCL_SPLIT_WAVE64=1) with a corpus heavy in split compute shaders. The baseline above (5 and 20 pieces, about 0.5 s) never fills the four driver slots, so it can't show the effect either way. The run needs many split programs and more in flight than XCL_PIPELINE_THREADS.
Two points the issue doesn't mention:
In make_one, the driver blob is read into memory (driver_cache::load, a full fs::read) before the running gate. On a warm run, every waiting helper holds its blob, so up to pieces × shader workers blobs can be in memory while 4 builds run. That could raise peak commit more than the threads do, and it shows on warm runs.
The shader worker waits for all its pieces, so a burst of split programs leaves fewer threads translating for the DXC pool. Any time effect should show in end-to-end time, not thread count.
Profile
Fixed for every run:XCL_DXC_THREADS=15 (or your machine's value, the same on every run), XCL_PIPELINE_THREADS=4, XCL_PIPELINE_MAX_KB at its default, XCL_DXIL_CACHE pointed at a dedicated folder, a release build, nothing else using the GPU.
Corpus: a pack whose summary line split compute programs: N (M pieces) shows at least a few hundred pieces. Please give N and M.
Cache states, 3 runs each:
Driver-cold: warm DXIL cache (one untimed run first), then delete %XCL_DXIL_CACHE%\driver and the driver's own shader cache (%LOCALAPPDATA%\NVIDIA\DXCache / %LOCALAPPDATA%\D3DSCache) before each run. DXC is then mostly cache hits, so this isolates the pipeline scheduling.
Warm: run again straight after a driver-cold run without deleting anything. This is the case for the blob read before the gate.
Optional, fully cold: empty XCL_DXIL_CACHE. Here DXC dominates; it shows whether any of this matters end to end.
Record for each run:
the time … s line, and the pipelines made / refused / loaded from the driver cache and split compute programs lines
peak live threads and total threads created. Sampled counts miss short-lived helpers: a WPR trace (wpr -start GeneralProfile) or a ≤10 ms sampler of Get-Process … .Threads.Count
peak commit of the process (PeakPagedMemorySize64 / PeakPagefileUsage, or a ≤50 ms sampler of PrivateMemorySize64)
if you can, time spent waiting at the running gate (a Tracy or WPR wait analysis)
Equivalence check between the two schedulers: the set of file names in %XCL_DXIL_CACHE%\driver (*.pso, *.chain.pso) and the made / refused / reused counts should be the same.
I'll open a draft PR with a bounded shared piece queue (the same 4-slot native limit, XCL_PIPELINE_THREADS builder threads started once, and so at most that many blobs read at once) to compare against main with this profile. If only thread counts move, that's worth knowing too.
AI use: Claude Code (Claude Opus 5.5) read the code on main at 8b957bec and drafted this comment; no measurements were made for it.
I measured admission waits on main8b957bec6f82495aec940944c6bf47faa02db590 with an opt-in probe on the existing gate. The synthetic corpus contains 160 wave32 split compute programs and 800 distinct pieces. Both native cache states filled all four admission slots in every run. In the warm runs, peak cached waiters ranged from 61 to 63 and peak queued blob bytes from 116,530 to 119,814. Peak process commit was measured separately. Exact probe source and deterministic corpus generator
Pair and XCL blob state
Process ms
Peak sampled threads
Sampled thread IDs
Peak commit MiB
Requests that waited / peak waiting
Summed wait s
Queued blob bytes at peak
1 cold
920
98
671
136.41
780 / 64
21.798
0
1 warm
313
95
293
109.95
711 / 61
2.810
116,530
2 cold
940
97
670
139.86
787 / 64
22.519
0
2 warm
329
98
339
110.12
734 / 61
3.202
116,626
3 cold
1,438
97
669
109.98
789 / 64
42.287
0
3 warm
312
103
336
109.99
733 / 63
3.046
119,814
Each measured process exited 0, made 800 pipelines with zero refusals, and had zero translation errors or skips. All six produced the same 800 .chain.pso file names. Cold runs had 0 accepted blob hits. Warm runs had 800 each. The CLI preparation times were 0.8, 0.9, and 1.4 s cold and 0.3 s in each warm run. The longest individual admission wait was 484.48 ms cold and 19.94 ms warm. Summed waits overlap across requests. Sampled thread IDs are a lower bound on threads created. Peak commit uses PeakPagedMemorySize64.
The six runs and an initial cache seed ran serially on an RTX 4080, driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC and DXC 1.8.2502.11. Each cold leg copied the same seeded translation directory to a fresh XCL cache with no driver directory. Each warm leg reused its paired cache. NVIDIA and Windows system caches were retained.
Every leg used XCL_ADAPTER=4080 XCL_NETWORK=0 XCL_DXC_THREADS=15 XCL_PIPELINE_THREADS=4 XCL_DIRECT_DXIL=1 XCL_DIRECT_SPLIT_INSTRUCTIONS=12 XCL_PSO_DISK_CACHE=1 XCL_SPLIT_GATE_PROBE=1, the default XCL_PIPELINE_MAX_KB, and a private XCL_DXIL_CACHE. The corpus manifest SHA-256 is 75b27646d15556b9b6ad44198cfeecf8485184d88f87acadb44a346895d77924. This measures current-main admission under the probe. Scheduler A/B and retail startup are outside these results.
Fully XCL-cold follow-up
I repeated the same release build and native command on main 8b957bec6f82495aec940944c6bf47faa02db590 with the probe extended to print the existing compiler counters. The same RTX 4080 and driver 621.01 ran three pairs serially. Each empty leg started with zero XCL cache files. Each seeded leg started with 160 translated entries and zero driver blobs. The first and third pairs ran empty first. The second ran seeded first. NVIDIA and Windows caches were retained. Exact probe source
Pair
Empty XCL cache, process ms
Seeded translation cache, process ms
Empty / seeded summed admission wait, s
1
2,951
1,275
83.650 / 36.332
2
1,013
923
26.784 / 22.827
3
1,212
3,178
33.624 / 132.544
Each leg reported 160 programs, 800 split pieces, four occupied admission slots at peak, zero accepted driver blobs, and zero refusals, translation errors, or skips. All six emitted the same 800 driver-cache file names and recorded zero HLSL compile attempts. Each empty leg recorded 160 direct translations and zero HLSL fallbacks. Each seeded leg recorded 160 cache hits. The probe's hits field is a shared counter that includes translated entries.
A fresh-cache positive control used the same command and corpus with XCL_DIRECT_DXIL=0. It recorded 160 HLSL compile attempts and completions with zero failures, then made 160 whole PSOs with zero refusals or skips. The Direct DXIL measurements establish that this corpus bypasses the HLSL compilation pool even with an empty XCL cache. HLSL pool utilization on a mixed corpus, system-driver-cold behavior, and the other scheduler remain outside this comparison.
Thank you @Gevroska, @CryingLaughing and @ettehn. Between you there's a main baseline, a gate probe on main, and an A/B of main against #2931 (ettehn, on the PR). That's enough to answer most of this issue. The two 800-piece runs (160 programs × 5 pieces) agree with each other and with the code, so here is what I read from them.
1. The thread counts match the code exactly. On main, each program starts min(5, 4) = 4 helpers, so 160 × 4 = 640 helpers per pass. Add the 17 shader workers and the 15 DXC threads and you get ≈ 672. Both of you saw 669–672 thread IDs on cold runs. The lower warm counts (293–607) are helpers that lived for less than one sample interval, not fewer threads. On #2931 the count is 35–36 (17 workers, 4 builders, the DXC pool). The PR does what it says: 640 thread starts per pass become 4, and peak live threads drop from about 99 to 35.
2. The gate decides the time, not the scheduling. In CryingLaughing's probe all 4 slots were full in every run, with 61–64 helpers waiting at the peak. Summed wait divided by process time comes to about 24–29 waiters on average cold and about 9–10 warm. Pipelines are built 4 at a time in both versions, so nothing should change cold. ettehn's cold medians (0.771 → 0.730 s, with an outlier in the base set) agree. For time, the lever is the slot count (XCL_PIPELINE_THREADS, bounded by commit, #2179), not who waits at the gate.
3. My blob concern doesn't hold at this scale. At the warm peak the waiters held 116–120 KB of blobs in total, about 1.9 KB each. That's negligible here. Retail blobs can be far larger, so it stays open for a retail pack, but the synthetic corpus can't show it.
4. The commit saved is thread stacks. ettehn's medians went down 11.8 MiB cold (112.6 → 100.8) and 8.8 MiB warm (150.5 → 141.7). Spread over the ~64 fewer live threads, that's 140–190 KB each, about what a thread's committed stack and TEB cost. It's real but small: about 10 MiB at the peak.
5. The warm run is slightly slower on #2931 (0.441 → 0.471 s), and there's a plausible cause. On main, the waiting helpers have already looked up their root signature and read their blob, so a freed slot is refilled at once. On #2931 the 4 builders are the 4 slots, so each builder reads its next blob after releasing its slot, and the slot sits idle during the read. That's nothing on cold builds (up to 484 ms each), but warm builds are short (2.8–3.2 s of summed wait over 711–734 waiting requests), so the read shows. That's a guess from 3 runs each on a 0.4 s fixture. One way to test it: run 2 × XCL_PIPELINE_THREADS builders, which keeps a read-ahead and still bounds threads and blobs. I can add that to #2931 as a variant.
What this means. On a corpus like this, per-program helpers cost about 640 thread starts and about 10 MiB of commit per pass, and no measurable time. That's a weak case for the change unless a retail pack shows more. Still not measured:
a retail split-heavy pack (blob sizes, piece-count spread)
driver-cold runs (all three runs kept the NVIDIA cache)
fully cold DXIL, where a worker waiting for its pieces could leave the DXC pool idle; every run so far seeded the translation cache
an ETW count of thread creations, rather than sampled thread IDs
AI use: Claude Code (Claude Opus 5.5) analysed the posted data and drafted this comment. I made no new measurements for it.
changed the title [-]Verify whether per-shader split workers add startup precompile overhead[/-][+]Shaders: every split compute program starts its own piece-builder threads (verification help wanted)[/+]on Nov 27, 2026
Activity
Gevroska commentedon Nov 26, 2026
I measured a Windows RTX 3080 baseline on clean
mainat8b957bec: 12 fresh offline-precompile processes, with three cold/warm pairs each for one and four synthetic split compute shaders. Each cold process started with an empty XCL cache. I left the NVIDIA and OS caches in place.The private-memory ranges were separate; the thread-count and elapsed-time ranges overlapped. These are sampled process peaks, so short-lived helpers could fall between observations. Changing the corpus also changes the amount of shader work. This gives a baseline for an identical-corpus scheduler A/B; it does not isolate the cost of creating per-shader helpers.
I used Codex GPT-6.2 Sol for the measurements. A separate GPT-6.2 Sol agent checked the inputs and artifacts and independently reduced the saved samples. Codex GPT-6.2 Astra wrote this comment.
KOLESNiii commentedon Nov 27, 2026
Asking for a verification run of this on a wave32-only adapter (NVIDIA, Intel, or AMD with
XCL_SPLIT_WAVE64=1) with a corpus heavy in split compute shaders. The baseline above (5 and 20 pieces, about 0.5 s) never fills the four driver slots, so it can't show the effect either way. The run needs many split programs and more in flight thanXCL_PIPELINE_THREADS.Two points the issue doesn't mention:
make_one, the driver blob is read into memory (driver_cache::load, a fullfs::read) before therunninggate. On a warm run, every waiting helper holds its blob, so up topieces × shader workersblobs can be in memory while 4 builds run. That could raise peak commit more than the threads do, and it shows on warm runs.Profile
Fixed for every run:
XCL_DXC_THREADS=15(or your machine's value, the same on every run),XCL_PIPELINE_THREADS=4,XCL_PIPELINE_MAX_KBat its default,XCL_DXIL_CACHEpointed at a dedicated folder, a release build, nothing else using the GPU.Command:
Corpus: a pack whose summary line
split compute programs: N (M pieces)shows at least a few hundred pieces. Please give N and M.Cache states, 3 runs each:
%XCL_DXIL_CACHE%\driverand the driver's own shader cache (%LOCALAPPDATA%\NVIDIA\DXCache/%LOCALAPPDATA%\D3DSCache) before each run. DXC is then mostly cache hits, so this isolates the pipeline scheduling.XCL_DXIL_CACHE. Here DXC dominates; it shows whether any of this matters end to end.Record for each run:
time … sline, and thepipelines made / refused / loaded from the driver cacheandsplit compute programslineswpr -start GeneralProfile) or a ≤10 ms sampler ofGet-Process … .Threads.CountPeakPagedMemorySize64/ PeakPagefileUsage, or a ≤50 ms sampler ofPrivateMemorySize64)runninggate (a Tracy or WPR wait analysis)Equivalence check between the two schedulers: the set of file names in
%XCL_DXIL_CACHE%\driver(*.pso,*.chain.pso) and the made / refused / reused counts should be the same.I'll open a draft PR with a bounded shared piece queue (the same 4-slot native limit,
XCL_PIPELINE_THREADSbuilder threads started once, and so at most that many blobs read at once) to compare againstmainwith this profile. If only thread counts move, that's worth knowing too.AI use: Claude Code (Claude Opus 5.5) read the code on
mainat8b957becand drafted this comment; no measurements were made for it.CryingLaughing commentedon Nov 27, 2026
I measured admission waits on
main8b957bec6f82495aec940944c6bf47faa02db590with an opt-in probe on the existing gate. The synthetic corpus contains 160 wave32 split compute programs and 800 distinct pieces. Both native cache states filled all four admission slots in every run. In the warm runs, peak cached waiters ranged from 61 to 63 and peak queued blob bytes from 116,530 to 119,814. Peak process commit was measured separately. Exact probe source and deterministic corpus generatorEach measured process exited 0, made 800 pipelines with zero refusals, and had zero translation errors or skips. All six produced the same 800
.chain.psofile names. Cold runs had 0 accepted blob hits. Warm runs had 800 each. The CLI preparation times were 0.8, 0.9, and 1.4 s cold and 0.3 s in each warm run. The longest individual admission wait was 484.48 ms cold and 19.94 ms warm. Summed waits overlap across requests. Sampled thread IDs are a lower bound on threads created. Peak commit usesPeakPagedMemorySize64.The six runs and an initial cache seed ran serially on an RTX 4080, driver 621.01, Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC and DXC 1.8.2502.11. Each cold leg copied the same seeded translation directory to a fresh XCL cache with no
driverdirectory. Each warm leg reused its paired cache. NVIDIA and Windows system caches were retained.Every leg used
XCL_ADAPTER=4080 XCL_NETWORK=0 XCL_DXC_THREADS=15 XCL_PIPELINE_THREADS=4 XCL_DIRECT_DXIL=1 XCL_DIRECT_SPLIT_INSTRUCTIONS=12 XCL_PSO_DISK_CACHE=1 XCL_SPLIT_GATE_PROBE=1, the defaultXCL_PIPELINE_MAX_KB, and a privateXCL_DXIL_CACHE. The corpus manifest SHA-256 is75b27646d15556b9b6ad44198cfeecf8485184d88f87acadb44a346895d77924. This measures current-main admission under the probe. Scheduler A/B and retail startup are outside these results.Fully XCL-cold follow-up
I repeated the same release build and native command on main
8b957bec6f82495aec940944c6bf47faa02db590with the probe extended to print the existing compiler counters. The same RTX 4080 and driver 621.01 ran three pairs serially. Each empty leg started with zero XCL cache files. Each seeded leg started with 160 translated entries and zero driver blobs. The first and third pairs ran empty first. The second ran seeded first. NVIDIA and Windows caches were retained. Exact probe sourceEach leg reported 160 programs, 800 split pieces, four occupied admission slots at peak, zero accepted driver blobs, and zero refusals, translation errors, or skips. All six emitted the same 800 driver-cache file names and recorded zero HLSL compile attempts. Each empty leg recorded 160 direct translations and zero HLSL fallbacks. Each seeded leg recorded 160 cache hits. The probe's
hitsfield is a shared counter that includes translated entries.A fresh-cache positive control used the same command and corpus with
XCL_DIRECT_DXIL=0. It recorded 160 HLSL compile attempts and completions with zero failures, then made 160 whole PSOs with zero refusals or skips. The Direct DXIL measurements establish that this corpus bypasses the HLSL compilation pool even with an empty XCL cache. HLSL pool utilization on a mixed corpus, system-driver-cold behavior, and the other scheduler remain outside this comparison.KOLESNiii commentedon Nov 27, 2026
Thank you @Gevroska, @CryingLaughing and @ettehn. Between you there's a
mainbaseline, a gate probe onmain, and an A/B ofmainagainst #2931 (ettehn, on the PR). That's enough to answer most of this issue. The two 800-piece runs (160 programs × 5 pieces) agree with each other and with the code, so here is what I read from them.1. The thread counts match the code exactly. On
main, each program startsmin(5, 4) = 4helpers, so 160 × 4 = 640 helpers per pass. Add the 17 shader workers and the 15 DXC threads and you get ≈ 672. Both of you saw 669–672 thread IDs on cold runs. The lower warm counts (293–607) are helpers that lived for less than one sample interval, not fewer threads. On #2931 the count is 35–36 (17 workers, 4 builders, the DXC pool). The PR does what it says: 640 thread starts per pass become 4, and peak live threads drop from about 99 to 35.2. The gate decides the time, not the scheduling. In CryingLaughing's probe all 4 slots were full in every run, with 61–64 helpers waiting at the peak. Summed wait divided by process time comes to about 24–29 waiters on average cold and about 9–10 warm. Pipelines are built 4 at a time in both versions, so nothing should change cold. ettehn's cold medians (0.771 → 0.730 s, with an outlier in the base set) agree. For time, the lever is the slot count (
XCL_PIPELINE_THREADS, bounded by commit, #2179), not who waits at the gate.3. My blob concern doesn't hold at this scale. At the warm peak the waiters held 116–120 KB of blobs in total, about 1.9 KB each. That's negligible here. Retail blobs can be far larger, so it stays open for a retail pack, but the synthetic corpus can't show it.
4. The commit saved is thread stacks. ettehn's medians went down 11.8 MiB cold (112.6 → 100.8) and 8.8 MiB warm (150.5 → 141.7). Spread over the ~64 fewer live threads, that's 140–190 KB each, about what a thread's committed stack and TEB cost. It's real but small: about 10 MiB at the peak.
5. The warm run is slightly slower on #2931 (0.441 → 0.471 s), and there's a plausible cause. On
main, the waiting helpers have already looked up their root signature and read their blob, so a freed slot is refilled at once. On #2931 the 4 builders are the 4 slots, so each builder reads its next blob after releasing its slot, and the slot sits idle during the read. That's nothing on cold builds (up to 484 ms each), but warm builds are short (2.8–3.2 s of summed wait over 711–734 waiting requests), so the read shows. That's a guess from 3 runs each on a 0.4 s fixture. One way to test it: run2 × XCL_PIPELINE_THREADSbuilders, which keeps a read-ahead and still bounds threads and blobs. I can add that to #2931 as a variant.What this means. On a corpus like this, per-program helpers cost about 640 thread starts and about 10 MiB of commit per pass, and no measurable time. That's a weak case for the change unless a retail pack shows more. Still not measured:
AI use: Claude Code (Claude Opus 5.5) analysed the posted data and drafted this comment. I made no new measurements for it.
[-]Verify whether per-shader split workers add startup precompile overhead[/-][+]Shaders: every split compute program starts its own piece-builder threads (verification help wanted)[/+]Shaders: split compute pieces share one pool of piece builders