allow tuning warm child batch size via DARNER_WARM_BATCH #648

Open
RileyW wants to merge 1 commit from RileyW/Darner:pr/warm-batch-env into Main
First-time contributor

Note: This exact Darner revision has not yet been run end-to-end in the game on Darner main. The same tunable batch option has been used during full pipeline precompilation on our Windows 10 (i7-8700, RTX 3080 20 GiB, 32+ GiB RAM) fork; the default batch size remains unchanged at 40, and this Darner port passes all 24 warm::tests and all workspace gates.

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: In apps/darner/src/warm.rs, AT_ONCE is hardcoded to 40 pipelines per child process.
  • Real-world gameplay/runtime impact: Full shader/pipeline precompilation (darner warm and darner preload) compiles tens of thousands of pipelines (up to ~84,000) in isolated child processes to contain driver compiler crashes and RAM growth. At 40 pipelines per child, a full warm-up spawns over 2,000 child processes, forcing each process to re-initialize D3D12 and re-scan known-shaders.bin and known-pipelines.bin from scratch. On higher-RAM machines (32 GiB or more), that repeated process startup overhead dominates warm-up time for users waiting to play.
  • What this does: Adds an optional DARNER_WARM_BATCH environment variable parsed by parse_batch_size(), keeping the default unchanged at 40 (preserving low-RAM safety for users who set nothing) and clamping explicit values to 1..=4000 so the --these comma-separated argument stays safely below Windows' 32 KiB command-line length limit. Adds unit test warm::tests::warm_batch_size_defaults_and_clamps.

How it was tested

  • Tested revision: 74c7d47 (PR branch on c8258f9) and 96096db (merged into riley/all)
  • Commands and results:
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed (0 warnings)
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed (0 warnings)
    • cargo xtask policy and cargo xtask policy --staged: passed (576 files ok)
    • cargo test -p darner --bin darner --locked warm::tests::: passed (24 passed, 0 failed)
  • Changes a default: no (default stays 40 when DARNER_WARM_BATCH is unset or invalid)
  • A/B result: Off by default (default unchanged at 40); checked via unit test covering default fallback, whitespace trimming, invalid input fallback, and 1..=4000 clamping.
  • Gates run on that revision: all three workspace gates in AGENTS.md on 74c7d47 and 96096db
  • Gameplay, when relevant: offline darner warm / darner preload workflow (no in-game rendering change)
  • Shader wave sizes tested, when relevant: n/a
  • Hardware dependence: general (primarily benefits Windows hosts with 32 GiB or more RAM during precompilation)
  • Coverage gaps: Offline CLI batch-size parsing and clamping tested via unit tests; full-book darner warm timing comparison on Darner main not yet logged.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found
  • Replaces or overlaps: none found
Note: This exact Darner revision has not yet been run end-to-end in the game on Darner main. The same tunable batch option has been used during full pipeline precompilation on our Windows 10 (i7-8700, RTX 3080 20 GiB, 32+ GiB RAM) fork; the default batch size remains unchanged at 40, and this Darner port passes all 24 `warm::tests` and all workspace gates. ## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: In `apps/darner/src/warm.rs`, `AT_ONCE` is hardcoded to `40` pipelines per child process. - Real-world gameplay/runtime impact: Full shader/pipeline precompilation (`darner warm` and `darner preload`) compiles tens of thousands of pipelines (up to ~84,000) in isolated child processes to contain driver compiler crashes and RAM growth. At 40 pipelines per child, a full warm-up spawns over 2,000 child processes, forcing each process to re-initialize D3D12 and re-scan `known-shaders.bin` and `known-pipelines.bin` from scratch. On higher-RAM machines (32 GiB or more), that repeated process startup overhead dominates warm-up time for users waiting to play. - What this does: Adds an optional `DARNER_WARM_BATCH` environment variable parsed by `parse_batch_size()`, keeping the default unchanged at `40` (preserving low-RAM safety for users who set nothing) and clamping explicit values to `1..=4000` so the `--these` comma-separated argument stays safely below Windows' 32 KiB command-line length limit. Adds unit test `warm::tests::warm_batch_size_defaults_and_clamps`. ## How it was tested - Tested revision: `74c7d47` (PR branch on `c8258f9`) and `96096db` (merged into `riley/all`) - Commands and results: - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed (0 warnings) - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed (0 warnings) - `cargo xtask policy` and `cargo xtask policy --staged`: passed (576 files ok) - `cargo test -p darner --bin darner --locked warm::tests::`: passed (24 passed, 0 failed) - Changes a default: no (default stays `40` when `DARNER_WARM_BATCH` is unset or invalid) - A/B result: Off by default (default unchanged at 40); checked via unit test covering default fallback, whitespace trimming, invalid input fallback, and `1..=4000` clamping. - Gates run on that revision: all three workspace gates in AGENTS.md on `74c7d47` and `96096db` - Gameplay, when relevant: offline `darner warm` / `darner preload` workflow (no in-game rendering change) - Shader wave sizes tested, when relevant: n/a - Hardware dependence: general (primarily benefits Windows hosts with 32 GiB or more RAM during precompilation) - Coverage gaps: Offline CLI batch-size parsing and clamping tested via unit tests; full-book `darner warm` timing comparison on Darner main not yet logged. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found - Replaces or overlaps: none found
TrustNo1 changed title from [pr-performance][warm] allow tuning warm child batch size via DARNER_WARM_BATCH to allow tuning warm child batch size via DARNER_WARM_BATCH 2026-12-06 03:25:33 +00:00
Owner

