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

Merged
pr1sm-dev merged 1 commit from upstream-pr/2705 into nvidia-dev 2026-11-28 00:36:19 +00:00
pr1sm-dev commented 2026-11-26 07:22:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pr1sm-dev on 2026-11-26T07:22:21Z.


prepare_workers passes host::system_commit(), which is in bytes (commit pages times the page size, host.rs:11-22), to workers_for(cores, free_mb), which divides by 3072 as MiB (shaders.rs). So the 3 GB-per-worker bound never applied, and the count was always the logical processors less four (at most 32): 16 threads with 6 GiB of commit left got 12 workers instead of 2. Reported by @pickles976 in https://github.com/xcl-dev/xcl/pull/2624#issuecomment-7182236787; introduced with the worker processes in b09acbc (#2624).

The commit figures are now converted to MiB in a new workers_for_commit, which prepare_workers calls. workers_for and its tests are unchanged; XCL_PREPARE_WORKERS still sets the count directly.

What is in it

  • crates/xcl/src/shaders.rs: workers_for_commit(cores, used, limit) (bytes → MiB, then workers_for), called by prepare_workers; test preparation_workers_take_the_commit_left_in_bytes with the figures in bytes.

Tested

  • RTX 3070 8 GB, NVIDIA 595.91.07 (Linux), Ryzen 7 5800X, 62 GB RAM; Wine 11.22 + vkd3d-proton master 30b0eb9b with #257's patch; Rust 1.100.0, x86_64-pc-windows-gnu, release. Not Windows.
  • cargo test -p xcl --lib shaders::tests (test binary under Wine): 12 passed, 0 failed, 0 ignored. With the conversion taken out, the new test fails (left: 12, right: 2).
  • What K32GetPerformanceInfo gives under Wine here (a small probe calling it as system_commit does): limit 64,209 MiB (the RAM, no swap), 57,580 MiB left, 16 threads: 12 workers both before and after this change. So on this machine the processor bound decides and the change makes no difference; it does on hosts with less than about 3 GB of commit left per worker.

Regression run

  • Made with scripts/linux/smoke.sh of #257 (the Linux port of scripts/smoke.ps1, closed, not merged) under Wine, not with smoke.ps1. A retail title, 120 s, VKD3D_CONFIG=ignore_shared_fence,no_descriptor_heap on all, no input. The nvidia-dev and PR runs had XCL_PREPARE=0, so they do not reach the changed code (see Not tested).

main (made last night for another PR, same setup):

xcl-smoke v1
commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea
gpu: NVIDIA GeForce RTX 3070
title: retail-title
seconds: 120
exit: 0x0
frames shown: 2770 (PresentX 2770)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

nvidia-dev af2cecc (the base):

xcl-smoke v1
commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7
gpu: NVIDIA GeForce RTX 3070
title: retail-title
seconds: 120
exit: 0x0
frames shown: 3018 (PresentX 3018)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB

PR:

xcl-smoke v1
commit: 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8
gpu: NVIDIA GeForce RTX 3070
title: retail-title
seconds: 120
exit: 0x0
frames shown: 3082 (PresentX 3082)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 0 MB
  • One earlier run of af2cecc with the same settings ended at 10 s: an access in Wine's heap_free_block through a corrupted block header on a title thread building compute pipelines (reported as 0xc00000fd). It did not happen in the next two runs (the base and PR blocks above). The preparation code was off in that run; I am looking into it separately.

