Repository navigation
metal : fix graph capture and handle empty graphs - #29390
Merged
Merged
Conversation
ggerganov
force-pushed
the
gg/metal-capture-fixes
branch
from
September 24, 2026 16:52
5a92090 to
ac0c117
Compare
- return early when the graph has no nodes - drop the redundant reset of capture_compute: the decrement at the top of the function already transitions the counter from 0 to -1, so a capture happens exactly once - hint at METAL_CAPTURE_ENABLED=1 in the capture error message - pass capture_compute == 0 (not the raw counter) as use_capture to ggml_metal_op_init, so GPU debug-group markers are only emitted on the captured compute Assisted-by: pi:llama.cpp/Qwen3.8-27B
ggerganov
force-pushed
the
gg/metal-capture-fixes
branch
from
September 24, 2026 16:53
ac0c117 to
ca6b39a
Compare
ggerganov
marked this pull request as ready for review
September 24, 2026 17:12
1 task
frostyautumnleaf
pushed a commit
to frostyautumnleaf/llama.cpp
that referenced
this pull request
Oct 5, 2026
- return early when the graph has no nodes - drop the redundant reset of capture_compute: the decrement at the top of the function already transitions the counter from 0 to -1, so a capture happens exactly once - hint at METAL_CAPTURE_ENABLED=1 in the capture error message - pass capture_compute == 0 (not the raw counter) as use_capture to ggml_metal_op_init, so GPU debug-group markers are only emitted on the captured compute Assisted-by: pi:llama.cpp/Qwen3.8-27B
edwardyoon
pushed a commit
to edwardyoon/focus-llama
that referenced
this pull request
Oct 7, 2026
- return early when the graph has no nodes - drop the redundant reset of capture_compute: the decrement at the top of the function already transitions the counter from 0 to -1, so a capture happens exactly once - hint at METAL_CAPTURE_ENABLED=1 in the capture error message - pass capture_compute == 0 (not the raw counter) as use_capture to ggml_metal_op_init, so GPU debug-group markers are only emitted on the captured compute Assisted-by: pi:llama.cpp/Qwen3.8-27B (cherry picked from commit 84e76d8)
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.
Overview
Small fixes to the Metal graph capture path in
ggml_metal_graph_compute:GGML_STATUS_SUCCESSearly when the graph has no nodes, avoiding the command-buffer/capture machinery for an empty graph.ctx->capture_compute: the decrement at the top of the function already transitions the counter from0to-1, so a capture happens exactly once (whether or not the capture scope starts successfully).did you set METAL_CAPTURE_ENABLED=1 ?hint in the capture error message.ctx->capture_compute == 0(rather than the raw counter) as theuse_captureargument toggml_metal_op_init. The counter is a countdown, so any non-zero value (including-1after the first compute) coerced totrueand caused per-node GPU debug-group markers to be emitted on every compute instead of only on the captured one.Requirements