Test needed — commit 74c7d47a; what to check:

  • The problem on main: In apps/darner/src/warm.rs, AT_ONCE is hardcoded to 40 pipelines per child process.
  • Real-world gameplay/runtime impact: Full shader/pipeline precompilation (darner warm and darner preload) compiles tens of thousands of pipelines (up to ~84,000) in isolated child processes to contain driver compiler crashes and RAM growth. At 40 pipelines per child, a full warm-up spawns over 2,000 child processes, forcing each process to re-initialize D3D12 and re-scan known-shaders.bin and known-pipelines.bin from scratch. On higher-RAM machines (32 GiB or more), that repeated process startup overhead dominates warm-up time for users waiting to play.
  • What this does: Adds an optional DARNER_WARM_BATCH environment variable parsed by parse_batch_size(), keeping the default unchanged at 40 (preserving low-RAM safety for users who set nothing) and clamping explicit values to 1..=4000 so the --these comma-separated argument stays safely below Windows' 32 KiB command-line length limit. Adds unit test warm::tests::warm_batch_size_defaults_and_clamps.

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `74c7d47a`; what to check: - The problem on main: In `apps/darner/src/warm.rs`, `AT_ONCE` is hardcoded to `40` pipelines per child process. - Real-world gameplay/runtime impact: Full shader/pipeline precompilation (`darner warm` and `darner preload`) compiles tens of thousands of pipelines (up to ~84,000) in isolated child processes to contain driver compiler crashes and RAM growth. At 40 pipelines per child, a full warm-up spawns over 2,000 child processes, forcing each process to re-initialize D3D12 and re-scan `known-shaders.bin` and `known-pipelines.bin` from scratch. On higher-RAM machines (32 GiB or more), that repeated process startup overhead dominates warm-up time for users waiting to play. - What this does: Adds an optional `DARNER_WARM_BATCH` environment variable parsed by `parse_batch_size()`, keeping the default unchanged at `40` (preserving low-RAM safety for users who set nothing) and clamping explicit values to `1..=4000` so the `--these` comma-separated argument stays safely below Windows' 32 KiB command-line length limit. Adds unit test `warm::tests::warm_batch_size_defaults_and_clamps`. Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr/warm-batch-env:RileyW-pr/warm-batch-env'
git switch 'RileyW-pr/warm-batch-env'

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 'RileyW-pr/warm-batch-env'
git switch 'RileyW-pr/warm-batch-env'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'RileyW-pr/warm-batch-env'
git switch 'RileyW-pr/warm-batch-env'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'RileyW-pr/warm-batch-env'
git switch 'Main'
git merge --squash 'RileyW-pr/warm-batch-env'
git switch 'Main'
git merge --ff-only 'RileyW-pr/warm-batch-env'
git switch 'Main'
git merge 'RileyW-pr/warm-batch-env'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!648
No description provided.