Not tested

  • Windows, AMD, Intel.
  • The preparation itself with this change (XCL_PREPARE on): the runs above leave it out, and on this machine the worker count is the same before and after.
  • A process or job memory cap that the system commit does not show (Wine reports the host's RAM, not the cgroup limit the runs had); not addressed here.
  • The whole suite: only the shaders::tests filter was run.
  • peak commit is not reported under Wine (0 MB on all).

AI use

  • Claude Code with Claude Opus 5.5: checked the report against the source, wrote the change, the test and this description, ran the tests, the probe and the regression runs on the hardware above, and opens this PR at my instruction.

🤖 Generated with Claude Code

<!-- greyfinch-sync:ivall/xcl:issue:5505768182 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705). Originally posted by [pr1sm-dev](https://github.com/pr1sm-dev) on 2026-11-26T07:22:21Z. --- `prepare_workers` passes `host::system_commit()`, which is in bytes (commit pages times the page size, `host.rs:11-22`), to `workers_for(cores, free_mb)`, which divides by 3072 as MiB (`shaders.rs`). So the 3 GB-per-worker bound never applied, and the count was always the logical processors less four (at most 32): 16 threads with 6 GiB of commit left got 12 workers instead of 2. Reported by @pickles976 in https://github.com/xcl-dev/xcl/pull/2624#issuecomment-7182236787; introduced with the worker processes in `b09acbc` (#2624). The commit figures are now converted to MiB in a new `workers_for_commit`, which `prepare_workers` calls. `workers_for` and its tests are unchanged; `XCL_PREPARE_WORKERS` still sets the count directly. **What is in it** - `crates/xcl/src/shaders.rs`: `workers_for_commit(cores, used, limit)` (bytes → MiB, then `workers_for`), called by `prepare_workers`; test `preparation_workers_take_the_commit_left_in_bytes` with the figures in bytes. **Tested** - RTX 3070 8 GB, NVIDIA 595.91.07 (Linux), Ryzen 7 5800X, 62 GB RAM; Wine 11.22 + vkd3d-proton master `30b0eb9b` with #257's patch; Rust 1.100.0, `x86_64-pc-windows-gnu`, release. Not Windows. - `cargo test -p xcl --lib shaders::tests` (test binary under Wine): 12 passed, 0 failed, 0 ignored. With the conversion taken out, the new test fails (`left: 12, right: 2`). - What `K32GetPerformanceInfo` gives under Wine here (a small probe calling it as `system_commit` does): limit 64,209 MiB (the RAM, no swap), 57,580 MiB left, 16 threads: 12 workers both before and after this change. So on this machine the processor bound decides and the change makes no difference; it does on hosts with less than about 3 GB of commit left per worker. **Regression run** - Made with `scripts/linux/smoke.sh` of #257 (the Linux port of `scripts/smoke.ps1`, closed, not merged) under Wine, not with `smoke.ps1`. A retail title, 120 s, `VKD3D_CONFIG=ignore_shared_fence,no_descriptor_heap` on all, no input. The `nvidia-dev` and PR runs had `XCL_PREPARE=0`, so they do not reach the changed code (see **Not tested**). main (made last night for another PR, same setup): ``` xcl-smoke v1 commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea gpu: NVIDIA GeForce RTX 3070 title: retail-title seconds: 120 exit: 0x0 frames shown: 2770 (PresentX 2770) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` `nvidia-dev` `af2cecc` (the base): ``` xcl-smoke v1 commit: af2cecc40886a8682ecf3267f5328c6dc4b66ad7 gpu: NVIDIA GeForce RTX 3070 title: retail-title seconds: 120 exit: 0x0 frames shown: 3018 (PresentX 3018) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` PR: ``` xcl-smoke v1 commit: 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8 gpu: NVIDIA GeForce RTX 3070 title: retail-title seconds: 120 exit: 0x0 frames shown: 3082 (PresentX 3082) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 0 MB ``` - One earlier run of `af2cecc` with the same settings ended at 10 s: an access in Wine's `heap_free_block` through a corrupted block header on a title thread building compute pipelines (reported as `0xc00000fd`). It did not happen in the next two runs (the base and PR blocks above). The preparation code was off in that run; I am looking into it separately. **Not tested** - Windows, AMD, Intel. - The preparation itself with this change (`XCL_PREPARE` on): the runs above leave it out, and on this machine the worker count is the same before and after. - A process or job memory cap that the system commit does not show (Wine reports the host's RAM, not the cgroup limit the runs had); not addressed here. - The whole suite: only the `shaders::tests` filter was run. - `peak commit` is not reported under Wine (0 MB on all). **AI use** - Claude Code with Claude Opus 5.5: checked the report against the source, wrote the change, the test and this description, ran the tests, the probe and the regression runs on the hardware above, and opens this PR at my instruction. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
luckyteagirl commented 2026-11-26 08:04:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T07:46:55Z.


Windows verification of exact PR head 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8 on its nvidia-dev parent af2cecc40886a8682ecf3267f5328c6dc4b66ad7 (Windows 11 Home build 26200, Ryzen 9 5980HX, RX 6800M driver 30.0.13002.13003, Rust 1.99.0 MSVC):

  • cargo test --locked -p xcl --lib shaders::tests::preparation_workers_take_the_commit_left_in_bytes -j 1 -- --exact --test-threads=1 --nocapture: 1 passed, 0 failed/ignored, 1,648 filtered. This is CPU worker-count arithmetic, not a GPU exercise.
  • cargo test --locked -p xcl --lib shaders::tests -j 1 -- --test-threads=1 --nocapture, with XCL_ADAPTER=6800M: 12 harness passes, 0 failed/ignored, 1,637 filtered. Two of those passes explicitly skipped their intended work: the driver-cache-control case needs Windows Developer Mode, and the retail-pack sample had no XCL_SAMPLE_RPF. Thus 10 tests exercised their bodies.
  • cargo build --locked --release -p xcl -j 1: passed; executable SHA-256 C88C0292136C827923389A1D8E10BE8AE7B5887D0E87A4A6F41B104A969FB2FC.

I tried a guarded preparation-on title launch with isolated data/DXIL caches. I stopped it after about 30 seconds, at 292 of 26,503 shader records translated, before it reached the changed worker-spawn stage or title frames. It is not a completed smoke result. I did not build/run the nvidia-dev parent, run the full workspace suite, or measure the real worker count under low available commit. AI-assisted test report with Codex.

<!-- greyfinch-sync:ivall/xcl:comment:7185828038 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7185828038). Originally posted by [luckyteagirl](https://github.com/luckyteagirl) on 2026-11-26T07:46:55Z. --- Windows verification of exact PR head `231c4f1d06b567d5fece22ab659d1b0ecd21c7f8` on its `nvidia-dev` parent `af2cecc40886a8682ecf3267f5328c6dc4b66ad7` (Windows 11 Home build 26200, Ryzen 9 5980HX, RX 6800M driver `30.0.13002.13003`, Rust 1.99.0 MSVC): - `cargo test --locked -p xcl --lib shaders::tests::preparation_workers_take_the_commit_left_in_bytes -j 1 -- --exact --test-threads=1 --nocapture`: **1 passed, 0 failed/ignored**, 1,648 filtered. This is CPU worker-count arithmetic, not a GPU exercise. - `cargo test --locked -p xcl --lib shaders::tests -j 1 -- --test-threads=1 --nocapture`, with `XCL_ADAPTER=6800M`: **12 harness passes, 0 failed/ignored**, 1,637 filtered. Two of those passes explicitly skipped their intended work: the driver-cache-control case needs Windows Developer Mode, and the retail-pack sample had no `XCL_SAMPLE_RPF`. Thus 10 tests exercised their bodies. - `cargo build --locked --release -p xcl -j 1`: passed; executable SHA-256 `C88C0292136C827923389A1D8E10BE8AE7B5887D0E87A4A6F41B104A969FB2FC`. I tried a guarded preparation-on title launch with isolated data/DXIL caches. I stopped it after about 30 seconds, at 292 of 26,503 shader records translated, before it reached the changed worker-spawn stage or title frames. It is **not** a completed smoke result. I did not build/run the `nvidia-dev` parent, run the full workspace suite, or measure the real worker count under low available commit. AI-assisted test report with Codex.
Decodere commented 2026-11-26 09:07:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-26T09:05:21Z.


Independent RTX 4060 (8 GB) / Windows 11 verification of PR #2705 at 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8 (exact parent origin/nvidia-dev af2cecc40886a8682ecf3267f5328c6dc4b66ad7). Targeted test verification only; not a full source review.

Setup

  • GPU: NVIDIA GeForce RTX 4060 (8 GB / 7956 MiB reported by D3D12), driver 32.0.16.2114 (NVIDIA 621.14, WDDM 3.2)
  • CPU / RAM / OS: Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (31.9 GiB usable), Windows 11 Home 26200
  • Toolchain: rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.9.2609.5, release builds, quiet machine

Targeted release unit tests (231c4f1d)

  • cargo test --release -p xcl --lib shaders::tests::preparation_workers_take_the_commit_left_in_bytes -- --nocapture: 1 passed, 0 failed, 0 ignored (0.00 s, exit 0).
  • cargo test --release -p xcl --lib shaders::tests:: -- --test-threads=4 --nocapture: 12 passed, 0 failed, 0 ignored (0.40 s, exit 0). Note: shaders::tests::pso_measurement_compiles_an_exact_synthetic_record printed a pre-existing host-gated SKIPPED (cannot disable the driver cache (Windows Developer Mode is required), 0x887A002D) and returned ok; the remaining 11 shaders::tests:: cases executed in full, including both preparation_workers_take_the_commit_left_in_bytes and preparation_workers_leave_two_processors_and_follow_the_commit_left.
  • cargo test --release -p xcl --lib host:: -- --test-threads=4 --nocapture: 2 passed, 0 failed, 0 ignored (0.00 s, exit 0), confirming host::tests::the_system_commit_is_known_and_under_its_limit and host::tests::low_commit_is_logged_under_the_mark_and_at_each_halving pass on this Windows 11 host.

Observations

  • Converting limit.saturating_sub(used) from bytes to MiB (>> 20) inside workers_for_commit compiles cleanly in release on origin/nvidia-dev (af2cecc4) and passes the new byte-scale worker-budget unit test (6 GiB free on 16 threads -> 2 workers, 64 GiB -> 12, unknown (0, 0) -> 1, over-limit (20 GiB, 16 GiB) -> 1) alongside all other shaders::tests:: and host::tests:: checks.

Limits of coverage

  • Offline worker-count arithmetic and unit tests only; no live cold-cache xcl run preparation pass under artificial low-commit pressure was run on this 32 GB RAM (~98 GB commit limit) host, and no 60 s runtime smoke was run for this preparation-only fix.
  • Full workspace test suite was not re-run on 231c4f1d (only targeted shaders::tests:: and host:: release tests).
  • shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skipped on this host because Windows Developer Mode is disabled (0x887A002D).

AI use

Ran the targeted release unit tests with assistance from Google Antigravity (Gemini 4 Neon); all test counts and exit codes were taken directly from cargo test output.

<!-- greyfinch-sync:ivall/xcl:comment:7187401777 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7187401777). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-26T09:05:21Z. --- **Independent RTX 4060 (8 GB) / Windows 11 verification of PR #2705 at `231c4f1d06b567d5fece22ab659d1b0ecd21c7f8`** (exact parent `origin/nvidia-dev` `af2cecc40886a8682ecf3267f5328c6dc4b66ad7`). Targeted test verification only; not a full source review. ### Setup - **GPU:** NVIDIA GeForce RTX 4060 (8 GB / `7956 MiB` reported by D3D12), driver `32.0.16.2114` (NVIDIA `621.14`, WDDM 3.2) - **CPU / RAM / OS:** Intel Core i5-11400F (6 cores / 12 threads), 32 GB RAM (`31.9 GiB` usable), Windows 11 Home `26200` - **Toolchain:** `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.9.2609.5`, release builds, quiet machine ### Targeted release unit tests (`231c4f1d`) - `cargo test --release -p xcl --lib shaders::tests::preparation_workers_take_the_commit_left_in_bytes -- --nocapture`: **1 passed, 0 failed, 0 ignored** (`0.00 s`, exit `0`). - `cargo test --release -p xcl --lib shaders::tests:: -- --test-threads=4 --nocapture`: **12 passed, 0 failed, 0 ignored** (`0.40 s`, exit `0`). Note: `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` printed a pre-existing host-gated `SKIPPED` (`cannot disable the driver cache (Windows Developer Mode is required)`, `0x887A002D`) and returned `ok`; the remaining 11 `shaders::tests::` cases executed in full, including both `preparation_workers_take_the_commit_left_in_bytes` and `preparation_workers_leave_two_processors_and_follow_the_commit_left`. - `cargo test --release -p xcl --lib host:: -- --test-threads=4 --nocapture`: **2 passed, 0 failed, 0 ignored** (`0.00 s`, exit `0`), confirming `host::tests::the_system_commit_is_known_and_under_its_limit` and `host::tests::low_commit_is_logged_under_the_mark_and_at_each_halving` pass on this Windows 11 host. ### Observations - Converting `limit.saturating_sub(used)` from bytes to MiB (`>> 20`) inside `workers_for_commit` compiles cleanly in release on `origin/nvidia-dev` (`af2cecc4`) and passes the new byte-scale worker-budget unit test (`6 GiB` free on 16 threads -> `2` workers, `64 GiB` -> `12`, unknown `(0, 0)` -> `1`, over-limit `(20 GiB, 16 GiB)` -> `1`) alongside all other `shaders::tests::` and `host::tests::` checks. ### Limits of coverage - Offline worker-count arithmetic and unit tests only; no live cold-cache `xcl run` preparation pass under artificial low-commit pressure was run on this 32 GB RAM (~98 GB commit limit) host, and no 60 s runtime smoke was run for this preparation-only fix. - Full workspace test suite was not re-run on `231c4f1d` (only targeted `shaders::tests::` and `host::` release tests). - `shaders::tests::pso_measurement_compiles_an_exact_synthetic_record` skipped on this host because Windows Developer Mode is disabled (`0x887A002D`). ### AI use Ran the targeted release unit tests with assistance from Google Antigravity (Gemini 4 Neon); all test counts and exit codes were taken directly from `cargo test` output.
pr1sm-dev commented 2026-11-26 10:06:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by pr1sm-dev on 2026-11-26T09:54:10Z.


