Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metal : fix compute pass descriptor autorelease crash #9718

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions ggml/src/ggml-metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,6 @@
id<MTLDevice> device;
id<MTLCommandQueue> queue;

MTLComputePassDescriptor * edesc;

dispatch_queue_t d_queue;

struct ggml_metal_kernel kernels[GGML_METAL_KERNEL_TYPE_COUNT];
Expand Down Expand Up @@ -349,8 +347,6 @@ static void ggml_metal_log(enum ggml_log_level level, const char * format, ...){
struct ggml_backend_metal_context * ctx = calloc(1, sizeof(struct ggml_backend_metal_context));
ctx->device = device;
ctx->queue = [ctx->device newCommandQueue];
ctx->edesc = MTLComputePassDescriptor.computePassDescriptor;
ctx->edesc.dispatchType = MTLDispatchTypeSerial;
ctx->d_queue = dispatch_queue_create("ggml-metal", DISPATCH_QUEUE_CONCURRENT);

id<MTLLibrary> metal_library;
Expand Down Expand Up @@ -3061,7 +3057,7 @@ static enum ggml_status ggml_metal_graph_compute(
const int n_nodes_per_cb = ctx->n_nodes_per_cb;

id<MTLCommandBuffer> command_buffer = ctx->command_buffers[cb_idx];
id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoderWithDescriptor: ctx->edesc];
id<MTLComputeCommandEncoder> encoder = [command_buffer computeCommandEncoder];

int node_start = 0;
int node_end = n_nodes_0;
Expand Down
Loading