WIP: [pr-feature][startup][shaders] Preload: keep done marks across a translator change (DARNER_PRELOAD_KEEP_MARKS, off by default) #264
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:up-preload-keep-marks"
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 game run. Branch
up-preload-keep-marks, one commit (f55e9b581) onmainf3840d73d.Refs #128
Contributor role (optional)
What it changes
darner-shader),play::clear_stale_indeletespipelines/warm-done.txttogether with the translated shaders and the host pipeline library (#128, point 1; first described in blazecoding2009's comment). The next preload then makes every pipeline again. But the marks in that file are named by the translated code, the root signature and the graphics state (known::names), under a fingerprint that does not include the translator (known::made_for: driver and static sampler order). So a pipeline whose translation did not change has the same name and the same mark, and the mark is still true. A pipeline whose translation changed has a new name, has no mark, and is made.DARNER_PRELOAD_KEEP_MARKS=1the translator-change cleanup keepswarm-done.txt. Everything else is deleted as before (shaders/,adapters,warm-bad.txt,host-pipelines.*).warm-bad.txtis keyed with the translator, so it is not worth keeping.DARNER_WARM_SHARED=1: there a mark means "stored inhost-pipelines.bin", and that file is deleted on the change, so the mark would be wrong.docs/findings.md.How it was tested
Tested revision:
f55e9b581(onf3840d73d).Commands and results:
cargo testof theplay::testsmodule (58 tests): 58 passed. This includes the new testdone_marks_survive_a_translator_change_only_when_askedand the existing stale-cache test, changed to passkeep_marks = false.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 nothing was timed with it on. Checked by unit tests of the file handling only.
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 game start after a translator change with the switch on.
Shader wave sizes tested, when relevant: not relevant (no shader change).
Hardware dependence: see Spec dependence.
Coverage gaps:
DARNER_WARM_SHARED=1turned on later with a new library present: not guarded, same as main's behaviour for a same-translator cache.Spec dependence
Checklist
main.docs/asset-policy.md(cargo xtask policy: ok).Checked for overlap
play.rs, a mark shared acrossdarner.execopies with the same translator).translate.rs,stamps.rs,shader_cache.rs): no shared files.clear_stale_*; I expect only trivial textual conflicts inREADME.md(switch table) anddocs/findings.md(appended lines).play.rsand the translator-change handling; not compared line by line. Possible conflict, to be checked on rebase.play.rs. WIP posted with conflicts as is; to be rebased before WIP comes off.This change was made with AI assistance (Claude Code).
Data from a real translator change on one PC. This is not a test of this branch (I did not build it).
ec4f8a0d...->f49064c2...), RTX 5080 Laptop GPU,driver 621.47, the same
darner.exepath, default cache folder. The first start's cleanup deletedwarm-done.txt, and the first-start preload (preload --all) then took 14.8 min.warm-done.txtheld 76,578 marks underc73a7c6f5f79eba9for this path. After the new preload there are 76,582 marks under the same fingerprint. 54,202 names
(70.8 %) are in both lists, and 22,380 are new.
still true.
path was kept, so they were probably quick cache hits, and the time this saves may be much smaller than
71 %. The marks do not cover the shader translations, which the cleanup also deleted.
Review of
f55e9b58(read only, not built or run). WIP draft: no code findings that block it.Checked:
keep_marks = falseeverywhere, and the existing stale-cache test now passes it explicitly.warm-done.txtsurvives.shaders/,adapters,warm-bad.txtandhost-pipelines.*are still deleted.keeps_marksrefusesDARNER_WARM_SHARED=1. That's right: a shared mark means "stored in the library", and that file is deleted.mark_fingerprint:made_for+ program + card) has no translator in it, and the names come from the new translation. So a changed pipeline gets a new name and is made, and an unchanged one keeps its mark.KEPT, and the test checks!stale_switch(KEEP_MARKS), so it isn't cleared like the one-shotDARNER_PRELOAD*switches.Points:
warm-done.txtonly grows while the switch stays on: every translator change adds the new names (about 22k, ~1 MB here) and nothing removes the old ones. Consider rewriting the file with only the current names when a preload finishes, or note it in the README row.--all-featuresclippy,cargo test --workspace --locked) haven't run yet.It merges cleanly with main (
f3840d73), #153, #215 and #228. With #140, #266 and #267 it conflicts only indocs/findings.mdand the README switch table, both trivial.No testcall-ok while it's a draft. It can carry one once a run is in. It deletes nothing that main keeps.