GPU: replay pending descriptors before publishing the host heap #365
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/365"
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?
Imported from Marvisak/VIctory. Originally posted by FIocker on 2026-11-24T02:37:30Z.
Publish the host heap only after replaying the descriptors queued before first use. Previously the OnceLock was initialized before the pending loop ran. A concurrent caller could take the fast path, bind the heap, and proceed before its queued descriptor writes became visible.
Replay the queued writes inside the OnceLock initializer while holding the existing pending mutex. The fast path remains unchanged after initialization. This is independent of #52, which covers heap lifetime during descriptor mirroring.
On Windows WARP,
cargo test --locked -p victory-gpu --features diagnostics -- --test-threads=1passed 45 tests with one existing ignored test. The staged asset policy and diff checks passed.Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T03:58:11Z.
Thanks @FIocker for this change. I tested head
a4e7f1d004bff927c205981c623142c8e7dbb4a4with:Result: 5 passed, 0 failed (41 filtered out). This exercised descriptor heap slot allocation/release, heap start placement, and descriptor-view lifetime across resource destruction and copies. The filtered tests do not directly stress concurrent first-use publication, and I did not run the broader WARP suite described in the PR body.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T07:42:37Z.
Review: APPROVED
Tested
a4e7f1don Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (264 passed, 0 failed), andcargo test -p victory-gpu --features diagnostics --libpasses (45, 1 ignored).OnceLock::get_or_initpublished the heap before thependingreplay, so a recorder on theget()fast path could bind a heap whose queued slots were still unwritten. Replaying inside the initializer meansget()only ever sees a fully mirrored heap, because OnceLock makes other callers wait until the closure returns.HostHeap::mirrorreads the title's descriptor and writes the host slot. It doesn't go back throughHeap::host, so running it insideget_or_initcan't recurse into the same OnceLock.increment(kind)wereNone, the OnceLock now storesNonewhere it used to store the heap. That never happens for the four real heap kinds.No issues found.
AI-assisted (Claude Code).