@@ -289,7 +289,7 @@ void ggml_metal_set_tensor_async(ggml_metal_t ctx, struct ggml_tensor * tensor,
289289
290290 // queue the copy operation into the queue of the Metal context
291291 // this will be queued at the end, after any currently ongoing GPU operations
292- id <MTLCommandBuffer > cmd_buf = [ctx->queue commandBufferWithUnretainedReferences ];
292+ id <MTLCommandBuffer > cmd_buf = [ctx->queue commandBuffer ];
293293 id <MTLBlitCommandEncoder > encoder = [cmd_buf blitCommandEncoder ];
294294
295295 [encoder copyFromBuffer: buf_src
@@ -300,6 +300,7 @@ void ggml_metal_set_tensor_async(ggml_metal_t ctx, struct ggml_tensor * tensor,
300300
301301 [encoder endEncoding ];
302302 [cmd_buf commit ];
303+ [buf_src release ];
303304
304305 // do not wait here for completion
305306 // [cmd_buf waitUntilCompleted];
@@ -330,7 +331,7 @@ void ggml_metal_get_tensor_async(ggml_metal_t ctx, const struct ggml_tensor * te
330331
331332 // queue the copy operation into the queue of the Metal context
332333 // this will be queued at the end, after any currently ongoing GPU operations
333- id <MTLCommandBuffer > cmd_buf = [ctx->queue commandBufferWithUnretainedReferences ];
334+ id <MTLCommandBuffer > cmd_buf = [ctx->queue commandBuffer ];
334335 id <MTLBlitCommandEncoder > encoder = [cmd_buf blitCommandEncoder ];
335336
336337 [encoder copyFromBuffer: bid_src.metal
@@ -341,6 +342,7 @@ void ggml_metal_get_tensor_async(ggml_metal_t ctx, const struct ggml_tensor * te
341342
342343 [encoder endEncoding ];
343344 [cmd_buf commit ];
345+ [buf_dst release ];
344346
345347 // do not wait here for completion
346348 // [cmd_buf waitUntilCompleted];
0 commit comments