Skip to content

metal2vulkan 0093: dropped command buffers take their standings with them - #10

Merged
0xdaniell merged 1 commit into
mainfrom
fix/dropped-standing
Nov 10, 2026
Merged

0xdaniell merged 1 commit into
mainfrom
fix/dropped-standing

Conversation

@0xdaniell

Copy link
Copy Markdown
Owner

Fixes the bug the Codex review of #7 found in `surface_lazy_open_ids`.

The bug. A lazy surface keeps a standing: the note that a command buffer's encoder ended with the GPU image holding the surface's truth, so a later encoder can skip copying the bytes in. A standing is only usable once its command buffer committed. With `surface_lazy_open_ids` (on whenever Coherent is), "committed" means "not in the open set". A command buffer dropped without a commit also left the open set, so its standing read as committed, and a later encoder could skip a copy in it needed and draw stale pixels.

The fix (0093). When a command buffer that is still open is dropped, the standings its encoders left are cleared. A committed command buffer already left the open set at its commit, so only a drop without a commit walks the surfaces. The `surface_lazy` report counts these as `dropped-standings`.

Checked

  • A unit test, no GPU needed: fails without the fix, passes with it.
  • The repo's patches, applied as `macbox build` applies them, give exactly the tree production runs.
  • Lab boot with production's settings: one Sim 118.7–120.9 fps, two Sims about 51–52 each, desktop drag p99 23–26 ms (same as before), no GPU hangs, no fence timeouts, Coherent gates OK, `dropped-standings 0` in that run: the case is rare, which is why the numbers don't move.
  • This build is now the production build on the reference machine.

Existing installs pick it up with the update prompt in the README (it rebuilds the GPU stack).

…ndings with it

With surface_lazy_open_ids (on with Coherent), a command buffer dropped
without a commit left the open set, so the standing its encoders left read
as committed, and a later encoder could skip a copy in it needed and draw
stale pixels. Found by the Codex review of #7.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T09:00:24.709148Z 3ea121c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@0xdaniell
0xdaniell merged commit 87d8772 into main Nov 10, 2026
@0xdaniell
0xdaniell deleted the fix/dropped-standing branch November 10, 2026 09:01
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