WIP: Preload: DARNER_PRELOAD_SCHEDULE keeps the early pipelines first in step 3 #468

Draft
Jesper-A wants to merge 1 commit from Jesper-A/Darner:up-preload-schedule-early into Main
Collaborator

Refs #266

What it changes

Follow-up to #266 (merged at a1dde3ce). It answers point 1 of the review: #266 (comment)

  • The problem on main: read from the code (the reviewer's reading, and mine on the diff). With DARNER_PRELOAD_SCHEDULE=1, step 3 of the preload (into_library in apps/darner/src/warm.rs) sorts all early first, then slow_first re-sorts the whole list by recorded time. Known-slow pipelines that are not early then go before every early one. It matters only with DARNER_PRELOAD_SAVE_EVERY set, where a step 3 stopped part-way keeps fewer of the pipelines the game loads first.
  • What this does: step 3 splits the list at the early boundary, as step 2 does, and orders each part by slow_first on its own. A new chunks_in_two_runs (apps/darner/src/warm/schedule.rs) makes the chunks of the early part first and of the rest after, and none crosses the boundary. The printed line now says N early and M other pipelines of known time first. With the switch off, nothing changes.
  • A new test (two_runs_keep_the_early_ones_first_and_cover_every_place_once) checks that every place is covered once, no chunk crosses the boundary, and the early chunks all come first.

Not done here: the other two review points need a game run on a real cold preload (below).

How it was tested

  • Tested revision: branch up-preload-schedule-early @ 974519cdb, based on main 47d21cd3b.
  • Based on main 47d21cd3b. main is now d91d8e4d6; git merge-tree merges the branch cleanly there. Not rebased, not re-tested on the new main (WIP).
  • Commands and results: cargo clippy -p darner, with and without --all-features, and the darner tests, reported clean by the porter (hand-back: "gates green"); exact flags and counts not kept. I did not re-run them for this text.
  • Changes a default: no. The switch stays off by default.
  • A/B result: none yet. Needs a GPU timing run (below). No speed or memory claim is made.
  • Gates run on that revision: the scoped ones above only, as reported. Not run: cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo test --workspace --locked.
  • Gameplay: not run in game.
  • Shader wave sizes tested: no shader change.
  • Hardware dependence: see "Spec dependence".
  • Coverage gaps, to check before WIP: comes off (these are the reviewer's points 2 and 3, still open):
    • A cold preload with the switch off and on, timing the tail and the peak memory of step 3. The reviewer asked for one 16 GB machine in the run and for a check that the compile memory guard holds.
    • With DARNER_PRELOAD_SAVE_EVERY set and step 3 stopped part-way: the early pipelines are in the saved library first.
    • The merge with #215's throttle in the queue path (the reviewer's note on a conflict in warm.rs): #215 is merged; this branch is after it.

Spec dependence

  • Likely general: ordering of work, independent of the card.
  • May depend on our specs (8 GB VRAM near budget, 32 GB RAM, Ryzen 7 5800X): the memory peak of starting the longest compiles together depends on RAM and thread count; not measured.
  • Untested elsewhere: other CPUs, 16 GB machines, AMD and Intel.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only). Not run in game; timing run pending.
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md. (Text only.)
  • 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 (open PRs only; I searched open PRs for "preload" and read the file list of every open PR through the API): #450 (DARNER_PRELOAD_SAVE_PARTIAL) and #458 (DARNER_PRELOAD_CONTROLS) also edit into_library in warm.rs; expect textual conflicts in the step 3 region. #234 also edits into_library (older base, not compared hunk by hunk). #165, #270, #365 and #463 touch other parts of warm.rs. #451, #459 and #460 touch no file this PR does. No open PR touches warm/schedule.rs.
  • Replaces or overlaps: none found (no open PR makes this ordering change).

This change was made with AI assistance (Claude Code).

Refs #266 ## What it changes Follow-up to #266 (merged at `a1dde3ce`). It answers point 1 of the review: https://git.gtahub.st/TrustNo1/Darner/pulls/266#issuecomment-873192 - The problem on main: read from the code (the reviewer's reading, and mine on the diff). With `DARNER_PRELOAD_SCHEDULE=1`, step 3 of the preload (`into_library` in `apps/darner/src/warm.rs`) sorts `all` early first, then `slow_first` re-sorts the whole list by recorded time. Known-slow pipelines that are not early then go before every early one. It matters only with `DARNER_PRELOAD_SAVE_EVERY` set, where a step 3 stopped part-way keeps fewer of the pipelines the game loads first. - What this does: step 3 splits the list at the early boundary, as step 2 does, and orders each part by `slow_first` on its own. A new `chunks_in_two_runs` (`apps/darner/src/warm/schedule.rs`) makes the chunks of the early part first and of the rest after, and none crosses the boundary. The printed line now says `N early and M other pipelines of known time first`. With the switch off, nothing changes. - A new test (`two_runs_keep_the_early_ones_first_and_cover_every_place_once`) checks that every place is covered once, no chunk crosses the boundary, and the early chunks all come first. Not done here: the other two review points need a game run on a real cold preload (below). ## How it was tested - Tested revision: branch `up-preload-schedule-early` @ `974519cdb`, based on main `47d21cd3b`. - Based on main `47d21cd3b`. main is now `d91d8e4d6`; `git merge-tree` merges the branch cleanly there. Not rebased, not re-tested on the new main (WIP). - Commands and results: `cargo clippy -p darner`, with and without `--all-features`, and the `darner` tests, reported clean by the porter (hand-back: "gates green"); exact flags and counts not kept. I did not re-run them for this text. - Changes a default: no. The switch stays off by default. - A/B result: none yet. Needs a GPU timing run (below). No speed or memory claim is made. - Gates run on that revision: the scoped ones above only, as reported. Not run: `cargo clippy --workspace --all-targets --locked -- -D warnings`, the same with `--all-features`, and `cargo test --workspace --locked`. - Gameplay: not run in game. - Shader wave sizes tested: no shader change. - Hardware dependence: see "Spec dependence". - Coverage gaps, to check before `WIP:` comes off (these are the reviewer's points 2 and 3, still open): - A cold preload with the switch off and on, timing the tail and the peak memory of step 3. The reviewer asked for one 16 GB machine in the run and for a check that the `compile memory` guard holds. - With `DARNER_PRELOAD_SAVE_EVERY` set and step 3 stopped part-way: the early pipelines are in the saved library first. - The merge with #215's throttle in the queue path (the reviewer's note on a conflict in `warm.rs`): #215 is merged; this branch is after it. ## Spec dependence - Likely general: ordering of work, independent of the card. - May depend on our specs (8 GB VRAM near budget, 32 GB RAM, Ryzen 7 5800X): the memory peak of starting the longest compiles together depends on RAM and thread count; not measured. - Untested elsewhere: other CPUs, 16 GB machines, AMD and Intel. ## Checklist - [ ] I ran this change in the game, or say below why it can't be (docs, tests only). Not run in game; timing run pending. - [x] This PR contains one change based on `main`. - [ ] The diff follows `docs/asset-policy.md`. (Text only.) - [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 (open PRs only; I searched open PRs for "preload" and read the file list of every open PR through the API): #450 (DARNER_PRELOAD_SAVE_PARTIAL) and #458 (DARNER_PRELOAD_CONTROLS) also edit `into_library` in `warm.rs`; expect textual conflicts in the step 3 region. #234 also edits `into_library` (older base, not compared hunk by hunk). #165, #270, #365 and #463 touch other parts of `warm.rs`. #451, #459 and #460 touch no file this PR does. No open PR touches `warm/schedule.rs`. - Replaces or overlaps: none found (no open PR makes this ordering change). This change was made with AI assistance (Claude Code).
Review of #266 (TrustNo1, point 1): into_library sorted the whole list
by recorded time, so known-slow non-early pipelines went before every
early one. The list is now split at the early boundary and each part is
ordered on its own, as step 2 does, and the queue's chunks follow
(chunks_in_two_runs), so a step 3 stopped part-way
(DARNER_PRELOAD_SAVE_EVERY) keeps the pipelines the game loads first.
The memory peak and the cold A/B are timing runs, not done here.

This change was made with AI assistance (Claude Code).
Contributor

I reproduced the step 3 checkpoint change on an RTX 3060 Laptop GPU (6 GiB, driver 621.24), Windows 11 build 26300, 16 GiB system RAM. I compared 974519cdb with its parent 47d21cd3b using one worker, DARNER_PRELOAD_SCHEDULE=1, DARNER_PRELOAD_SAVE_EVERY=30 and 128 distinct generated compute pipelines. Half were marked early. The other half had recorded slow times.

I sent pause after the seventh completion. Both versions reached eight before the worker parked. At the first timed save I copied the library and its translator marker before sending go. Separate copies were then reopened with each group of 64.

First checkpoint Early pipelines loaded Other pipelines loaded
Parent 47d21cd3b 0 8
PR 974519cdb 8 0

On both revisions an empty library loaded 0/64 in each group and the final library loaded 64/64. Each probe also requested one extra pipeline known to be absent so the CLI emitted its load/make counters.

One wording detail for multiple workers: early chunks are claimed first. In a separate CPU fixture with the production queue and timer, I held the first of 64 early pipelines in compilation. A second worker finished all five non-early pipelines before the 30-second save, which therefore contained 0 early and 5 other. All 69 were present at the end. The GPU result above is the single-worker case.

Both workspace Clippy configurations passed on the PR head with warnings denied, all seven schedule tests passed, and cargo xtask policy reported 564 files OK. Cold game-preload time, peak memory and compile-memory guard behavior under pressure remain open.

With DXC 1.8.2505.32 configured, cargo test --workspace --locked stopped twice in darner-gpu on watch::tests::ask_once_by_res_splits_reservations_without_refusals. That test passed alone and failed with the same assertion in the parent's GPU test binary. In each grouped run, 1,789 GPU tests passed, one failed and 81 were ignored. PR #150 covers that assertion.

I reproduced the step 3 checkpoint change on an RTX 3060 Laptop GPU (6 GiB, driver 621.24), Windows 11 build 26300, 16 GiB system RAM. I compared `974519cdb` with its parent `47d21cd3b` using one worker, `DARNER_PRELOAD_SCHEDULE=1`, `DARNER_PRELOAD_SAVE_EVERY=30` and 128 distinct generated compute pipelines. Half were marked early. The other half had recorded slow times. I sent `pause` after the seventh completion. Both versions reached eight before the worker parked. At the first timed save I copied the library and its translator marker before sending `go`. Separate copies were then reopened with each group of 64. | First checkpoint | Early pipelines loaded | Other pipelines loaded | | --- | ---: | ---: | | Parent `47d21cd3b` | 0 | 8 | | PR `974519cdb` | 8 | 0 | On both revisions an empty library loaded 0/64 in each group and the final library loaded 64/64. Each probe also requested one extra pipeline known to be absent so the CLI emitted its load/make counters. One wording detail for multiple workers: early chunks are **claimed** first. In a separate CPU fixture with the production queue and timer, I held the first of 64 early pipelines in compilation. A second worker finished all five non-early pipelines before the 30-second save, which therefore contained 0 early and 5 other. All 69 were present at the end. The GPU result above is the single-worker case. Both workspace Clippy configurations passed on the PR head with warnings denied, all seven schedule tests passed, and `cargo xtask policy` reported 564 files OK. Cold game-preload time, peak memory and compile-memory guard behavior under pressure remain open. With DXC 1.8.2505.32 configured, `cargo test --workspace --locked` stopped twice in `darner-gpu` on `watch::tests::ask_once_by_res_splits_reservations_without_refusals`. That test passed alone and failed with the same assertion in the parent's GPU test binary. In each grouped run, 1,789 GPU tests passed, one failed and 81 were ignored. [PR #150 covers that assertion](https://git.gtahub.st/TrustNo1/Darner/pulls/150).
Jesper-A force-pushed up-preload-schedule-early from 974519cdbc to d9213b0547 2026-12-05 16:40:15 +00:00 Compare
Author
Collaborator

Closing this old-engine PR because post-merge replaced the preload step 3 sort and DARNER_PRELOAD_SCHEDULE it fixes (preload.rs:16-21). It can be redone on post-merge if they come.

Written with AI assistance (Claude Code).

Closing this old-engine PR because post-merge replaced the preload step 3 sort and `DARNER_PRELOAD_SCHEDULE` it fixes (`preload.rs:16-21`). It can be redone on post-merge if they come. Written with AI assistance (Claude Code).
Jesper-A closed this pull request 2026-12-06 01:26:24 +00:00
Jesper-A reopened this pull request 2026-12-06 01:52:02 +00:00
Author
Collaborator

Reopened: Main is the default branch again, so the close note above no longer applies.

Written with AI assistance (Claude Code).

Reopened: Main is the default branch again, so the close note above no longer applies. Written with AI assistance (Claude Code).
TrustNo1 changed title from WIP: [pr-fix][startup][shaders] Preload: DARNER_PRELOAD_SCHEDULE keeps the early pipelines first in step 3 to WIP: Preload: DARNER_PRELOAD_SCHEDULE keeps the early pipelines first in step 3 2026-12-06 03:28:37 +00:00
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'up-preload-schedule-early:Jesper-A-up-preload-schedule-early'
git switch 'Jesper-A-up-preload-schedule-early'

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 'Jesper-A-up-preload-schedule-early'
git switch 'Jesper-A-up-preload-schedule-early'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'Jesper-A-up-preload-schedule-early'
git switch 'Jesper-A-up-preload-schedule-early'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'Jesper-A-up-preload-schedule-early'
git switch 'Main'
git merge --squash 'Jesper-A-up-preload-schedule-early'
git switch 'Main'
git merge --ff-only 'Jesper-A-up-preload-schedule-early'
git switch 'Main'
git merge 'Jesper-A-up-preload-schedule-early'
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!468
No description provided.