A measurement for the 3 GB-per-worker figure in workers_for (not part of this PR's change): on this machine a preparation worker held 6.7–10.9 GB while building the large compute pipelines.

nvidia-dev af2cecc + #684, Linux (Wine 11.22, vkd3d-proton 30b0eb9b), RTX 3070 8 GB, NVIDIA 595.91.07, 16 threads, 62 GB RAM; HLSL path, preparation of the shaders earlier runs used (used-shaders.txt 1,528, used-pipelines.txt 2,025), each run inside a 48 GiB memory cgroup.

  • XCL_PREPARE_WORKERS=6: the cgroup went from 9.5 GB just before the compute-pipeline workers started to a 48.0 GB peak, near its cap, in about 5 minutes. My memory guard ended the run with 4.9 GB of RAM left, before the title started.
  • XCL_PREPARE_WORKERS=3: each worker was compiling one large compute pipeline (100 % of one core), at a resident size of 10.9, 6.7 and 6.7 GB; the host process was 1.1 GB, the cgroup 27.3 GB.

Unset, the count here would be 12 with or without this PR (57,580 MB of commit left under Wine, so the processor bound decides). At these sizes 12 workers would need about 80–130 GB. Not measured on Windows, where the driver's memory per compile may differ, or with XCL_DIRECT_DXIL=1, which makes these programs much smaller.

AI use: Claude Code (Claude Opus 5.5) made the runs and wrote this comment.

<!-- greyfinch-sync:ivall/xcl:comment:7188628820 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7188628820). Originally posted by [pr1sm-dev](https://github.com/pr1sm-dev) on 2026-11-26T09:54:10Z. --- **A measurement for the 3 GB-per-worker figure in `workers_for` (not part of this PR's change): on this machine a preparation worker held 6.7–10.9 GB while building the large compute pipelines.** `nvidia-dev` `af2cecc` + #684, Linux (Wine 11.22, vkd3d-proton `30b0eb9b`), RTX 3070 8 GB, NVIDIA 595.91.07, 16 threads, 62 GB RAM; HLSL path, preparation of the shaders earlier runs used (`used-shaders.txt` 1,528, `used-pipelines.txt` 2,025), each run inside a 48 GiB memory cgroup. - `XCL_PREPARE_WORKERS=6`: the cgroup went from 9.5 GB just before the compute-pipeline workers started to a 48.0 GB peak, near its cap, in about 5 minutes. My memory guard ended the run with 4.9 GB of RAM left, before the title started. - `XCL_PREPARE_WORKERS=3`: each worker was compiling one large compute pipeline (100 % of one core), at a resident size of 10.9, 6.7 and 6.7 GB; the host process was 1.1 GB, the cgroup 27.3 GB. Unset, the count here would be 12 with or without this PR (57,580 MB of commit left under Wine, so the processor bound decides). At these sizes 12 workers would need about 80–130 GB. Not measured on Windows, where the driver's memory per compile may differ, or with `XCL_DIRECT_DXIL=1`, which makes these programs much smaller. AI use: Claude Code (Claude Opus 5.5) made the runs and wrote this comment.
vakaobr commented 2026-11-26 19:45:30 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-26T19:45:30Z.


macOS (CrossOver + D3DMetal) report for this change: here it does change the count, 14 workers before, 6 or 7 after.

I hit the same bug while porting #2624's workers to my Mac branch and made the same change (workers_for_commit, >> 20) before I saw this PR, so this is a test of the same fix, not of this PR's head commit.

Setup: M5 Pro, 18 logical processors, 48 GB RAM + 6 GB swap, macOS 27.2.1, CrossOver 26.3 + D3DMetal; x86_64-pc-windows-gnu, debug test binaries and a release xcl.exe; main 6d12f58 + the Mac fixes + #2555 + #2624's worker commits (mac/integration on my fork, d4f8569).

  • Under CrossOver, K32GetPerformanceInfo gives a limit of 55,296 MB (RAM plus swap), with about 21 to 23 GB left during my runs.
  • Before: every run started 14 workers (18 less four). With 21,051 MB left the rule gives 6.
  • After: 7 in one run, 6 in the later ones, following the memory left at that moment.
  • The unit test for the conversion fails without the shift (left: 14, right: 7) and passes with it.
  • Whole suite one test per process: no change on the 1,516 tests in common with the base; test title 50/50 with exit 0, with and without a synthetic compute pack, all workers exiting with the host.

Not tested: this PR's exact head commit, Windows, a retail title.

AI use: Claude Code with Claude Opus 5.5 ran the tests on my machine and drafted this comment. I checked it before posting.

<!-- greyfinch-sync:ivall/xcl:comment:7201929745 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7201929745). Originally posted by [vakaobr](https://github.com/vakaobr) on 2026-11-26T19:45:30Z. --- **macOS (CrossOver + D3DMetal) report for this change: here it does change the count, 14 workers before, 6 or 7 after.** I hit the same bug while porting #2624's workers to my Mac branch and made the same change (`workers_for_commit`, `>> 20`) before I saw this PR, so this is a test of the same fix, not of this PR's head commit. **Setup:** M5 Pro, 18 logical processors, 48 GB RAM + 6 GB swap, macOS 27.2.1, CrossOver 26.3 + D3DMetal; `x86_64-pc-windows-gnu`, debug test binaries and a release `xcl.exe`; `main` `6d12f58` + the Mac fixes + #2555 + #2624's worker commits (`mac/integration` on my fork, `d4f8569`). - Under CrossOver, `K32GetPerformanceInfo` gives a limit of 55,296 MB (RAM plus swap), with about 21 to 23 GB left during my runs. - **Before:** every run started 14 workers (18 less four). With 21,051 MB left the rule gives 6. - **After:** 7 in one run, 6 in the later ones, following the memory left at that moment. - The unit test for the conversion fails without the shift (`left: 14, right: 7`) and passes with it. - Whole suite one test per process: no change on the 1,516 tests in common with the base; test title 50/50 with exit 0, with and without a synthetic compute pack, all workers exiting with the host. **Not tested:** this PR's exact head commit, Windows, a retail title. **AI use:** Claude Code with Claude Opus 5.5 ran the tests on my machine and drafted this comment. I checked it before posting.
thehollowedone commented 2026-11-27 21:14:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-27T21:14:42Z.


merge-check
base: d1be8103644791b7a65f068954324e93d4b1b565 (nvidia-dev)
head: 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8
merge: clean trial merge into the current nvidia-dev tip; one intended file, 18 insertions and 1 deletion.
build: cargo build --locked --workspace -> ok.
tests: cargo test --locked --workspace --no-fail-fast -- --test-threads=4 -> 1,824 passed, 9 failed, 48 ignored; 27 GPU skip notices. The new preparation_workers_take_the_commit_left_in_bytes test passed. The same command on untouched nvidia-dev at this exact base gave 1,823 passed, 9 failed, 48 ignored, 27 skip notices, with the same nine failing test instances (base comparison). No new suite failure in the trial merge.
review: none found after reading the complete merged diff and tracing host::system_commit() (bytes) through prepare_workers() to workers_for() (MiB). The conversion floors commit headroom to MiB before the existing 3,072 MiB division. Saturating subtraction handles a charge above the limit; the explicit XCL_PREPARE_WORKERS override remains ahead of this calculation.
performance: on systems with low free commit, this reduces concurrent preparation workers and can lengthen startup while reducing simultaneous memory pressure. It does not change the count when the existing processor bound wins. The 3 GiB per worker figure is still a heuristic, not a guarantee for every shader; no local title timing or memory peak was measured.
verdict: safe to merge for this diff against this nvidia-dev tip. The branch's existing CI failures remain to be fixed before its normal merge gate is green.
hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), rustc 1.99.1 MSVC, SDK DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build, and tests, reviewed the patch, and wrote this check.

