Repository navigation
DeepSeek-V4.1 on Metal: a cold prompt's first chunk reads its Engram rows while the GPU runs - #3318
Merged
Merged
Conversation
ashhart
force-pushed
the
lead/dsv41-engram-overlap
branch
from
November 14, 2026 11:44
cff8343 to
fd2659d
Compare
This was referenced Nov 15, 2026
…ayers before them run A prompt chunk with nothing staged used to read both Engram layers' rows on the host before its command buffer started. It now writes the ids, starts every Engram layer's reads, commits the layers before the first Engram layer, reads that layer's rows while they run, and so on: the chunk becomes up to three command buffers on one queue, each committed once the rows it reads are written. Chunks filled ahead keep one.
…reports a failure Review (D894): Chunk.wait returned at the first failed buffer while later ones could still run when the caller reused the input set or freed its buffers.
ashhart
force-pushed
the
lead/dsv41-engram-overlap
branch
from
November 15, 2026 11:13
6f94cf3 to
2fb0d6a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DeepSeek-V4.1 on Metal: a cold prompt's first chunk used to read both Engram layers' rows (layers 1 and 14) on the host before its command buffer started. On an M5 Ultra that read was about 0.25 ms a row, so 0.5 s at 2K tokens and ~1 s for a 4096-row chunk, with the GPU idle the whole time. Later chunks already fill while the chunk before them runs.
Now a chunk with nothing staged:
prefetch),So the chunk becomes up to three command buffers on one queue, each committed once the rows it reads are written. The buffers are hazard-tracked and on one queue, so each runs after the one before it. All of them are waited on and checked for failure. On an encode error the open buffer is dropped and the committed ones finish before the caller's buffers go. Chunks filled ahead still use one command buffer. No kernel or arithmetic changes, so replies are unchanged.
Measured on an M5 Ultra (512 GB), release weights, cold prompts over repo docs (a fresh nonce each, so no prompt cache), one request at a time, a fresh server per arm, the two arms run back to back:
"draft": false, 512 tokens): all 48 reply hashes equal main's. Every one of those prompts takes the late path.zig build test-dsv41-metalpasses on an M5 Max (1,135 checks, prompt vs decode rows, cached vs fresh, served replies). Lean: 0 new.What's left on this path: layer 1's rows still wait for the first layer's GPU time only (about 90 ms at 2K), so roughly half the old fill is still serial.