metal : fix uninitialized abort_callback (#8968)

This commit is contained in:
slaren 2024-08-10 15:42:10 +02:00 committed by GitHub
parent 7eb23840ed
commit 6e02327e8b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -310,7 +310,7 @@ static struct ggml_backend_metal_context * ggml_metal_init(int n_cb) {
GGML_METAL_LOG_INFO("%s: picking default device: %s\n", __func__, [[device name] UTF8String]); GGML_METAL_LOG_INFO("%s: picking default device: %s\n", __func__, [[device name] UTF8String]);
// Configure context // Configure context
struct ggml_backend_metal_context * ctx = malloc(sizeof(struct ggml_backend_metal_context)); struct ggml_backend_metal_context * ctx = calloc(1, sizeof(struct ggml_backend_metal_context));
ctx->device = device; ctx->device = device;
ctx->n_cb = MIN(n_cb, GGML_METAL_MAX_BUFFERS); ctx->n_cb = MIN(n_cb, GGML_METAL_MAX_BUFFERS);
ctx->queue = [ctx->device newCommandQueue]; ctx->queue = [ctx->device newCommandQueue];