[pr-performance][startup][shaders] Preload: slowest pipelines first, and chunks handed out as threads free up (DARNER_PRELOAD_SCHEDULE, off by default) #266
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:up-preload-schedule"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Draft: no timing run, so no speed claim, and two of the three gates have not run. Branch
up-preload-schedule, one commit (a1dde3cea) onmainf3840d73d.Refs #128
Contributor role (optional)
What it changes
warm::into_library) gives each thread a fixed stripe (skip(t).step_by(threads)). The thread that drew the slow pipelines finishes last while the others idle. In our logs of 2026-12-03 the end of step 3 ran 8, then 2, then 1 compile at a time, about 1 to 2 minutes (read fromcompile memorylines on our PC). With this change that tail should shrink; not measured. Step 2 (warm::run) already hands out chunks of 40 dynamically, but in key order, so a slow chunk can start late.DARNER_PRELOAD_SCHEDULE=1(off by default):apps/darner/src/warm/schedule.rs. It readsslow-pipelines.txt(lines<key> <ms>for every pipeline that took 1 s or more; the longest line of a key counts) and sorts slowest first. Pipelines with no recorded time keep their old order after them.known::makereads the pipeline book once per call, so the cheap ones go in larger chunks). Every pipeline is made once.fill_library(DARNER_WARM_SHARED=1only) and step 1 (translate.rs, a different problem: a barrier between files).compile memorylines of 2026-12-03) is not lowered. Starting the longest compiles together may raise the early peak a little; the memory gate still applies. If the tail shrinks (should; not measured), the high-memory period may be shorter. None of this is measured with the switch on.docs/findings.md.How it was tested
Tested revision:
a1dde3cea(onf3840d73d).Commands and results:
cargo test -p darner --bin darner warm: 29 passed (includes the new tests inschedule.rs: reading the file, stable slowest-first order, chunks covering every place once).cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo xtask policy: ok.Changes a default: no.
A/B result: none. The switch is off by default and nothing was timed with it on, so this PR makes no speed claim. No timing run, so no gain is claimed.
Gates run on that revision (the three in AGENTS.md; there is no CI): gate 1 only (
cargo clippy --workspace --all-targets --locked -- -D warnings). Not run: the same with--all-features, andcargo test --workspace --locked.Gameplay, when relevant: not run. No preload with the switch on.
Shader wave sizes tested, when relevant: not relevant (no shader change).
Hardware dependence: see Spec dependence.
Coverage gaps: any timing run, the length of the tail with the switch on, the memory peak with the longest compiles starting together (16 GB machines in particular),
--all-features, the workspace tests.Spec dependence
Checklist
main.docs/asset-policy.md(cargo xtask policy: ok).Checked for overlap
warm.rs), #142, #140 (ours), #235 (andrewpozdnakov7-jpg), #234 (same author,warm.rs).warm.rs. My edits are ininto_library's thread loop, a short block inrunafter the candidates sort, and the newwarm/schedule.rs. Conflicts are possible; not merged to check. This draft is posted as it is and will be rebased beforeWIP:comes off.translate.rs): no shared files. #140 and #235: no shared files.up-preload-early-firstandup-preload-keep-marksdrafts (my own) change what runs first, and the marks code nearrun'sto_make, respectively; adjacent, not the same lines.This change was made with AI assistance (Claude Code).
Review of
a1dde3ce(read only, not built or run). WIP draft: one ordering point to settle, otherwise sound.Checked:
recorded_mskeeps the longest line per key and skips bad lines and NaN.slow_firstis a stable sort: known times longest first, unknown after them in their old order.chunkscovers every place exactly once. The tests check edge lengths, and 8 threads on oneQueue.fetch_addon the index). The per-pipeline callback only touches atomics, so sharing&eachacross calls is fine.Points:
into_librarysortsallearly first, butslow_first(&mut all, ...)then re-sorts the whole list by time. Known-slow non-early pipelines then go before every early one. That doesn't matter while step 3 only saves at its end. WithDARNER_PRELOAD_SAVE_EVERYset, though, a step 3 stopped part-way keeps fewer of the pipelines the game loads first. Split at the early boundary here as you do in step 2 (or say why not).compile memoryguard holds.It merges cleanly with main (
f3840d73), #153 and #228. It conflicts with #215 inwarm.rs: both rewrite theinto_libraryworker loop, and #215 replaces theis_multiple_of(500)print with its throttle. Rebase this on #215 and keep the throttle in the queue path. With #140, #264 and #267 it conflicts only indocs/findings.md.No testcall-ok while it's a draft.
WIP: [pr-performance][startup][shaders] Preload: slowest pipelines first, and chunks handed out as threads free up (DARNER_PRELOAD_SCHEDULE, off by default)to [pr-performance][startup][shaders] Preload: slowest pipelines first, and chunks handed out as threads free up (DARNER_PRELOAD_SCHEDULE, off by default)