metal: initialize encode_async in ggml_backend_metal_init (#2334)

ggml_metal_init leaves ctx->encode_async nil, but
ggml_backend_metal_graph_compute invokes it unconditionally, so a Metal
backend created without a prior set_n_cb call segfaults on its first
graph. This affects rpc-server and ggml_backend_reg_metal_init; the
llama.cpp path is unaffected, since llama_graph_compute sets n_cb
before every compute.

Upstream added the same call in cad341d88 (#9698), the commit that
introduced encode_async. ik_llama.cpp carries the block but not the
initialization.
This commit is contained in:
Riccardo Chiumiento 2026-08-26 17:15:46 +02:00 committed by GitHub
parent 28fbe34ce9
commit 850320be8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -4509,6 +4509,8 @@ ggml_backend_t ggml_backend_metal_init(void) {
/* .context = */ ctx, /* .context = */ ctx,
}; };
ggml_backend_metal_set_n_cb(metal_backend, 1);
return metal_backend; return metal_backend;
} }