[pr-fix][startup][shaders] Save partial preload work when a thread fails to start #234
Loading…
Reference in a new issue
No description provided.
Delete branch "andrewpozdnakov7-jpg/Darner:port/4410-save-partial-warm-outputs"
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?
Contributor role (optional)
What it changes
The two preload library paths return a thread startup error before their final save. Save the work already completed by the joined workers first. In into_library, keep the startup error when both startup and the final save fail, and keep reporting a save-only failure.
Restores locally saved VIctory-NVIDIA work from December 1, 2026. Previous review: CodeFloe #388. Adapted by andrewpozdnakov7-jpg (GitHub profile).
For shared warm runs, append completion marks only after the library save succeeds. If a checkpoint fails, keep that batch queued for the next save. The last checkpoint reports a save failure and still gives a worker startup failure priority when both fail.
How it was tested
6b843c0onf3840d7.5f1db98: a Windows fixture injected a rejected library save and then allowed a retry. Main wrote both completion marks after the rejection. The updated path wrote zero, retained both entries, and wrote all three marks after retrying with one additional pipeline. The focused Cargo type check, asset policy, and whitespace check passed.88f546b: the worker count balances on a rejected spawn and both preload paths report secondary save errors. A Windows fixture checked the dropped closure and the selected error. The focused Cargo type check covers the new error-precedence unit test. Asset policy passed. The independent Windows checks at6b843c0are in issuecomment-864560.88f546b: both workspace Clippy gates and asset policy passed. Cargo reported 149 app tests passed and one ignored, plus the cache_paths, census and picked_folders integration cases. Review resultChecklist
Checked for overlap
Independent Windows build, gate, and code-read review of
6b843c021(based onmainf3840d73d). Not run in-game.Environment
x86_64-pc-windows-msvc), MSVC 19.44.35230.Measured results
cargo clippy --workspace --all-targets --locked -- -D warnings): PASScargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASScargo xtask policy: PASS (asset policy: 555 files ok)cargo test --locked -p darner: PASS (148 passed; 0 failed; 1 ignoredunit tests;2 + 2 + 8integration tests all passed).Code-read audit
main(apps/darner/src/warm.rs:444-470and:574-600):std::thread::scope(...)?;joins already-spawned workers before returning a later spawn error, and?exited without runningflush()/known::keep_preloaded_library(), losing completed pipelines. Running them after the scope joins (safe even when 0 pipelines were added:library.rs:1512returnsOk(0)) solves the root cause cleanly.aliveleak on worker spawn failure (warm.rs:578-580):alive.fetch_add(1, Ordering::AcqRel)runs beforespawn_library_worker, whileWorkerGone(alive)is created inside the closure. It does not hangdarner-pipelines-savetoday only because the saver is spawned after the worker loop (so?skips spawning it), but constructinglet gone = WorkerGone(alive);beforespawn_library_workerand movinggoneinto the closure avoids leakingaliveif the spawn order ever changes.warm.rs:601):workers.and(saved)?keeps the startup error as intended, but ifkeep_preloaded_library()also fails (for examplecheck_preload_saveatcrates/darner-gpu/src/pipeline/library.rs:1332-1340, which returnsErrwithout logging), that save failure is silently dropped. Logginge_savewhenworkers.is_err()would preserve visibility.apps/darner/src/warm.rsfor either partial-save path.Verdict: PASS (with minor notes above).
AI-assisted: yes (Gemini 4 Neon).
Thanks for the independent Windows checks on
6b843c0, @lewis499. The branch now also covers both notes in88f546b. The worker guard is captured before the spawn so rejecting the closure decrements the count. If startup and save both fail, Darner reports the save error and still returns the original startup error.I verified the rejected-closure and error-priority cases with a Windows fixture, added an in-tree error-precedence test, and ran the focused Cargo type check and asset policy on the updated code.
PASS
Follow-up verification of
88f546b8206f9dd2a3ad275801775ab47aca6aed(basef3840d73d3504c30218debfbc8795b9225447317).Environment
Windows 11 Pro 26H2 build 26300.10075; Intel Core i9-14900K; NVIDIA RTX A2000 12 GB (driver 621.47); Rust 1.98.1 x86_64-pc-windows-msvc; MSVC 19.44.35230.
Measured results
cargo clippy --workspace --all-targets --locked -- -D warnings: PASS.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: PASS.cargo xtask policy: PASS (555 files ok).cargo test --locked -p darner: 149 passed, 0 failed, 1 ignored; integration suites passed 2cache_paths, 2census, and 8picked_folderstests.Code-read audit
fill_libraryjoins scoped workers before the finalflush; on flush failure it restores the taken marks topending(apps/darner/src/warm.rs:434-447,450-480).WorkerGoneis created before spawning and moved into the closure, so a rejected spawn drops the guard and balancesalive; the saver waits on that count (:535-542,590-617).finish_library_workersreports a save failure when a worker error already exists, preserves the worker error as the returned error in that case, and propagates a save-only failure. The focused regression test covers both error combinations (:527-532,905-911).Not run in-game.
AI-assisted: yes (GitHub Copilot, Auto mode).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.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.