Pipeline library: unrelated names can queue behind one slow cached load #307

Closed
opened 2026-12-03 10:14:46 +00:00 by github-bot · 2 comments
Owner

@⁠ArturoWolff on GitHub · 2026-12-03 10:11 UTC · original

same_name on main at 842767a8e intentionally serializes simultaneous loads of one D3D12 entry. The 64-lock implementation can also serialize loads of different entries for the full duration of the slower driver call.

Game-free repro on this revision: I compiled the actual same_name function into a two-thread Rust test. Hold the guard for 00000000000000000000000000000000. Signal a second thread to acquire 00000000000000000000000000000022 and send an acknowledgement while the first guard is held. Both synthetic names hash to slot 0; no acknowledgement arrives within 500 ms. Releasing the first guard lets the second thread proceed. With a private exact-name gate the different-name acknowledgement arrives while the first guard is held, while a second request for the same name waits until release. No GPU or game files are required for this test.

Why it may matter: In one warm-cache first-movie run of a related receiver on an RTX 4060 8 GB / GE-Proton11-14, one successful library load reported 15,924 ms before the call, zero wait for a save, and 4 ms in the call. A different name on the same stripe finished a 16,124 ms driver call just before it. Those timings are from the receiver, not a retail measurement on XMem main; the pre-call timer is not a direct record of which thread held the mutex. In a four-launch stock/candidate comparison the long wait did not recur. Both builds reached loading artwork. No gameplay FPS gain established.

I would keep same-entry exclusion. To decide whether changing the lock is worthwhile here, the useful discriminator during a slow load is whether the waiter and holder on that stripe actually have the same name, measured separately from the optional global load limit. No need to disable pipeline caching or change rendering settings to test it.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Astra High).

**@⁠ArturoWolff** on GitHub · 2026-12-03 10:11 UTC · [original](https://github.com/lobomfz/VIctory-xmem/issues/307) `same_name` on [main at `842767a8e`](https://github.com/lobomfz/VIctory-xmem/blob/842767a8e4a51ba3e342355176dd91e7d4d5147b/crates/victory-gpu/src/pipeline/library.rs#L430-L443) intentionally serializes simultaneous loads of one D3D12 entry. The 64-lock implementation can also serialize loads of *different* entries for the full duration of the slower driver call. **Game-free repro on this revision:** I compiled the actual `same_name` function into a two-thread Rust test. Hold the guard for `00000000000000000000000000000000`. Signal a second thread to acquire `00000000000000000000000000000022` and send an acknowledgement while the first guard is held. Both synthetic names hash to slot 0; no acknowledgement arrives within 500 ms. Releasing the first guard lets the second thread proceed. With a private exact-name gate the different-name acknowledgement arrives while the first guard is held, while a second request for the *same* name waits until release. No GPU or game files are required for this test. **Why it may matter:** In one warm-cache first-movie run of a related receiver on an RTX 4060 8 GB / GE-Proton11-14, one successful library load reported 15,924 ms before the call, zero wait for a save, and 4 ms in the call. A different name on the same stripe finished a 16,124 ms driver call just before it. Those timings are from the receiver, not a retail measurement on XMem main; the pre-call timer is not a direct record of which thread held the mutex. In a four-launch stock/candidate comparison the long wait did not recur. Both builds reached loading artwork. No gameplay FPS gain established. I would keep same-entry exclusion. To decide whether changing the lock is worthwhile here, the useful discriminator during a slow load is whether the waiter and holder on that stripe actually have the same name, measured separately from the optional global load limit. No need to disable pipeline caching or change rendering settings to test it. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Astra High).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 10:14:46 +00:00
Author
Owner

@⁠wrz1911 on GitHub · 2026-12-03 14:14 UTC · original

Might be related to what we see during warm: above 12 jobs on a 24-thread CPU every worker stops making progress (45 s "unresponsive" lines, 0 done), no GPU errors in dmesg. If the 64-lock serializes different names for the full driver call, oversubscribed workers could pile up behind it. Details: #325.

**@⁠wrz1911** on GitHub · 2026-12-03 14:14 UTC · [original](https://github.com/lobomfz/VIctory-xmem/issues/307#issuecomment-7381107305) Might be related to what we see during warm: above 12 jobs on a 24-thread CPU every worker stops making progress (45 s "unresponsive" lines, 0 done), no GPU errors in dmesg. If the 64-lock serializes different names for the full driver call, oversubscribed workers could pile up behind it. Details: #325.
Author
Owner

@⁠ArturoWolff on GitHub · 2026-12-03 15:03 UTC · original

@⁠wrz1911 I checked the process boundary on the revision you tested. warm starts a separate victory.exe warm --these … process for each batch. The 64 same_name mutexes are Rust statics, so each process has its own set. Two threads inside one worker can contend there; workers in different processes cannot queue behind one another on that mutex. The different-name collision in #307 is real, but it doesn't directly explain the all-worker stall in #325. I haven't reproduced the Radeon stall.

One useful discriminator at the working and failing job counts: for each child PID, record whether the parent received no at, at but no matching made, or made followed by silence before its timeout. The watchdog resets on both records, and the child explicitly flushes them. warm-done.txt alone doesn't distinguish a worker that never reached its first item from one that started an item but didn't return. No pipeline names or game data are needed for those counts.

AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Astra High).

**@⁠ArturoWolff** on GitHub · 2026-12-03 15:03 UTC · [original](https://github.com/lobomfz/VIctory-xmem/issues/307#issuecomment-7382498089) @⁠wrz1911 I checked the process boundary on the revision you tested. [`warm` starts a separate `victory.exe warm --these …` process for each batch](https://github.com/lobomfz/VIctory-xmem/blob/842767a8e4a51ba3e342355176dd91e7d4d5147b/apps/victory/src/warm.rs#L406-L419). The [64 `same_name` mutexes](https://github.com/lobomfz/VIctory-xmem/blob/842767a8e4a51ba3e342355176dd91e7d4d5147b/crates/victory-gpu/src/pipeline/library.rs#L430-L443) are Rust statics, so each process has its own set. Two threads inside one worker can contend there; workers in different processes **cannot queue behind one another on that mutex**. The different-name collision in #307 is real, but it doesn't directly explain the all-worker stall in #325. I haven't reproduced the Radeon stall. One useful discriminator at the working and failing job counts: for each child PID, record whether the parent received **no `at`**, **`at` but no matching `made`**, or **`made` followed by silence** before its timeout. The [watchdog resets on both records](https://github.com/lobomfz/VIctory-xmem/blob/842767a8e4a51ba3e342355176dd91e7d4d5147b/apps/victory/src/warm.rs#L473-L489), and the [child explicitly flushes them](https://github.com/lobomfz/VIctory-xmem/blob/842767a8e4a51ba3e342355176dd91e7d4d5147b/apps/victory/src/warm.rs#L530-L542). `warm-done.txt` alone doesn't distinguish a worker that never reached its first item from one that started an item but didn't return. No pipeline names or game data are needed for those counts. AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Astra High).
This discussion has been locked. Commenting is limited to contributors.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/lobomfz--VIctory-xmem#307
No description provided.