xcl run: preparation workers count the commit left in MiB, not bytes #3085

Merged
Royalflamejlh merged 1 commit from upstream-pr/3085 into main 2026-11-28 03:18:17 +00:00
Royalflamejlh commented 2026-11-28 02:42:33 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-11-28T02:42:33Z.


Port of #2705 to main: the same commit, cherry-picked unchanged (pr1sm-dev's, merged into nvidia-dev on 2026-11-28). main has the same prepare_workers and the same bug; when #2572 brings nvidia-dev into main, this is the same change.

prepare_workers passes host::system_commit(), which is in bytes (commit pages times the page size), to workers_for(cores, free_mb), which divides by 3072 as MiB. So the memory bound never applies and the count is always the logical processors less four. On a 32-thread machine under Wine that is 28 workers: the launch pass of main 753e8b1a (on our Linux branch, which merges it) went over 34 GB and was stopped by our run harness at 131 s, before the title started (1 run). The same pass with XCL_PREPARE_WORKERS=8 stayed at about 22 GB.

What is in it

  • crates/xcl/src/shaders.rs: workers_for_commit converts the commit figures to MiB before workers_for; a test passes them in bytes (12 workers without the conversion, 2 with it).

Tested

  • Linux, Wine 11.21 Staging, Mesa lavapipe (no GPU), Rust 1.98.0, release, x86_64-pc-windows-gnu: cargo test -p xcl --lib workers -- --test-threads=4: 6 passed, 0 failed, 0 ignored (1404 filtered out), among them preparation_workers_take_the_commit_left_in_bytes
  • A launch with this change, on linux/stack with #3085 and #3086 merged (1 launch): the pass picked 25 workers here, against 28 without it. The bound now applies, but under Wine the commit limit includes swap (121,298 MB with 55 GB of swap on this 62 GB machine), so 25 still does not fit; we stopped it and set XCL_PREPARE_WORKERS=8.
  • The title: the two runs above (RTX 4060 Ti, Ryzen 9 9950X3D, 62 GB), both without this change; the second with the count set by hand.

Regression run

  • not made: scripts/smoke.ps1 needs Windows (see Not tested).

Not tested

  • Windows; the whole suite; scripts/smoke.ps1 on main and on this head.

AI use

  • The commit is #2705's, unchanged (its trailer names Claude Opus 5.5). Claude Code (Claude Opus 5.5) cherry-picked it, ran the tests and wrote this description.