Not tested here: a retail-title run, AMD, Intel, or preparation duration under a low-commit cap. This is a local trial merge, not a new clean-head smoke block.

<!-- greyfinch-sync:ivall/xcl:comment:7228267536 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7228267536). Originally posted by [thehollowedone](https://github.com/thehollowedone) on 2026-11-27T21:14:42Z. --- merge-check base: [d1be8103644791b7a65f068954324e93d4b1b565](https://github.com/xcl-dev/xcl/commit/d1be8103644791b7a65f068954324e93d4b1b565) (`nvidia-dev`) head: [231c4f1d06b567d5fece22ab659d1b0ecd21c7f8](https://github.com/xcl-dev/xcl/commit/231c4f1d06b567d5fece22ab659d1b0ecd21c7f8) merge: clean trial merge into the current `nvidia-dev` tip; one intended file, 18 insertions and 1 deletion. build: `cargo build --locked --workspace` -> ok. tests: `cargo test --locked --workspace --no-fail-fast -- --test-threads=4` -> 1,824 passed, 9 failed, 48 ignored; 27 GPU skip notices. The new `preparation_workers_take_the_commit_left_in_bytes` test passed. The same command on untouched `nvidia-dev` at this exact base gave 1,823 passed, 9 failed, 48 ignored, 27 skip notices, with the same nine failing test instances ([base comparison](https://github.com/xcl-dev/xcl/pull/3047#issuecomment-7228115188)). No new suite failure in the trial merge. review: none found after reading the complete merged diff and tracing `host::system_commit()` (bytes) through `prepare_workers()` to `workers_for()` (MiB). The conversion floors commit headroom to MiB before the existing 3,072 MiB division. Saturating subtraction handles a charge above the limit; the explicit `XCL_PREPARE_WORKERS` override remains ahead of this calculation. performance: on systems with low free commit, this reduces concurrent preparation workers and can lengthen startup while reducing simultaneous memory pressure. It does not change the count when the existing processor bound wins. The 3 GiB per worker figure is still a heuristic, not a guarantee for every shader; no local title timing or memory peak was measured. verdict: safe to merge for this diff against this `nvidia-dev` tip. The branch's existing CI failures remain to be fixed before its normal merge gate is green. hardware / tool and model: Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti (NVIDIA 621.35), rustc 1.99.1 MSVC, SDK DXC 1.8.2502.11. Codex (GPT-6.2 Sol) ran the merge, build, and tests, reviewed the patch, and wrote this check. Not tested here: a retail-title run, AMD, Intel, or preparation duration under a low-commit cap. This is a local trial merge, not a new clean-head smoke block.
throny commented 2026-11-27 23:42:13 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-27T23:42:13Z.


merge-check claim
head: 231c4f1d06

<!-- greyfinch-sync:ivall/xcl:comment:7230344025 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7230344025). Originally posted by [throny](https://github.com/throny) on 2026-11-27T23:42:13Z. --- merge-check claim head: 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8
tiagonleal commented 2026-11-28 00:03:58 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-28T00:03:58Z.


A data point from a Windows machine where the commit bound would not have helped, in case it is useful for how the worker count is chosen. Not a test of this PR's head.

  • Ryzen 7 9800X3D (16 threads), 32 GB RAM, 64 GB page file, RTX 5070 Ti 16 GB. Tree: #3007 da9c69f7 (on nvidia-dev, without this PR) plus #609, release, default preparation, Newer Retail Game.
  • The preparation ran 12 worker processes. Commit was never short: 21 of 95 GB charged before the compute-pipeline pass and 26.5 GB six seconds later, so about 69 GB left, which gives 12 workers with this PR's arithmetic too.
  • Free physical memory went from 4.07 GB to 0.25 GB in those six seconds (log line 13879 of 26503 records checked for pipelines by 12 workers after 201 s). A guard of mine ends a run under 1 GB free, and it ended this one there; a second run went from 1.85 GB to 0.03 GB the same way. With XCL_PREPARE=0 the same tree ran its 900 s with 2.8 GB free at the lowest.
  • So on a machine with a large page file the bound that would have reduced the workers is available physical memory, not commit left. I did not measure which pages they were; commit grew by only 5.5 GB while 3.8 GB of RAM went, so part of it may be file-backed pages of the pack or the cache that each worker reads.

Two runs, one machine. I have not tried XCL_PREPARE_WORKERS with a lower count to see where it stops happening.

AI use: Claude Code (Claude Fable 5.2) ran the runs, read the logs and wrote this.

<!-- greyfinch-sync:ivall/xcl:comment:7230619039 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7230619039). Originally posted by [tiagonleal](https://github.com/tiagonleal) on 2026-11-28T00:03:58Z. --- A data point from a Windows machine where the commit bound would not have helped, in case it is useful for how the worker count is chosen. Not a test of this PR's head. - Ryzen 7 9800X3D (16 threads), 32 GB RAM, 64 GB page file, RTX 5070 Ti 16 GB. Tree: #3007 `da9c69f7` (on `nvidia-dev`, without this PR) plus #609, release, default preparation, Newer Retail Game. - The preparation ran 12 worker processes. Commit was never short: 21 of 95 GB charged before the compute-pipeline pass and 26.5 GB six seconds later, so about 69 GB left, which gives 12 workers with this PR's arithmetic too. - Free physical memory went from 4.07 GB to 0.25 GB in those six seconds (log line `13879 of 26503 records checked for pipelines by 12 workers after 201 s`). A guard of mine ends a run under 1 GB free, and it ended this one there; a second run went from 1.85 GB to 0.03 GB the same way. With `XCL_PREPARE=0` the same tree ran its 900 s with 2.8 GB free at the lowest. - So on a machine with a large page file the bound that would have reduced the workers is available physical memory, not commit left. I did not measure which pages they were; commit grew by only 5.5 GB while 3.8 GB of RAM went, so part of it may be file-backed pages of the pack or the cache that each worker reads. Two runs, one machine. I have not tried `XCL_PREPARE_WORKERS` with a lower count to see where it stops happening. AI use: Claude Code (Claude Fable 5.2) ran the runs, read the logs and wrote this.
throny commented 2026-11-28 00:04:31 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-11-28T00:04:31Z.


merge-check
base: d1be8103 (nvidia-dev)
head: 231c4f1d06
merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1825 passed, 8 failed, 48 ignored (27 SKIPPED lines). The 8 failures are the base's own on this GPU, the same six names with and without the PR (async_compute_pso_registers_real_pso_and_not_standin, split_compute_prefers_the_offline_whole_pipeline, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, two texture_upload tests; #2771 and #2788 fix three of them). Base alone: 1824 passed, 8 failed, 48 ignored.
review: none. On the base, prepare_workers passes bytes where free_mb expects MiB, so the commit limit never applied; the new test fails without the fix.
performance: no frame cost; fewer preparation workers when commit is low, which is the point.
verdict: safe to merge
hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).

