[pr-feature][startup][shaders] Preload window: build the early set first (DARNER_PRELOAD_EARLY_FIRST, off by default) #267
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:up-preload-early-first"
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 with the switch on, and two of the three gates have not run. Branch
up-preload-early-first, one commit onmainf3840d73d.Refs #128, #250
Contributor role (optional)
What it changes
darner preloadwith--all(apps/darner/src/preload_ui.rs, the.arg("--all")line inrun()). That makes every pipeline an earlier run recorded, 77k to 89k of them. Our own cold test runs use the--usedpath (about 5,000 early pipelines plus about 2,550 slow ones) and take 28.4, 31.3 and 28.9 min (3 cold or near-cold runs, all clocks unlocked). A reporter measured 47 minutes for--allon a Ryzen 7 8845HS laptop (#128). The gap probably comes mostly from about 70k cheap pipelines, about 0.11 s each on average (a rough estimate from #128's numbers; different PCs, so not a measured difference).DARNER_PRELOAD_EARLY_FIRST=1the window passes--usedinstead of--all, but only whenearly-pipelines.txtholds at least 1,000 pipelines (DARNER_PRELOAD_USED_MIN). The game then starts after the early and slow set (about 7.5k pipelines) and makes the rest when it first draws with it, as it does for any pipeline a preload did not cover. With a short or missing list,--usedwould build little or nothing in step 2, so the window keeps--allthen. With the switch off (the default) nothing changes. The switch is read with a plain environment read, like the otherDARNER_PRELOAD_*switches inapps/darner(theasked_for!/toggled!macros live indarner-gpu).apps/darner/src/preload_scope.rs: a small pure functionargument(early_first, list_recorded)with three unit tests, and a one-line change inpreload_ui.rs. The console prints which scope was chosen. A line indocs/findings.md. The switch is documented in the README switch table.darner preload --allfrom a shell makes the rest.made=0, so not every hitch is a compile. Not measured with this switch.play.rsandwarm.rsand would collide with #140 and #215.How it was tested
Tested revision:
e27749176(onf3840d73d);cargo xtask policyand thepreloadtests ran on this tree.Commands and results:
cargo test --locked -j 4 -p darner --bin darner -- preload: 10 passed, 1 ignored.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo xtask policy: ok.Changes a default: no.
A/B result: not applicable for a speed claim, because the switch is off by default and there is no timing run with it on. The behaviour was checked by the unit tests of the decision only. The numbers above (28.4, 31.3 and 28.9 min for
--used, 47 min for--all) are from other runs: ours are from our PC (see Spec dependence), the 47 min is the reporter's in #128.--all)--used)--usedpath, not with this switch)Gates run on that revision (the three in AGENTS.md; there is no CI): gate 1 (
cargo clippy --workspace --all-targets --locked -- -D warnings) plus a narrow test run (cargo test --locked -j 4 -p darner --bin darner -- preload), on the head commit. Not run:cargo clippy --workspace --all-targets --all-features --locked -- -D warningsandcargo test --workspace --locked.Gameplay, when relevant: not run. No game run and no timing run with the switch on.
Shader wave sizes tested, when relevant: not relevant (no shader change).
Hardware dependence: likely general, may depend on CPU core count (see below).
Coverage gaps: no game start after a
--usedpreload; hitches from the remaining compiles during play not measured; F1's PRELOAD SHADERS uses the same window and so also follows the switch (not tried).Spec dependence
Checklist
main.docs/asset-policy.md(cargo xtask policy: ok).Checked for overlap
warm.rs).--usedset is already done on the next start; #266 orders and schedules the same step-3 slow set that--usedbuilds. Shared files: only the appendeddocs/findings.mdline (all three) and the README switch table (#264), so at most a trivial textual conflict.play.rs,preload_ui.rs) and #215 (preload_ui.rs,warm.rs): expected textual conflict next to the--allline inrun(). #215 may rewriterun(). This draft is posted as it is, conflicts included, and will be rebased beforeWIP:comes off.early-pipelines.txt): changes what the list holds, not this decision. It should make "early-pipelines.txtholds at least 1,000 pipelines" true earlier.translate.rs,shader_cache.rs): no shared files. Onlydocs/findings.mdis touched by several PRs.This change was made with AI assistance (Claude Code).
Review of
e2774917(read only, not built or run). WIP draft: small, correct.Checked:
argument(early_first, list_recorded)gives--usedonly when the switch is on andwarm::used_pipelines_recorded()says a list of at leastDARNER_PRELOAD_USED_MINexists. Otherwise it gives--all, so--usedcan never build almost nothing. A read error counts as no list. The three tests cover the table.--allexactly as on main.darner preload --allfrom a shell is untouched.--all) as an opt-in, without changing the default.Points:
--usedwrites the finished mark, so later starts don't preload again. F1 > PRELOAD SHADERS goes through the same window and switch, so with the switch on nothing ever builds the other ~70k pipelines up front; they are made in play. That's intended, but say it in the README row: "F1's preload also builds only the used set while this is on;darner preload --allbuilds everything."It merges cleanly with main (
f3840d73), #153 and #228. It conflicts with #215 inpreload_ui.rs, where both rewrite theCommandinrun(). The fix is one line: keep #215's command and passpreload_scope::current_argument()in place of"--all". It conflicts with #140 in README,main.rs(module list) anddocs/findings.md, all trivial.No testcall-ok while it's a draft.
WIP: [pr-feature][startup][shaders] Preload window: build the early set first (DARNER_PRELOAD_EARLY_FIRST, off by default)to [pr-feature][startup][shaders] Preload window: build the early set first (DARNER_PRELOAD_EARLY_FIRST, off by default)