[bug][startup][shaders] Preload window opens again on every start, and starts over, after a preload was stopped or the exe changed #128
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
What happened
The preload window opens on start and preloads everything again, even though part of it (or all of it) was already preloaded in an earlier start.
How to see it:
Same thing after a new build or an update: the window opens again, because the "preload is done" mark belongs to one exact darner.exe.
Not checked: whether a preload that runs to the end and finishes without error opens the window again on the next start of the same exe. By the code it should not.
GPU and driver
NVIDIA GeForce RTX 2070 SUPER 8 GB (Turing), driver 621.40, Resizable BAR off.
CPU, RAM and Windows version
AMD Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider Preview build 26320.
Darner release or commit
Code read at
trustno1/main57dea7f23. The behaviour was seen in use on our own builds on top of main, not in a measured test; the cause below is read from the code only.Settings
Series S, DLSS Performance.
DARNER_FIRST_START_PRELOAD=0stops the window from opening on start.Logs
No log attached: this is about when the window opens and what a stopped preload keeps, which is easiest to follow in the code below. We can attach a play log of a start-stop-start sequence if you want one.
What the code does (read from main, not a confirmed cause for every case)
apps/darner/src/main.rs:690whenplay::preload_needed(apps/darner/src/play.rs:2304) finds no markwarmed/<first 16 hex of blake3 of darner.exe>(play.rs:2247), or a pipeline book with no host pipeline library (play.rs:2325).finish_preload(play.rs:765-776), and only if the final library save had nothing pending (crates/darner-gpu/src/pipeline/library.rs:1278-1291).finish_preload(play.rs:751-759), and the window kills the whole preload process tree (apps/darner/src/preload_ui.rs:183). A failed child or a failed save also leaves no mark. Every new exe (update or local build) has a new hash. So the window comes back on every start until one preload finishes in full.translate::precompile(apps/darner/src/translate.rs:567) lists and hashes every shader file on every run and calls the translator for each one (translate.rs:602-606). We did not read whether the translator itself returns early for a shader it has already stored.warm::into_library(apps/darner/src/warm.rs:511-556) makes every early and slow pipeline again and saves the library once at the end (warm.rs:551,crates/darner-gpu/src/pipeline/known.rs:544). "Play now" during that step keeps nothing from it.warm::runresumes, through thewarm-done.txtmarks (warm.rs:204-236,warm.rs:293-296).warm.rs:200,warm.rs:396-408). A new install folder or a driver update starts over.failed_in_a_row(warm.rs:53) goes back to 0 after any child that made one pipeline. That may keep a preload that fails once the title is up in a loop. See TheBen's comment on #70 (#70 (comment): with the title up, preload children exit 0xffffffff and are retried); PR #125 captures those children's stderr.Are you working on a fix?
Yes, I'm on it (Jesper-A). No branch or draft PR yet.
Plan, as separate small PRs; each new behaviour off by default behind its own
DARNER_*switch, and no default changes without asking you:precompilealready did for this translator.into_libraryprogress as it goes, so "Play now" keeps what was made.If you already work on this or would rather have it done differently, tell me and I will stop.
Spec dependence
Likely general: the logic is in the launcher and does not depend on the GPU. Seen on RTX 2070 SUPER 8 GB, Ryzen 7 5800X, 32 GB, Windows 11. Not checked on other GPUs, Series X, or Linux/Proton.
Related: issue #70, PR #125.
Drafted with AI assistance (Claude Code).
Same problem as this issue ("starts over"), with two causes that are not in the list above. Code read at
main57dea7f236; the timings are from one laptop.Hardware and build: Ryzen 7 8845HS (8 cores, 16 threads), 32 GB, RTX 4050 Laptop 6 GB, driver 621.24, Windows 11 build 26300. Series S, DLSS Quality. 10 preload processes (the default here).
1. A translator change deletes the done marks and the library, although both are named by content
Seen:
translator.txtwas rewritten,warm-done.txt,warm-bad.txtandpipelines\adapterswere created anew, and the preload had 76,725 pipelines to make. It took 47 minutes.translator.txtnot rewritten): the preload window was done in about 80 s. Every mark was reused.target\diag: "0 made before by what is in them", 76,725 to make again. That is your point 4 (the exe path in the marks), seen here.Read from the code, not confirmed by a test:
clear_stale_in(apps/darner/src/play.rs:653) callsclear_stale_artifacts_in(play.rs:683), which removesshaders\and, inpipelines\, whatis_stale_pipeline_entrynames:adapters,warm-done.txt,warm-bad.txtandhost-pipelines.*(play.rs:671-676).apps/darner/src/warm.rs:196-200,known::made_for, and the testmarks_by_name_follow_program_card_and_driver_only(warm.rs:817). The comment atwarm.rs:196-199says a change of the translator makes again only the pipelines whose translated code or root signature it changed. Withwarm-done.txtdeleted, all of them are made again.library::name), so the entries of pipelines the new translator left as they were would still load.warm-bad.txtalready carries the translator in its fingerprint (known::fingerprint), andbad_keyspasses over lines of another one.Not measured: how many pipelines keep their name across a typical translator change. If it is few, keeping the marks gains little. Not checked either: whether anything removes library entries that are no longer asked for, if the file is kept.
2. The window's time left starts about 3.5 times too long
Seen: a preload of 76,725 printed
200 of 76725, 56 sand1200 of 76725, 199 s, and the window showed about 174 minutes left. The same count took 47 minutes on this PC that morning. (Not like for like: the two passes ran from different exe paths, and the morning one may have found some pipelines in the driver's cache.)Read from the code:
warm.rs:230), and those are the slow ones.slow-pipelines.txthere names 4,695 pipelines of 1 s or more, 20,428 s in all, against about 28,400 worker-seconds for the whole 47-minute pass. (Some of those times were noted in play, so the share is rough.)time_leftis a straight line from the count so far (apps/darner/src/preload_ui.rs:118-129).An estimate of three hours is what makes one press "Play now", which leads into the loop this issue describes. The slow list is on disk before the pass starts, so the estimate could weigh by it.
Related, and deliberate as far as I can tell: the window always passes
--all(preload_ui.rs:161), soDARNER_PRELOAD_USED_MINapplies only todarner preloadrun by hand. The README row for that switch reads as if it applied to every preload.Drafted with AI assistance (Claude Code).