metal : check fused kernel destination in concurrency tracking

Assisted-by: pi:llama.cpp/DeepSeek-V4-Flash-Vision-Exp
This commit is contained in:
Georgi Gerganov
2026-09-16 13:40:04 +03:00
parent 8b9a664a54
commit 5937f47e38
+10 -1
View File
@@ -226,7 +226,16 @@ static int ggml_metal_op_encode_impl(ggml_metal_op_t ctx, int idx) {
// otherwise, we add the new ranges to the encoding context and process the node concurrently
//
{
const bool is_concurrent = ggml_metal_op_concurrency_check(ctx, node);
bool is_concurrent = ggml_metal_op_concurrency_check(ctx, node);
if (is_concurrent && ctx->use_fusion()) {
int n_fuse = 1;
const ggml_metal_fusion * fusion = ctx->can_fuse(idx, GGML_METAL_FUSION_FULL, &n_fuse);
if (fusion) {
// fused kernels write to the last node of the group, not necessarily to the first node's dst
is_concurrent = ggml_mem_ranges_check(ctx->mem_ranges, ctx->node(idx + n_fuse - 1));
}
}
if (!is_concurrent) {
ggml_metal_op_concurrency_reset(ctx);