<!-- greyfinch-sync:ivall/xcl:comment:7230626519 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2705#issuecomment-7230626519). Originally posted by [throny](https://github.com/throny) on 2026-11-28T00:04:31Z. --- merge-check base: d1be8103 (nvidia-dev) head: 231c4f1d06b567d5fece22ab659d1b0ecd21c7f8 merge: clean build: cargo build --workspace -> ok tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 1825 passed, 8 failed, 48 ignored (27 SKIPPED lines). The 8 failures are the base's own on this GPU, the same six names with and without the PR (async_compute_pso_registers_real_pso_and_not_standin, split_compute_prefers_the_offline_whole_pipeline, two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs, console_ms_in_as_slot_and_ms_with_as_are_refused_cleanly, two texture_upload tests; #2771 and #2788 fix three of them). Base alone: 1824 passed, 8 failed, 48 ignored. review: none. On the base, prepare_workers passes bytes where free_mb expects MiB, so the commit limit never applied; the new test fails without the fix. performance: no frame cost; fewer preparation workers when commit is low, which is the point. verdict: safe to merge hardware / tool and model: RTX 4080 16 GB (621.40), i9-12900K, Windows 11 26300, Rust 1.100.0, debug. Claude Code; merge, build and suite run by Claude Fable 5.2, diff review by Claude Opus 5.5 (every hunk read; nothing run on the GPU beyond the suite).
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!2695
No description provided.