Skip to content

GPU: keep the latest pipeline library save across restart - #211

Open
avt0m4t48 wants to merge 1 commit into
fxceless:mainfrom
avt0m4t48:fix/pipeline-cache-restart-order
Open

avt0m4t48 wants to merge 1 commit into
fxceless:mainfrom
avt0m4t48:fix/pipeline-cache-restart-order

Conversation

@avt0m4t48

Copy link
Copy Markdown

Refs #27 and #164. If one save falls back to host-pipelines.next and the next save can replace host-pipelines.bin directly, startup promotes the older pending file over the newer save. Keep publishing to the pending path while it exists. Startup can then promote the latest successful save.

Both source-built filesystem tests pass on native Windows in mapped and buffered modes. The Linux buffered-mode probe reproduced rollback on main, #147 and #164. The control where both saves must use the fallback passes before and after the change. Windows tests

The ordering guarantee covers successive saves. #164 adds separate same-process save serialization. Cross-process coordination and application startup performance were outside these tests. AI-assisted using Codex.

HailLucifer666 added a commit to HailLucifer666/victory-fork that referenced this pull request Nov 25, 2026
…o write

THE BUG. save() cleared both dirty flags before either write landed: it
stored 0 into the library's added count before replace_library() renamed the
serialised bytes into place, and it cleared the early list's changed flag
before write_atomically() wrote that list. When a rename failed (the target
held by a folder, the file held open, a system refusing to replace a mapped
file), the retry found nothing dirty and returned: the pipelines this run had
added, and the title pipelines it had noted for an early start, were lost with
the process.

WHY NOT HYPOTHETICAL. avt0m4t48 reproduced it on baf1154 and on main
(2119b0e): with the obstruction removed, a second save(true) returned without
writing the pending data. Both destinations replace_library() tries have to
fail for the library to be lost, but the early list is one write and fails on
its own.

THE FIX. publish() puts the library and the early list in place and clears
the dirty state for exactly what reached the disk: the added count is
acknowledged with fetch_sub(snapshot) only after the rename succeeds, so
stores that arrived while the library was being serialised stay pending, and
a write that did not land sets the early list's flag again. A serialise
failure restores it too.

SCOPE. The rest of the save path is unchanged: the same lock, the same unique
staging file, the same order. The startup ordering change in fxceless#211 is not
part of this.

Three tests, three probes: acknowledging the stores before the rename,
clearing every store instead of the snapshot, and dropping the early-list
restore each fail the test named for it.

Co-authored-by: avt0m4t48 <avt0m4t48@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant