[bug] Unsignaled CrossQueueBarrier: a refused submission loses its fence signals and bottom-of-pipe value writes #80

Open
opened 2026-11-26 13:44:12 +00:00 by AeroUp · 10 comments
AeroUp commented 2026-11-26 13:44:12 +00:00 (Migrated from github.com)
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AeroUp on 2026-11-26T13:44:12Z.


Labels: bug, urgent — written here because this account has no label permission on the repository.

Summary

When a pass cannot be encoded, submit_passes (crates/victory-metal/src/gfx.rs) returns before cb.commit(). The entire submission is dropped — its encodeSignalEvent calls for the title's fences and its bottom-of-pipe value writes. native/title.rs then logs a piece of title work was refused and consumes the held item, so nothing replays those writes.

The title detects exactly that and dies: its crash log has Unsignaled CrossQueueBarrier, and the log shows a queue held on a memory value that never arrives:

WARN victory_gpu::native::title: a piece of title work was refused error=no render encoder: 0 colour [], depth None, 1 draws
WARN victory_gpu::native::glue: work held for a wait that does not hold:
  ["fence 0x…: signal of 3 queued 4.8s ago, GPU at 2",
   "queue 0x…: 2 held, head for 5.6s, waits ["0x18437f9e8 cmp 7 ref 0x749 now Some(0)"]"]
… then 0xc0000005 at image+0x55e56f8

cmp 7 is D3D12_COMPARISON_FUNC_GREATER_EQUAL, ref 0x749 ≈ the frame number: this is the per-frame cross-queue semaphore the four compute queues wait on at the start of each list.

Two contributing shapes

  1. A draw with no render targets (0 colour [], depth None) — D3D12 makes that a no-op; Metal cannot create an encoder without an attachment, so it was refused. It should be skipped.
  2. Any other encode failure dropped the passes after it too, so one bad early pass could empty the frame.

Proposal

PR #78: the command buffer always commits (signals and value writes go out), the failing pass is dropped and named, passes after it still run, and an empty draw pass is skipped as the no-op it is. The error now carries the attachments' sizes and formats so a future no render encoder says what Metal disliked.

Not claimed

This removes a demonstrated way the barrier write is lost. Whether a cross-queue cycle can also deadlock (two queues each waiting on the other) is not proven either way; hold.rs's safety valve logs it but does not break it.

Update: a live sample during the stall

Sampling the process while it is stalled (not after) shows the title's main thread blocked in

victory_hle::host_posix::WaitForSingleObject
  → victory_platform::sync::Semaphore::wait
    → pthread_cond_wait

with every other title thread parked on Event::wait / Semaphore::wait, and no host frame running (nothing in victory_gpu, glue or Metal). So the frame is not lost in our encoder and the GPU is not behind: every command buffer completes. The main thread waits for a semaphore a producer thread should release, and that producer is parked on a GPU event.

Two variants are seen across runs:

  1. A held value wait: work held for a wait that does not hold names the address (0x18437f990, GREATER_EQUAL, ref = frame). Our value-write trace shows the title does record the write (value 3649), so the fill is either never submitted or its queue is itself parked. Breaking the wait after 2 s makes the frame run with inputs that are not ready and the title reads 0x7c007c00… garbage.
  2. No held wait at all: presents stop, and 8 s later the main thread is already inside the title's fatal block, with the same semaphore wait above.

VICTORY_TRACE_HOLD=1 now logs each value write's list pointer and each submission's queue and list pointers, so the two cases can be told apart from one run.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6627970255 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80). Originally posted by [AeroUp](https://github.com/AeroUp) on 2026-11-26T13:44:12Z. --- Labels: `bug`, `urgent` — written here because this account has no label permission on the repository. ## Summary When a pass cannot be encoded, `submit_passes` (`crates/victory-metal/src/gfx.rs`) returns before `cb.commit()`. The **entire submission** is dropped — its `encodeSignalEvent` calls for the title's fences and its bottom-of-pipe value writes. `native/title.rs` then logs `a piece of title work was refused` and consumes the held item, so nothing replays those writes. The title detects exactly that and dies: its crash log has `Unsignaled CrossQueueBarrier`, and the log shows a queue held on a memory value that never arrives: ``` WARN victory_gpu::native::title: a piece of title work was refused error=no render encoder: 0 colour [], depth None, 1 draws WARN victory_gpu::native::glue: work held for a wait that does not hold: ["fence 0x…: signal of 3 queued 4.8s ago, GPU at 2", "queue 0x…: 2 held, head for 5.6s, waits ["0x18437f9e8 cmp 7 ref 0x749 now Some(0)"]"] … then 0xc0000005 at image+0x55e56f8 ``` `cmp 7` is `D3D12_COMPARISON_FUNC_GREATER_EQUAL`, `ref 0x749` ≈ the frame number: this is the per-frame cross-queue semaphore the four compute queues wait on at the start of each list. ## Two contributing shapes 1. A draw with **no render targets** (`0 colour [], depth None`) — D3D12 makes that a no-op; Metal cannot create an encoder without an attachment, so it was refused. It should be skipped. 2. Any other encode failure dropped the passes after it too, so one bad early pass could empty the frame. ## Proposal PR #78: the command buffer always commits (signals and value writes go out), the failing pass is dropped and named, passes after it still run, and an empty draw pass is skipped as the no-op it is. The error now carries the attachments' sizes and formats so a future `no render encoder` says what Metal disliked. ## Not claimed This removes a demonstrated way the barrier write is lost. Whether a *cross-queue cycle* can also deadlock (two queues each waiting on the other) is not proven either way; `hold.rs`'s safety valve logs it but does not break it. ## Update: a live sample during the stall Sampling the process *while* it is stalled (not after) shows the title's main thread blocked in ``` victory_hle::host_posix::WaitForSingleObject → victory_platform::sync::Semaphore::wait → pthread_cond_wait ``` with every other title thread parked on `Event::wait` / `Semaphore::wait`, and **no host frame running** (nothing in `victory_gpu`, `glue` or Metal). So the frame is not lost in our encoder and the GPU is not behind: every command buffer completes. The main thread waits for a semaphore a producer thread should release, and that producer is parked on a GPU event. Two variants are seen across runs: 1. **A held value wait**: `work held for a wait that does not hold` names the address (`0x18437f990`, `GREATER_EQUAL`, ref = frame). Our value-write trace shows the title *does* record the write (`value 3649`), so the fill is either never submitted or its queue is itself parked. Breaking the wait after 2 s makes the frame run with inputs that are not ready and the title reads `0x7c007c00…` garbage. 2. **No held wait at all**: presents stop, and 8 s later the main thread is already inside the title's fatal block, with the same semaphore wait above. `VICTORY_TRACE_HOLD=1` now logs each value write's list pointer and each submission's queue and list pointers, so the two cases can be told apart from one run.
LakshanSivakumar commented 2026-11-26 15:56:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T15:56:43Z.


Status: PR #78 keeps the refused pass's fence signals and bottom-of-pipe writes. It has changes requested and is not merged. Related to the story-load investigation in #15, though GPU compute writes are now ruled out as the cause of the prologue crash. Needed: updated #78.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7196964090 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7196964090). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T15:56:43Z. --- Status: PR #78 keeps the refused pass's fence signals and bottom-of-pipe writes. It has changes requested and is not merged. Related to the story-load investigation in #15, though GPU compute writes are now ruled out as the cause of the prologue crash. Needed: updated #78.
LakshanSivakumar commented 2026-11-26 17:13:23 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T17:13:23Z.


Fixed on our side in c3de092e (branch fix/prologue-crash): a command buffer the GPU fails still signals its fences, order event and value writes, from the CPU, so the title never waits on a barrier that will never come. It lands on main once the prologue runs confirm it. VICTORY_TRACE_GPU_FAILS=1 (2a42dc73) names failed, slow and in-flight command buffers.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7198674523 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7198674523). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T17:13:23Z. --- Fixed on our side in c3de092e (branch `fix/prologue-crash`): a command buffer the GPU fails still signals its fences, order event and value writes, from the CPU, so the title never waits on a barrier that will never come. It lands on main once the prologue runs confirm it. `VICTORY_TRACE_GPU_FAILS=1` (2a42dc73) names failed, slow and in-flight command buffers.
LakshanSivakumar commented 2026-11-26 18:10:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T18:10:25Z.


This is on main now: a failed GPU command buffer still signals its fences, so the title no longer waits on a barrier that never comes. Please report here if you still see Unsignaled CrossQueueBarrier on current main.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7200138479 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7200138479). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T18:10:25Z. --- This is on main now: a failed GPU command buffer still signals its fences, so the title no longer waits on a barrier that never comes. Please report here if you still see `Unsignaled CrossQueueBarrier` on current main.
AeroUp commented 2026-11-26 18:24:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AeroUp on 2026-11-26T18:24:44Z.


Still there on a branch that has your failed-command-buffer fix merged (ce35cbc, via Merge upstream/main 5ea0504), M3 Pro 18 GB, --console series-s:

  • The title's own crash log still writes Unsignaled CrossQueueBarrier: 252fa538 (same id as the first report), frame 1721, 3m38s in; the unhandled fault is still 0xc0000005 at image+0x55e56f8.
  • No metal: command buffer failed line and no paid ... fence signals ... on the CPU line in the whole run, so nothing took the recovery path.
  • The new fence dump at the stall says the fence is paid: fence 0x…: completed 1790, requested 1790 (7.2s ago), no held queues, no command buffer in flight. So the value the barrier waits for is not a fence value any more.
  • What it does look like: a bottom-of-pipe value write to title memory. With VICTORY_TRACE_HOLD=1 the last one before an earlier stall was a bottom-of-pipe value write list=0x… at=0x18437f9e8 value=3286 bytes=8, and that list never appears in any a submission ... pointers=[…] line. Those 8 bytes are written as eight 1-byte Cmd::Fills, so they ride the piece's blit passes; a piece that is refused before submission still loses them.

So on our side the remaining hole is the piece path, not the completion path: a fill whose piece never reaches submit_passes (or a list that is never executed) still loses the write silently. If your prologue runs show the same, the next fix is probably to hold value writes outside the piece (a queue-level tail that is always committed), the way the fence signals are.

I will report back after testing whether forcing every list with a value write to be submitted changes it.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7200432333 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7200432333). Originally posted by [AeroUp](https://github.com/AeroUp) on 2026-11-26T18:24:44Z. --- Still there on a branch that has your failed-command-buffer fix merged (`ce35cbc`, via `Merge upstream/main` 5ea0504), M3 Pro 18 GB, `--console series-s`: - The title's own crash log still writes `Unsignaled CrossQueueBarrier: 252fa538` (same id as the first report), frame 1721, 3m38s in; the unhandled fault is still `0xc0000005 at image+0x55e56f8`. - No `metal: command buffer failed` line and no `paid ... fence signals ... on the CPU` line in the whole run, so nothing took the recovery path. - The new fence dump at the stall says the fence *is* paid: `fence 0x…: completed 1790, requested 1790 (7.2s ago)`, no held queues, no command buffer in flight. So the value the barrier waits for is not a fence value any more. - What it does look like: a bottom-of-pipe **value write** to title memory. With `VICTORY_TRACE_HOLD=1` the last one before an earlier stall was `a bottom-of-pipe value write list=0x… at=0x18437f9e8 value=3286 bytes=8`, and that list never appears in any `a submission ... pointers=[…]` line. Those 8 bytes are written as eight 1-byte `Cmd::Fill`s, so they ride the piece's blit passes; a piece that is refused before submission still loses them. So on our side the remaining hole is the piece path, not the completion path: a fill whose piece never reaches `submit_passes` (or a list that is never executed) still loses the write silently. If your prologue runs show the same, the next fix is probably to hold value writes outside the piece (a queue-level tail that is always committed), the way the fence signals are. I will report back after testing whether forcing every list with a value write to be submitted changes it.
LakshanSivakumar commented 2026-11-26 22:52:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T22:52:56Z.


@AeroUp Thanks. Could you retry on current main (49b5521b)? Command buffers lost to GPU timeouts now still pay their fence signals, and on 18 GB please try VICTORY_METAL_RESIDENCY_SETS=heap. If Unsignaled CrossQueueBarrier still shows up, please attach the log.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7205065336 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7205065336). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T22:52:56Z. --- @AeroUp Thanks. Could you retry on current main (49b5521b)? Command buffers lost to GPU timeouts now still pay their fence signals, and on 18 GB please try `VICTORY_METAL_RESIDENCY_SETS=heap`. If `Unsignaled CrossQueueBarrier` still shows up, please attach the log.
LakshanSivakumar commented 2026-11-27 05:39:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-27T05:39:18Z.


Has anyone seen the unsignaled CrossQueueBarrier on current main? The fix landed some time ago and the last report was from an older branch. If nobody sees it in the next few days this will be closed.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7210821523 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7210821523). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-27T05:39:18Z. --- Has anyone seen the unsignaled CrossQueueBarrier on current main? The fix landed some time ago and the last report was from an older branch. If nobody sees it in the next few days this will be closed.
AnastasisKon commented 2026-11-27 16:21:55 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-27T16:21:55Z.


/claim

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7223172648 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7223172648). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-27T16:21:55Z. --- /claim
github-actions[bot] commented 2026-11-27 16:22:07 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-27T16:22:07Z.


Claimed by @AnastasisKon. Open a draft pull request with Refs #80 in its description within 24 hours, or the claim expires.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7223176459 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7223176459). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-27T16:22:07Z. --- Claimed by @AnastasisKon. Open a draft pull request with `Refs #80` in its description within 24 hours, or the claim expires.
AnastasisKon commented 2026-11-28 12:48:18 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:48:18Z.


/release - done: the fix is on main (branch vibe/cross-queue-barrier-2b74cc: pay a refused submission's value writes on the CPU, then only the lost passes'), and docs/ROADMAP.md already lists it under the 26-27 November fixes: "Failed command buffers now still signal their fences". The claim was stale.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239478223 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7239478223). Originally posted by [AnastasisKon](https://github.com/AnastasisKon) on 2026-11-28T12:48:18Z. --- /release - done: the fix is on `main` (branch `vibe/cross-queue-barrier-2b74cc`: `pay a refused submission's value writes on the CPU`, then only the lost passes'), and docs/ROADMAP.md already lists it under the 26-27 November fixes: "Failed command buffers now still signal their fences". The claim was stale.
github-actions[bot] commented 2026-11-28 12:48:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by github-actions[bot] on 2026-11-28T12:48:27Z.


Released. This issue is free to claim.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7239479982 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/issues/80#issuecomment-7239479982). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-28T12:48:27Z. --- Released. This issue is free to claim.
Sign in to join this conversation.
No labels
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.

Reference
LakshanSivakumar/Native-Victory-macOS#80
No description provided.