<!-- greyfinch-sync:ivall/xcl:issue:5535905533 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3085). Originally posted by [Royalflamejlh](https://github.com/Royalflamejlh) on 2026-11-28T02:42:33Z. --- Port of #2705 to `main`: the same commit, cherry-picked unchanged (pr1sm-dev's, merged into `nvidia-dev` on 2026-11-28). `main` has the same `prepare_workers` and the same bug; when #2572 brings `nvidia-dev` into `main`, this is the same change. `prepare_workers` passes `host::system_commit()`, which is in bytes (commit pages times the page size), to `workers_for(cores, free_mb)`, which divides by 3072 as MiB. So the memory bound never applies and the count is always the logical processors less four. On a 32-thread machine under Wine that is 28 workers: the launch pass of `main` `753e8b1a` (on our Linux branch, which merges it) went over 34 GB and was stopped by our run harness at 131 s, before the title started (1 run). The same pass with `XCL_PREPARE_WORKERS=8` stayed at about 22 GB. **What is in it** - `crates/xcl/src/shaders.rs`: `workers_for_commit` converts the commit figures to MiB before `workers_for`; a test passes them in bytes (12 workers without the conversion, 2 with it). **Tested** - Linux, Wine 11.21 Staging, Mesa lavapipe (no GPU), Rust 1.98.0, release, `x86_64-pc-windows-gnu`: `cargo test -p xcl --lib workers -- --test-threads=4`: 6 passed, 0 failed, 0 ignored (1404 filtered out), among them `preparation_workers_take_the_commit_left_in_bytes` - A launch with this change, on `linux/stack` with #3085 and #3086 merged (1 launch): the pass picked 25 workers here, against 28 without it. The bound now applies, but under Wine the commit limit includes swap (121,298 MB with 55 GB of swap on this 62 GB machine), so 25 still does not fit; we stopped it and set `XCL_PREPARE_WORKERS=8`. - The title: the two runs above (RTX 4060 Ti, Ryzen 9 9950X3D, 62 GB), both without this change; the second with the count set by hand. **Regression run** - not made: `scripts/smoke.ps1` needs Windows (see Not tested). **Not tested** - Windows; the whole suite; `scripts/smoke.ps1` on `main` and on this head. **AI use** - The commit is #2705's, unchanged (its trailer names Claude Opus 5.5). Claude Code (Claude Opus 5.5) cherry-picked it, ran the tests and wrote this description.
ZekkJJ commented 2026-11-28 03:00:40 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ZekkJJ on 2026-11-28T03:00:40Z.


The unit conversion fix makes sense and restores the intended memory-based worker limit.

One remaining concern is that available system commit can substantially exceed available physical RAM, particularly on systems with large pagefiles or swap. The reported 25-worker selection after the fix demonstrates that limitation.

Physical-memory-aware worker admission would be worth investigating separately, but I wouldn’t consider it a blocker for this PR.

Good catch.

<!-- greyfinch-sync:ivall/xcl:comment:7232734889 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3085#issuecomment-7232734889). Originally posted by [ZekkJJ](https://github.com/ZekkJJ) on 2026-11-28T03:00:40Z. --- The unit conversion fix makes sense and restores the intended memory-based worker limit. One remaining concern is that available system commit can substantially exceed available physical RAM, particularly on systems with large pagefiles or swap. The reported 25-worker selection after the fix demonstrates that limitation. Physical-memory-aware worker admission would be worth investigating separately, but I wouldn’t consider it a blocker for this PR. Good catch.
fromthemoonx commented 2026-11-28 03:08:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by fromthemoonx on 2026-11-28T03:08:10Z.


Windows run (listed under Not tested): the whole suite passes, the new test fails without the >> 20, and on this machine the pass now picks 3 workers instead of 12.

Tested: 651867a (its base is current main 753e8b1, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X (16 threads), 16 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug.

result
cargo test --workspace --no-fail-fast -- --test-threads=4 1513 passed, 0 failed, 47 ignored; 25 SKIPPED lines (no wave64, refused per-lane f16/f32 forms, heap_window_out_of_memory_falls_back_to_the_switch_form)
preparation_workers_take_the_commit_left_in_bytes alone 3 of 3
the same with the >> 20 removed (scratch) fails: left: 12, right: 2
scratch print of host::system_commit() on this machine, both formulas 15202 MiB used, 24505 MiB limit, 9303 MiB left: main's formula gives 12 workers, this PR's gives 3

So on Windows the bound applies now too.

Not tested: a launch or scripts/smoke.ps1 with this change (no title here), a release build.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the scratch checks and wrote this report.

<!-- greyfinch-sync:ivall/xcl:comment:7232818932 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3085#issuecomment-7232818932). Originally posted by [fromthemoonx](https://github.com/fromthemoonx) on 2026-11-28T03:08:10Z. --- **Windows run (listed under Not tested): the whole suite passes, the new test fails without the `>> 20`, and on this machine the pass now picks 3 workers instead of 12.** **Tested:** `651867a` (its base is current `main` `753e8b1`, so head = merged). RTX 3060 12 GB (driver 610.88), Ryzen 7 5700X (16 threads), 16 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 MSVC, debug. | | result | |---|---| | `cargo test --workspace --no-fail-fast -- --test-threads=4` | 1513 passed, 0 failed, 47 ignored; 25 `SKIPPED` lines (no wave64, refused per-lane f16/f32 forms, `heap_window_out_of_memory_falls_back_to_the_switch_form`) | | `preparation_workers_take_the_commit_left_in_bytes` alone | 3 of 3 | | the same with the `>> 20` removed (scratch) | fails: `left: 12, right: 2` | | scratch print of `host::system_commit()` on this machine, both formulas | 15202 MiB used, 24505 MiB limit, 9303 MiB left: `main`'s formula gives 12 workers, this PR's gives 3 | So on Windows the bound applies now too. **Not tested:** a launch or `scripts/smoke.ps1` with this change (no title here), a release build. **AI use:** Claude Code (Claude Opus 5.5) ran the tests and the scratch checks and wrote this report.
SlopTart commented 2026-11-28 03:21:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by SlopTart on 2026-11-28T03:21:05Z.


Ran the new worker-count tests on both Linux/Wine lanes at head 651867a4 (only shaders.rs changes):

  • rig1 (Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT, wine 11.0): cargo test -p xcl --lib -- preparation_workers: 2 passed / 0 failed, x3 runs
  • rig2 (i5-10600K, 16 GB DDR4, GTX 1070, wine 10.0): same command: 2 passed / 0 failed, x3 runs

rig2 is the class of machine the MiB-vs-bytes mix-up would hit hardest (commit left reads as enormous, worker count goes absurd), and the corrected computation holds there too.

Relevant to #3077 (precompile never finishing on 32 GB): that OOM at 23,000 programs is a per-program cap question, separate from this units fix; counts from the fix itself are green on both lanes.

Tested: the 2 preparation_workers tests, x3 per lane at 651867a4.
Not tested: a full 26k-program precompile run end to end, native Windows, full suite on this head.
AI use: Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7233002611 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/3085#issuecomment-7233002611). Originally posted by [SlopTart](https://github.com/SlopTart) on 2026-11-28T03:21:05Z. --- Ran the new worker-count tests on both Linux/Wine lanes at head `651867a4` (only `shaders.rs` changes): - rig1 (Ryzen 9 9900X, 96 GB DDR5, RX 7900 XT, wine 11.0): `cargo test -p xcl --lib -- preparation_workers`: **2 passed / 0 failed, x3 runs** - rig2 (i5-10600K, **16 GB DDR4**, GTX 1070, wine 10.0): same command: **2 passed / 0 failed, x3 runs** rig2 is the class of machine the MiB-vs-bytes mix-up would hit hardest (commit left reads as enormous, worker count goes absurd), and the corrected computation holds there too. Relevant to #3077 (precompile never finishing on 32 GB): that OOM at 23,000 programs is a per-program cap question, separate from this units fix; counts from the fix itself are green on both lanes. **Tested:** the 2 `preparation_workers` tests, x3 per lane at `651867a4`. **Not tested:** a full 26k-program precompile run end to end, native Windows, full suite on this head. **AI use:** Hermes agent (local Qwen-class) ran the tests and drafted this; I checked it before posting.
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!3085
No description provided.