Skip to content

Commit e49b066

Browse files
jmousseauarthw
authored andcommitted
metal : fix compute pass descriptor autorelease crash (ggml-org#9718)
1 parent 417a60f commit e49b066

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

ggml/src/ggml-metal.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,6 @@
217217
id<MTLDevice> device;
218218
id<MTLCommandQueue> queue;
219219

220-
MTLComputePassDescriptor * edesc;
221-
222220
dispatch_queue_t d_queue;
223221

224222
struct ggml_metal_kernel kernels[GGML_METAL_KERNEL_TYPE_COUNT];
@@ -304,8 +302,6 @@ @implementation GGMLMetalClass
304302
struct ggml_backend_metal_context * ctx = calloc(1, sizeof(struct ggml_backend_metal_context));
305303
ctx->device = device;
306304
ctx->queue = [ctx->device newCommandQueue];
307-
ctx->edesc = MTLComputePassDescriptor.computePassDescriptor;
308-
ctx->edesc.dispatchType = MTLDispatchTypeSerial;
309305
ctx->d_queue = dispatch_queue_create("ggml-metal", DISPATCH_QUEUE_CONCURRENT);
310306

311307
id<MTLLibrary> metal_library;
@@ -3016,7 +3012,7 @@ static enum ggml_status ggml_metal_graph_compute(
30163012
const int n_nodes_per_cb = ctx->n_nodes_per_cb;
30173013

30183014
id<MTLCommandBuffer> command_buffer = ctx->command_buffers[cb_idx];
3019-
id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoderWithDescriptor: ctx->edesc];
3015+
id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoder];
30203016

30213017
int node_start = 0;
30223018
int node_end = n_nodes_0;

0 commit comments

Comments
 (0)