Shaders: --precompile --processes N builds in N processes #1492

Open
tycosnh wants to merge 1 commit from upstream-pr/1502 into main
tycosnh commented 2026-11-24 17:01:24 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tycosnh on 2026-11-24T17:01:24Z.


Requested by Edison · project thread

xcl shaders --precompile --pipelines builds compute pipelines in one process, and NVIDIA's driver builds about one pipeline at a time per process however many threads ask: on an RTX 4090 with 12 pipeline threads, 2 threads were busy and the CPU sat at 28 %. --processes N runs the precompile in N processes of xcl shaders, each taking every N-th record (--shard k/N) and sharing the DXIL and driver-blob caches. On the same 343 compute programs from cold caches, 4 processes took 765 s against 2 060 s for one. Part of #1269.

What is in it

  • crates/xcl/src/shaders.rs: --shard k/n (a process takes records k, k + n, …; the others count as done) and --processes N (starts N children with --shard k/N, gives each its share of the DXC threads and 2 pipeline threads unless XCL_DXC_THREADS / XCL_PIPELINE_THREADS are set, waits, returns the first failing child's exit code). Unit test shards_split_the_records_and_drop_processes.
  • crates/xcl/tests/gpu_compute_e2e.rs: offline_compute_pipelines_split_over_processes: two programs, --processes 2, each child builds one pipeline and the shared cache gets two driver blobs.
  • README.md: the option on the --precompile line.

Tested

  • RTX 4090 (driver 621.24), Ryzen 7 9800X3D, 31 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 MSVC, release.
  • cargo test --release --workspace -- --test-threads=4 at c65e2c8: 722 passed, 1 failed, 21 ignored. The failure is launcher::tests::console_detection (console_imports of the test exe gives None); it fails the same way on main b7aa9f3 here. SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).
  • cargo test --release -p xcl --test gpu_compute_e2e offline_compute: 2 passed (the new test and #744's).
  • Retail shaders.rpf (26 503 records), --precompile --pipelines --only cs --limit 22500, each run into its own empty XCL_DXIL_CACHE (and --windows 3 / --windows 5 so the driver's own cache could not carry over between the two): one process 343 programs in 2 060 s; --processes 4 the same 343 (86 / 85 / 86 / 86) in 765 s. Driver blobs after 5 / 10 / 20 min: one process 149 / 219 / 231, four 251 / 326 / 336.

Regression run

main:

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 4090
title: retail game
seconds: 60
exit: 0x0
frames shown: 1151 (PresentX 1151)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17010 MB

PR:

xcl-smoke v1
commit: c65e2c8b459dd4ac45ff427b3e89abbb5ef707df
gpu: NVIDIA GeForce RTX 4090
title: retail game
seconds: 60
exit: 0x0
frames shown: 1664 (PresentX 1664)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17111 MB

The title run does not reach the changed code (it is the xcl shaders CLI); it is the regression check the rules ask for.

Not tested

  • AMD and Intel GPUs, and Linux / Wine (whether their drivers also build one pipeline at a time per process).
  • The whole pack with --processes: a few programs make the driver's build run for a very long time and grow past tens of GB (one passed 54 GB here without finishing); with several processes at once that needs RAM to spare. Not handled in this PR.

AI use

  • Claude Code with Claude Opus 5.5: wrote the change, the tests and this description, and ran the tests and measurements on the hardware above.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5476691836 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502). Originally posted by [tycosnh](https://github.com/tycosnh) on 2026-11-24T17:01:24Z. --- <!-- claude-projects-attribution: {"github_login":"tycosnh"} --> _Requested by **Edison** · [project thread](https://claude.ai/code/project/chan_019M5yYnsP2JNMhjUNHbnwch?thread=cmsg_019M5yYnsP2JNMhjUNHbnwchXNac5AXSRFgmwUFw9xarEc)_ `xcl shaders --precompile --pipelines` builds compute pipelines in one process, and NVIDIA's driver builds about one pipeline at a time per process however many threads ask: on an RTX 4090 with 12 pipeline threads, 2 threads were busy and the CPU sat at 28 %. `--processes N` runs the precompile in N processes of `xcl shaders`, each taking every N-th record (`--shard k/N`) and sharing the DXIL and driver-blob caches. On the same 343 compute programs from cold caches, 4 processes took 765 s against 2 060 s for one. Part of #1269. **What is in it** - `crates/xcl/src/shaders.rs`: `--shard k/n` (a process takes records k, k + n, …; the others count as done) and `--processes N` (starts N children with `--shard k/N`, gives each its share of the DXC threads and 2 pipeline threads unless `XCL_DXC_THREADS` / `XCL_PIPELINE_THREADS` are set, waits, returns the first failing child's exit code). Unit test `shards_split_the_records_and_drop_processes`. - `crates/xcl/tests/gpu_compute_e2e.rs`: `offline_compute_pipelines_split_over_processes`: two programs, `--processes 2`, each child builds one pipeline and the shared cache gets two driver blobs. - `README.md`: the option on the `--precompile` line. **Tested** - RTX 4090 (driver 621.24), Ryzen 7 9800X3D, 31 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 MSVC, release. - `cargo test --release --workspace -- --test-threads=4` at c65e2c8: 722 passed, 1 failed, 21 ignored. The failure is `launcher::tests::console_detection` (`console_imports` of the test exe gives `None`); it fails the same way on `main` b7aa9f3 here. SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64). - `cargo test --release -p xcl --test gpu_compute_e2e offline_compute`: 2 passed (the new test and #744's). - Retail `shaders.rpf` (26 503 records), `--precompile --pipelines --only cs --limit 22500`, each run into its own empty `XCL_DXIL_CACHE` (and `--windows 3` / `--windows 5` so the driver's own cache could not carry over between the two): one process 343 programs in 2 060 s; `--processes 4` the same 343 (86 / 85 / 86 / 86) in 765 s. Driver blobs after 5 / 10 / 20 min: one process 149 / 219 / 231, four 251 / 326 / 336. **Regression run** main: ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 4090 title: retail game seconds: 60 exit: 0x0 frames shown: 1151 (PresentX 1151) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17010 MB ``` PR: ``` xcl-smoke v1 commit: c65e2c8b459dd4ac45ff427b3e89abbb5ef707df gpu: NVIDIA GeForce RTX 4090 title: retail game seconds: 60 exit: 0x0 frames shown: 1664 (PresentX 1664) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17111 MB ``` The title run does not reach the changed code (it is the `xcl shaders` CLI); it is the regression check the rules ask for. **Not tested** - AMD and Intel GPUs, and Linux / Wine (whether their drivers also build one pipeline at a time per process). - The whole pack with `--processes`: a few programs make the driver's build run for a very long time and grow past tens of GB (one passed 54 GB here without finishing); with several processes at once that needs RAM to spare. Not handled in this PR. **AI use** - Claude Code with Claude Opus 5.5: wrote the change, the tests and this description, and ran the tests and measurements on the hardware above. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
vitor127wt commented 2026-11-24 18:09:01 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vitor127wt on 2026-11-24T17:27:47Z.


A9 (nv-linux) — Offline PSO parallelism on the RTX 5070 Ti

I tested clean head c65e2c8b459dd4ac45ff427b3e89abbb5ef707df under Wine with eight isolated Series 1.0.2.1 compute records (127,416–251,140 B of DXIL apiece). All modes used the same precompiled DXIL, four memory windows and split wave64. The benchmark ran twice, with the cold-mode order reversed in the second round.

Mode Cold wall time Cold peak cgroup memory Blob-only restore wall time Vulkan reuse on restore
1 process × 1 PSO thread 20.28–20.61 s 0.92–1.03 GiB 1.04–1.06 s 8/8 in both rounds
1 process × 4 PSO threads 8.19–8.23 s 0.94–0.98 GiB 5.15–5.44 s 5/8 and 6/8
4 processes × 1 PSO thread each 9.23–9.36 s 1.70–1.73 GiB 2.20–2.21 s 8/8 in both rounds

All runs made eight pipelines, zero refused. The four-process runs showed four shards and two pipelines made per shard. The cold runs reported zero XCL driver cache hits. The restore runs reported eight hits and retrieved all eight SPIR-V modules from their blobs. With four threads, Vulkan feedback still recorded three recompilations in the first restore and two in the second. I crossed the caches in both directions (serial build → four-thread restore and four-thread build → serial restore). All four crossed runs recorded six Vulkan hits and two recompilations, with eight XCL hits.

I ran xcl shaders <eight records> --precompile --only cs --windows 4 --split 1 --pipelines, adding --processes 4 for the last row. I set XCL_PIPELINE_THREADS to 1, 4, and 1 respectively, and kept XCL_DXC_THREADS=2. Each cold run started with an empty XCL driver subdirectory and a copy of the same DXIL cache. Each restore kept that run’s XCL blobs. XCL_PSO_DISK_CACHE=1, VKD3D_SHADER_CACHE_PATH=0, __GL_SHADER_DISK_CACHE=0, VKD3D_CONFIG=pipeline_library_log; fresh Wine process per run. The DXIL hashes matched across all runs, and each cold/restore pair had eight unchanged blob hashes. Time is whole command wall time. Memory is the peak charge of the Linux cgroup for the command and its workers (8 GiB cap, no swap).

RTX 5070 Ti 16 GB, NVIDIA Linux driver 620.73.04, Ryzen 7 9700X, CachyOS x86-64 7.3.5-2-cachyos, Wine 11.22, vkd3d-proton ec20719452e916b with dxil-spirv 7c04863, Windows DXC 1.9.2609.5, Windows MSVC release cross-build. These results cover the eight-record offline batch.

AI use — Codex (GPT-6 family, exact variant unavailable) built the PR, ran the tests, checked the logs and hashes, and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7139231120 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7139231120). Originally posted by [vitor127wt](https://github.com/vitor127wt) on 2026-11-24T17:27:47Z. --- **A9 (nv-linux) — Offline PSO parallelism on the RTX 5070 Ti** I tested clean head `c65e2c8b459dd4ac45ff427b3e89abbb5ef707df` under Wine with eight isolated Series 1.0.2.1 compute records (127,416–251,140 B of DXIL apiece). All modes used the same precompiled DXIL, four memory windows and split wave64. The benchmark ran twice, with the cold-mode order reversed in the second round. | Mode | Cold wall time | Cold peak cgroup memory | Blob-only restore wall time | Vulkan reuse on restore | |---|---:|---:|---:|---:| | 1 process × 1 PSO thread | 20.28–20.61 s | 0.92–1.03 GiB | 1.04–1.06 s | 8/8 in both rounds | | 1 process × 4 PSO threads | **8.19–8.23 s** | 0.94–0.98 GiB | 5.15–5.44 s | 5/8 and 6/8 | | 4 processes × 1 PSO thread each | 9.23–9.36 s | 1.70–1.73 GiB | 2.20–2.21 s | 8/8 in both rounds | All runs made eight pipelines, zero refused. The four-process runs showed four shards and two pipelines made per shard. The cold runs reported zero XCL driver cache hits. The restore runs reported eight hits and retrieved all eight SPIR-V modules from their blobs. With four threads, Vulkan feedback still recorded three recompilations in the first restore and two in the second. I crossed the caches in both directions (serial build → four-thread restore and four-thread build → serial restore). All four crossed runs recorded six Vulkan hits and two recompilations, with eight XCL hits. I ran `xcl shaders <eight records> --precompile --only cs --windows 4 --split 1 --pipelines`, adding `--processes 4` for the last row. I set `XCL_PIPELINE_THREADS` to 1, 4, and 1 respectively, and kept `XCL_DXC_THREADS=2`. Each cold run started with an empty XCL `driver` subdirectory and a copy of the same DXIL cache. Each restore kept that run’s XCL blobs. `XCL_PSO_DISK_CACHE=1`, `VKD3D_SHADER_CACHE_PATH=0`, `__GL_SHADER_DISK_CACHE=0`, `VKD3D_CONFIG=pipeline_library_log`; fresh Wine process per run. The DXIL hashes matched across all runs, and each cold/restore pair had eight unchanged blob hashes. Time is whole command wall time. Memory is the peak charge of the Linux cgroup for the command and its workers (8 GiB cap, no swap). RTX 5070 Ti 16 GB, NVIDIA Linux driver 620.73.04, Ryzen 7 9700X, CachyOS x86-64 `7.3.5-2-cachyos`, Wine 11.22, vkd3d-proton `ec20719452e916b` with dxil-spirv `7c04863`, Windows DXC `1.9.2609.5`, Windows MSVC release cross-build. These results cover the eight-record offline batch. **AI use** — Codex (GPT-6 family, exact variant unavailable) built the PR, ran the tests, checked the logs and hashes, and drafted this report.
DavidM1911 commented 2026-11-24 19:07:48 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T18:54:17Z.


Verification on RTX 3060 Ti (Windows 11): merge conflict with current main in crates/xcl/src/shaders.rs — needs a rebase before it can be tested.

<!-- greyfinch-sync:ivall/xcl:comment:7141315134 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7141315134). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-24T18:54:17Z. --- Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** in `crates/xcl/src/shaders.rs` — needs a rebase before it can be tested.
kole07139 commented 2026-11-25 10:10:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by kole07139 on 2026-11-25T10:04:34Z.


A full-pack driver pass with --processes, RTX 3070 8 GB / 32 GB RAM: the per-process limits add up across the children, and on 32 GB that ends the pass early. With 3 processes and the three pipelines over 4 MB of DXIL left out, it finishes: 2 686 pipelines in 179 min, 9.6 GB peak.

The goal was the AOT recipe for #1269: precompile every compute pipeline of the retail pack, then run the title on those caches. This comment is about one thing #1502 changes: how much memory the precompile takes when it runs as several processes.

Setup

  • RTX 3070 8 GB (driver 617.42, 32-lane waves, split wave64), i9-9900K, 32 GB RAM, Windows 11 Pro N 26200, DXC 1.8.2502.11, release.
  • Local tree (not main): main 6c89285 + #1448 b370923 (on #1316) + #1660 17285b3 + this PR c65e2c8.
    • The merge conflict with #680's heap-window key was resolved by hand: both the --shard argument and the key kept.
  • Retail shaders.rpf: 26 503 records, 2 689 compute programs.
  • DXC pass, one process: xcl shaders <pack> --precompile --only cs.
    • 2 689 compiled, 0 errors, 53 min, 5.2 GB peak.
  • Driver passes, all on the cache the DXC pass left, so they only run CreateComputePipelineState: xcl shaders <pack> --precompile --only cs --pipelines --processes N.
  • Commit is the private bytes of the parent plus all its children, sampled every ~5 s. My harness stopped a pass when the system's free commit (Win32_OperatingSystem.FreeVirtualMemory) fell under 2 GB.
driver pass children × XCL_PIPELINE_THREADS end time peak commit lowest free commit
6 processes 6 × 2 stopped at the 2 GB floor 4.7 min 15.5 GB 1.9 GB
3 processes 3 × 2 stopped at the 2 GB floor 52.5 min 17.4 GB 1.3 GB
3 processes, pipelines over 4 MB of DXIL skipped ¹ 3 × 2 finished: 895 + 896 + 895 made, 0 refused, 3 skipped 179 min 9.6 GB 9.0 GB

¹ A local patch, not for upstream: an env var makes Pipelines::make return before the build when the DXIL is over N MB. It skipped three pipelines of 5 611 564, 5 780 072 and 5 974 868 B of DXIL.

  • main now has the same idea as XCL_PIPELINE_MAX_KB (from #1774), with an 8 MiB default.

  • These three are under that default. On this machine, with 3 processes, the pass that finished needed the equivalent of XCL_PIPELINE_MAX_KB=4096.

  • In the 3-process pass that stopped, commit went from 7.4 to 12.0 GB in 10 s at 2 938 s, then climbed to the floor.

  • I do not log the time or memory of each pipeline, so the table shows only that skipping those three let the pass finish. It does not show that they caused the rise.

  • @einfachama's single-process pipelines pass (7149418411, 4 pipeline threads) lists the three largest compute programs at 5.0–5.3 MB and peaked at 13.1 GB. That is consistent with a few multi-MB programs in the driver at once filling a 32 GB machine.

Code reading (c65e2c8, and #1660 at c4a169e)

  • Each child is its own xcl shaders … --shard k/N.
    • It gets 2 pipeline threads.
    • Pipelines::running / most count driver builds within the process only.
    • The DXC limits are also per process: #1660's ENORMOUS_ONE_AT_A_TIME is a process static, and so is wait_for_memory's WORKING count.
  • So N processes allow:
    • 2 × N driver builds at once, with no check of the system's free commit before a build;
    • N enormous DXC compiles at once.
  • wait_for_memory does read the system's ullAvailPageFile, but each process adds only its own compiles to what it needs.
  • What I am not sure of: whether the parent should share one limit with its children, for example a named semaphore, or check free commit before each driver build. That is the author's call.
  • A smaller option, after the rebase: the children leave the programs over a few MB to a final pass in the parent alone. #1279 already orders them last.
  • #2057's XCL_PRECOMPILE_SLICE=i/n runs into the same per-process limit. It ran with 24 processes on a 128 GB machine.

Not tested

  • This PR alone on main, or rebased (@DavidM1911 reports a conflict with current main).
  • The direct DXIL backend.
  • #1982's --used-only.
  • AMD; Linux / Wine.
  • Repeat runs (one per row).
  • Per-pipeline memory.

AI use: Claude Code (Claude Opus 5.5) ran the passes, read the code and wrote this comment. I checked each point before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7159188783 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7159188783). Originally posted by [kole07139](https://github.com/kole07139) on 2026-11-25T10:04:34Z. --- **A full-pack driver pass with `--processes`, RTX 3070 8 GB / 32 GB RAM: the per-process limits add up across the children, and on 32 GB that ends the pass early. With 3 processes and the three pipelines over 4 MB of DXIL left out, it finishes: 2 686 pipelines in 179 min, 9.6 GB peak.** The goal was the AOT recipe for #1269: precompile every compute pipeline of the retail pack, then run the title on those caches. This comment is about one thing #1502 changes: how much memory the precompile takes when it runs as several processes. **Setup** - RTX 3070 8 GB (driver 617.42, 32-lane waves, split wave64), i9-9900K, 32 GB RAM, Windows 11 Pro N 26200, DXC 1.8.2502.11, release. - Local tree (not `main`): `main` `6c89285` + #1448 `b370923` (on #1316) + #1660 `17285b3` + this PR `c65e2c8`. - The merge conflict with #680's heap-window key was resolved by hand: both the `--shard` argument and the key kept. - Retail `shaders.rpf`: 26 503 records, 2 689 compute programs. - **DXC pass**, one process: `xcl shaders <pack> --precompile --only cs`. - 2 689 compiled, 0 errors, 53 min, 5.2 GB peak. - **Driver passes**, all on the cache the DXC pass left, so they only run `CreateComputePipelineState`: `xcl shaders <pack> --precompile --only cs --pipelines --processes N`. - Commit is the private bytes of the parent plus all its children, sampled every ~5 s. My harness stopped a pass when the system's free commit (`Win32_OperatingSystem.FreeVirtualMemory`) fell under 2 GB. | driver pass | children × `XCL_PIPELINE_THREADS` | end | time | peak commit | lowest free commit | |---|---|---|---|---|---| | 6 processes | 6 × 2 | stopped at the 2 GB floor | 4.7 min | 15.5 GB | 1.9 GB | | 3 processes | 3 × 2 | stopped at the 2 GB floor | 52.5 min | 17.4 GB | 1.3 GB | | 3 processes, pipelines over 4 MB of DXIL skipped ¹ | 3 × 2 | **finished**: 895 + 896 + 895 made, 0 refused, 3 skipped | 179 min | 9.6 GB | 9.0 GB | ¹ A local patch, not for upstream: an env var makes `Pipelines::make` return before the build when the DXIL is over N MB. It skipped three pipelines of 5 611 564, 5 780 072 and 5 974 868 B of DXIL. - `main` now has the same idea as `XCL_PIPELINE_MAX_KB` (from #1774), with an 8 MiB default. - These three are under that default. On this machine, with 3 processes, the pass that finished needed the equivalent of `XCL_PIPELINE_MAX_KB=4096`. - In the 3-process pass that stopped, commit went from 7.4 to 12.0 GB in 10 s at 2 938 s, then climbed to the floor. - I do not log the time or memory of each pipeline, so the table shows only that skipping those three let the pass finish. It does not show that they caused the rise. - @einfachama's single-process pipelines pass ([7149418411](https://github.com/xcl-dev/xcl/issues/1269#issuecomment-7149418411), 4 pipeline threads) lists the three largest compute programs at 5.0–5.3 MB and peaked at 13.1 GB. That is consistent with a few multi-MB programs in the driver at once filling a 32 GB machine. **Code reading** (`c65e2c8`, and #1660 at `c4a169e`) - Each child is its own `xcl shaders … --shard k/N`. - It gets 2 pipeline threads. - `Pipelines::running` / `most` count driver builds within the process only. - The DXC limits are also per process: #1660's `ENORMOUS_ONE_AT_A_TIME` is a process `static`, and so is `wait_for_memory`'s `WORKING` count. - So N processes allow: - 2 × N driver builds at once, with no check of the system's free commit before a build; - N enormous DXC compiles at once. - `wait_for_memory` does read the system's `ullAvailPageFile`, but each process adds only its own compiles to what it needs. - What I am not sure of: whether the parent should share one limit with its children, for example a named semaphore, or check free commit before each driver build. That is the author's call. - A smaller option, after the rebase: the children leave the programs over a few MB to a final pass in the parent alone. #1279 already orders them last. - #2057's `XCL_PRECOMPILE_SLICE=i/n` runs into the same per-process limit. It ran with 24 processes on a 128 GB machine. **Not tested** - This PR alone on `main`, or rebased (@DavidM1911 reports a conflict with current `main`). - The direct DXIL backend. - #1982's `--used-only`. - AMD; Linux / Wine. - Repeat runs (one per row). - Per-pipeline memory. **AI use:** Claude Code (Claude Opus 5.5) ran the passes, read the code and wrote this comment. I checked each point before posting.
St5sz2Jk commented 2026-11-25 17:07:27 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by St5sz2Jk on 2026-11-25T16:41:55Z.


#1502 rebased onto main, tested on AMD / Linux / Wine: 4 processes, the DXIL pass only

Rebase: St5sz2Jk/xcl pr1502-rebase, commit bf50b13, on main 12f25f1. It also applies cleanly on 55d64c2.

  • The conflicts @DavidM1911 reported were in shaders.rs and README.md. I kept both sides:
    • precompile takes used (--used-only) and then shard.
    • The start line keeps main's windows / heap fields and adds the shard note.
    • parse_shard, shard_args and precompile_in_processes go after measure_pso_result.
    • The README's --processes note stays under the --pipelines line.
  • cargo test -p xcl --lib shaders:: under Wine: 10 passed, including shards_split_the_records_and_drop_processes.
  • @tycosnh: take the branch as it is, or redo the rebase yourself, whichever you prefer.

Machine: RX 9070 XT 16 GB (RDNA4), Ryzen 9 5950X (32 threads), 125 GB RAM, Mesa 26.3.1 RADV, Wine 11.22, vkd3d-proton.

  • Run: XCL_HEAP_WINDOWS=1, --precompile --only cs --processes 4 on the retail title's pack.
  • No --pipelines.
  • Each run started from an empty XCL_DXIL_CACHE.
run DXC threads per process records per process errors first / last process done peak system memory used
default split 7 (compile_threads() 31 / 4) 671–673 0 2 090 s / 2 625 s 24.4 GB
XCL_DXC_THREADS=2 2 671–673 0 1 877 s / 2 112 s 17.1 GB
  • Both runs wrote the same 2 675 cache files.
  • Each process's first 22 600 of 26 503 records took about 95 s. Almost all the remaining time went to the last ~3 900, which include the 12–30 MB programs. Several of those went to direct DXIL.
  • One run per row.

What it means under Wine

  • With fewer threads in each process, the pass was 20 % faster and used 7 GB less.
  • That matches #2127: DXC threads in one process contend with each other under Wine. There, 4 threads in one process did better than 31.
  • With #2127, compile_threads() is 4 under Wine, so this PR's split gives 1 thread per process. I have not run that combination.

A small thing in precompile_in_processes: with XCL_DXC_THREADS set, the parent prints its own split, while the children get the variable unchanged.

  • Here the parent printed precompiling in 4 processes (1 DXC threads each), but each child reported 2 compile threads, as set.
  • Printing the variable's value when it is set would fix it.

Not tested

  • --pipelines (the driver-memory question @kole07139 raised).
  • Windows.
  • A single-process baseline on this build. My earlier single-process run on an older build, with 24 DXC threads, kept the CPU near idle for hours; that is the #2127 data.

AI use: Claude Code (Claude Opus 5.5) did the rebase, ran the passes and wrote this comment. My human API started the session and approved the runs.

<!-- greyfinch-sync:ivall/xcl:comment:7168393144 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7168393144). Originally posted by [St5sz2Jk](https://github.com/St5sz2Jk) on 2026-11-25T16:41:55Z. --- **#1502 rebased onto `main`, tested on AMD / Linux / Wine: 4 processes, the DXIL pass only** **Rebase:** [St5sz2Jk/xcl `pr1502-rebase`](https://github.com/St5sz2Jk/xcl/tree/pr1502-rebase), commit [`bf50b13`](https://github.com/St5sz2Jk/xcl/commit/bf50b13), on `main` `12f25f1`. It also applies cleanly on `55d64c2`. - The conflicts @DavidM1911 reported were in `shaders.rs` and `README.md`. I kept both sides: - `precompile` takes `used` (`--used-only`) and then `shard`. - The start line keeps `main`'s windows / heap fields and adds the shard note. - `parse_shard`, `shard_args` and `precompile_in_processes` go after `measure_pso_result`. - The README's `--processes` note stays under the `--pipelines` line. - `cargo test -p xcl --lib shaders::` under Wine: 10 passed, including `shards_split_the_records_and_drop_processes`. - @tycosnh: take the branch as it is, or redo the rebase yourself, whichever you prefer. **Machine:** RX 9070 XT 16 GB (RDNA4), Ryzen 9 5950X (32 threads), 125 GB RAM, Mesa 26.3.1 RADV, Wine 11.22, vkd3d-proton. - Run: `XCL_HEAP_WINDOWS=1`, `--precompile --only cs --processes 4` on the retail title's pack. - No `--pipelines`. - Each run started from an empty `XCL_DXIL_CACHE`. | run | DXC threads per process | records per process | errors | first / last process done | peak system memory used | |---|---|---|---|---|---| | default split | 7 (`compile_threads()` 31 / 4) | 671–673 | 0 | 2 090 s / **2 625 s** | 24.4 GB | | `XCL_DXC_THREADS=2` | 2 | 671–673 | 0 | 1 877 s / **2 112 s** | 17.1 GB | - Both runs wrote the same 2 675 cache files. - Each process's first 22 600 of 26 503 records took about 95 s. Almost all the remaining time went to the last ~3 900, which include the 12–30 MB programs. Several of those went to direct DXIL. - One run per row. **What it means under Wine** - With fewer threads in each process, the pass was 20 % faster and used 7 GB less. - That matches #2127: DXC threads in one process contend with each other under Wine. There, 4 threads in one process did better than 31. - With #2127, `compile_threads()` is 4 under Wine, so this PR's split gives 1 thread per process. I have not run that combination. **A small thing in `precompile_in_processes`:** with `XCL_DXC_THREADS` set, the parent prints its own split, while the children get the variable unchanged. - Here the parent printed `precompiling in 4 processes (1 DXC threads each)`, but each child reported 2 compile threads, as set. - Printing the variable's value when it is set would fix it. **Not tested** - `--pipelines` (the driver-memory question @kole07139 raised). - Windows. - A single-process baseline on this build. My earlier single-process run on an older build, with 24 DXC threads, kept the CPU near idle for hours; that is the #2127 data. **AI use:** Claude Code (Claude Opus 5.5) did the rebase, ran the passes and wrote this comment. My human API started the session and approved the runs.
throny commented 2026-11-25 20:06:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-25T20:06:49Z.


@tycosnh this PR conflicts with main, so we rebased it for you, in case it saves you the work: branch throny:pr1502-rebased, one commit 031bbab on main 6d051da. Your commit is kept as it was (author, message and trailers); only the conflicts are resolved. To take it: git fetch another project's repository pr1502-rebased && git reset --hard FETCH_HEAD, then force-push.

What changed in the rebase

  • shaders.rs: main now parses the options into ShadersOptions (crate::cli::Parser, which refuses unknown options), so --shard and --processes are two fields parsed there. The check that starts the children reads opts.processes / opts.shard / opts.precompile. parse_shard, shard_args, precompile_in_processes, the shard filter in the loop and your unit test are unchanged.
  • README.md, gpu_compute_e2e.rs: kept main's new lines and test; yours added next to them.

Tested on 031bbab, RTX 4080 (610.88), i9-12900K, Windows 11 Pro 26300, Rust 1.100.0, debug:

  • cargo test --workspace --no-fail-fast -- --test-threads=4: 1419 passed, 0 failed, 46 ignored (26 SKIPPED lines: wave64 and the like).
  • offline_compute_pipelines_split_over_processes: passed. shards_split_the_records_and_drop_processes: passed.
  • A first run had kernelx::tests::fine_timer_makes_short_sleeps_short fail (Sleep(1) took 8.46 ms) while the machine was fully loaded by a precompile; it passed in the second run. This PR doesn't touch it.

In use: we run the same change, ported onto an older base, on the retail title's full precompile (all 26,503 shaders) right now. Your diagnosis holds here too: one process with 24–36 DXC threads kept only 6–14 cores busy and got about 1–4 shaders a second, and --processes 4 keeps the whole CPU busy. Timings (all 26,503 shaders of the title, --precompile --pipelines, shared cache):

  • one process, 24–36 DXC threads: 6–14 cores busy, about 1.2–4 shaders a second;
  • --processes 4 (9 DXC threads each): the whole CPU busy, 13,951 shaders compiled in 1,936 s, about 7.2 a second, 0 errors, 2,689 compute pipelines all loaded from the driver cache.
    The two ran side by side on the same cache for part of the time, so this is a rough comparison, not an A/B; still roughly 2–5× here, as on your 4090.

Not in it: --processes / --shard aren't in the xcl --help text in main.rs, which now lists the other --precompile options; you may want a line there.

AI use: Claude Code (Claude Fable 5.2 did the rebase, Claude Opus 5.5 reviewed it, ran the tests and wrote this).

<!-- greyfinch-sync:ivall/xcl:comment:7173208154 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7173208154). Originally posted by [throny](https://github.com/throny) on 2026-11-25T20:06:49Z. --- @tycosnh this PR conflicts with `main`, so we rebased it for you, in case it saves you the work: branch `throny:pr1502-rebased`, one commit `031bbab` on `main` `6d051da`. Your commit is kept as it was (author, message and trailers); only the conflicts are resolved. To take it: `git fetch another project's repository pr1502-rebased && git reset --hard FETCH_HEAD`, then force-push. **What changed in the rebase** - `shaders.rs`: `main` now parses the options into `ShadersOptions` (`crate::cli::Parser`, which refuses unknown options), so `--shard` and `--processes` are two fields parsed there. The check that starts the children reads `opts.processes` / `opts.shard` / `opts.precompile`. `parse_shard`, `shard_args`, `precompile_in_processes`, the shard filter in the loop and your unit test are unchanged. - `README.md`, `gpu_compute_e2e.rs`: kept `main`'s new lines and test; yours added next to them. **Tested** on `031bbab`, RTX 4080 (610.88), i9-12900K, Windows 11 Pro 26300, Rust 1.100.0, debug: - `cargo test --workspace --no-fail-fast -- --test-threads=4`: 1419 passed, 0 failed, 46 ignored (26 `SKIPPED` lines: wave64 and the like). - `offline_compute_pipelines_split_over_processes`: passed. `shards_split_the_records_and_drop_processes`: passed. - A first run had `kernelx::tests::fine_timer_makes_short_sleeps_short` fail (`Sleep(1)` took 8.46 ms) while the machine was fully loaded by a precompile; it passed in the second run. This PR doesn't touch it. **In use:** we run the same change, ported onto an older base, on the retail title's full precompile (all 26,503 shaders) right now. Your diagnosis holds here too: one process with 24–36 DXC threads kept only 6–14 cores busy and got about 1–4 shaders a second, and `--processes 4` keeps the whole CPU busy. Timings (all 26,503 shaders of the title, `--precompile --pipelines`, shared cache): - one process, 24–36 DXC threads: 6–14 cores busy, about 1.2–4 shaders a second; - `--processes 4` (9 DXC threads each): the whole CPU busy, **13,951 shaders compiled in 1,936 s, about 7.2 a second**, 0 errors, 2,689 compute pipelines all loaded from the driver cache. The two ran side by side on the same cache for part of the time, so this is a rough comparison, not an A/B; still roughly 2–5× here, as on your 4090. Not in it: `--processes` / `--shard` aren't in the `xcl --help` text in `main.rs`, which now lists the other `--precompile` options; you may want a line there. AI use: Claude Code (Claude Fable 5.2 did the rebase, Claude Opus 5.5 reviewed it, ran the tests and wrote this).
bmjask commented 2026-11-25 21:22:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-25T21:22:10Z.

Review: COMMENTED


P1 resource-limit bypass: --processes N creates independent process-local DXC/PSO limits. Each child can run two expensive builds and an enormous DXC compile, so N processes permit ~2N driver compiles with no shared commit budget. Reports on 32 GB show 6x2/3x2 runs hit the 2 GB-free safety floor after 15.5-17.4 GB added commit. Add cross-process semaphore/global budget or serialize final large-pipeline pass. This dirty/non-mergeable PR also reports a suite failure; inherited XCL_DXC_THREADS makes parent diagnostics misleading.

<!-- greyfinch-sync:ivall/xcl:review:6065159125 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#pullrequestreview-6065159125). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-25T21:22:10Z. **Review:** COMMENTED --- P1 resource-limit bypass: --processes N creates independent process-local DXC/PSO limits. Each child can run two expensive builds and an enormous DXC compile, so N processes permit ~2N driver compiles with no shared commit budget. Reports on 32 GB show 6x2/3x2 runs hit the 2 GB-free safety floor after 15.5-17.4 GB added commit. Add cross-process semaphore/global budget or serialize final large-pipeline pass. This dirty/non-mergeable PR also reports a suite failure; inherited XCL_DXC_THREADS makes parent diagnostics misleading.
bmjask commented 2026-11-29 14:50:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by bmjask on 2026-11-29T14:50:09Z.


Current-main audit (2026-11-29): close as stale/superseded; do not rebase this implementation wholesale.

The concept is valid and cache-key safe, but current main now has XCL_PRECOMPILE_SLICE, multi-process preparation workers, cross-process DXIL-cache locking, bounded preparation, and pipeline-library publication. This old diff conflicts with that architecture. Existing testing on this PR also showed the important failure mode: each child applies its own memory/concurrency allowance, so aggregate commit can end the pass early on 32 GB systems.

If a public standalone --processes N convenience is still desired, it should be a new small PR over current main that reuses the existing slice/worker orchestration and enforces one parent-wide commit budget. The old modulo sharding implementation should not be merged.

Cache impact of the scheduling idea: safe; no PSO identity change. Disposition of this PR: discard/close.

Review assisted by Codex; exact model name was not exposed in this session. No full preparation was run.

<!-- greyfinch-sync:ivall/xcl:comment:7257613495 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7257613495). Originally posted by [bmjask](https://github.com/bmjask) on 2026-11-29T14:50:09Z. --- **Current-main audit (2026-11-29): close as stale/superseded; do not rebase this implementation wholesale.** The concept is valid and cache-key safe, but current `main` now has `XCL_PRECOMPILE_SLICE`, multi-process preparation workers, cross-process DXIL-cache locking, bounded preparation, and pipeline-library publication. This old diff conflicts with that architecture. Existing testing on this PR also showed the important failure mode: each child applies its own memory/concurrency allowance, so aggregate commit can end the pass early on 32 GB systems. If a public standalone `--processes N` convenience is still desired, it should be a new small PR over current `main` that reuses the existing slice/worker orchestration and enforces one parent-wide commit budget. The old modulo sharding implementation should not be merged. Cache impact of the scheduling idea: safe; no PSO identity change. Disposition of this PR: discard/close. Review assisted by Codex; exact model name was not exposed in this session. No full preparation was run.
Foniass commented 2026-12-01 05:56:46 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:56:46Z.


Triage (#1607) – head c65e2c8

Main now has the per-process slicing this builds on: XCL_PRECOMPILE_SLICE=i/n / precompile_slice (commit 5ea55e2c), and xcl run already spreads compute pipelines over worker processes (pipelines_in_workers, 88bc67da). --shard k/n duplicates that slice option; what main still lacks is xcl shaders --precompile --processes N from the command line.
A rebase should reuse precompile_slice / worker_command rather than add a second sharding path. The PR is a draft and conflicts with main.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7302307534 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/1502#issuecomment-7302307534). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T05:56:46Z. --- **Triage (#1607)** – head c65e2c8 Main now has the per-process slicing this builds on: `XCL_PRECOMPILE_SLICE=i/n` / `precompile_slice` (commit 5ea55e2c), and `xcl run` already spreads compute pipelines over worker processes (`pipelines_in_workers`, 88bc67da). `--shard k/n` duplicates that slice option; what main still lacks is `xcl shaders --precompile --processes N` from the command line. A rebase should reuse `precompile_slice` / `worker_command` rather than add a second sharding path. The PR is a draft and conflicts with main. Recommendation: keep open. AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1502:upstream-pr/1502'
git switch 'upstream-pr/1502'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1502'
git switch 'upstream-pr/1502'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1502'
git switch 'upstream-pr/1502'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1502'
git switch 'main'
git merge --squash 'upstream-pr/1502'
git switch 'main'
git merge --ff-only 'upstream-pr/1502'
git switch 'main'
git merge 'upstream-pr/1502'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!1492
No description provided.