Skip to content

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

Open
pr1sm-dev wants to merge 1 commit into
xcl-dev:nvidia-devfrom
pr1sm-dev:prep-workers-mib
Open

pr1sm-dev wants to merge 1 commit into
xcl-dev:nvidia-devfrom
pr1sm-dev:prep-workers-mib

Conversation

@pr1sm-dev

@pr1sm-dev pr1sm-dev commented Nov 26, 2026 •

Copy link
Copy Markdown

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 #2624 (comment); 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 Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #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

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

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. The commit bound therefore never applied: the count was
always the logical processors less four (at most 32), so 16 threads with
6 GiB of commit left got 12 workers instead of 2. Reported by pickles976
on xcl-dev#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, and
XCL_PREPARE_WORKERS still sets the count directly. The new test passes the
figures in bytes; without the conversion it fails (12, expected 2).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BuVT2rKpD9DAmDGg1zuzbB
@luckyteagirl

Copy link
Copy Markdown
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants