mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-31 08:51:55 +00:00 
			
		
		
		
	metal : fix compute pass descriptor autorelease crash (#9718)
This commit is contained in:
		| @@ -217,8 +217,6 @@ struct ggml_backend_metal_context { | |||||||
|     id<MTLDevice>       device; |     id<MTLDevice>       device; | ||||||
|     id<MTLCommandQueue> queue; |     id<MTLCommandQueue> queue; | ||||||
|  |  | ||||||
|     MTLComputePassDescriptor * edesc; |  | ||||||
|  |  | ||||||
|     dispatch_queue_t d_queue; |     dispatch_queue_t d_queue; | ||||||
|  |  | ||||||
|     struct ggml_metal_kernel kernels[GGML_METAL_KERNEL_TYPE_COUNT]; |     struct ggml_metal_kernel kernels[GGML_METAL_KERNEL_TYPE_COUNT]; | ||||||
| @@ -304,8 +302,6 @@ static struct ggml_backend_metal_context * ggml_metal_init(void) { | |||||||
|     struct ggml_backend_metal_context * ctx = calloc(1, 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->queue  = [ctx->device newCommandQueue]; |     ctx->queue  = [ctx->device newCommandQueue]; | ||||||
|     ctx->edesc  = MTLComputePassDescriptor.computePassDescriptor; |  | ||||||
|     ctx->edesc.dispatchType = MTLDispatchTypeSerial; |  | ||||||
|     ctx->d_queue = dispatch_queue_create("ggml-metal", DISPATCH_QUEUE_CONCURRENT); |     ctx->d_queue = dispatch_queue_create("ggml-metal", DISPATCH_QUEUE_CONCURRENT); | ||||||
|  |  | ||||||
|     id<MTLLibrary> metal_library; |     id<MTLLibrary> metal_library; | ||||||
| @@ -3016,7 +3012,7 @@ static enum ggml_status ggml_metal_graph_compute( | |||||||
|             const int n_nodes_per_cb = ctx->n_nodes_per_cb; |             const int n_nodes_per_cb = ctx->n_nodes_per_cb; | ||||||
|  |  | ||||||
|             id<MTLCommandBuffer> command_buffer  = ctx->command_buffers[cb_idx]; |             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_start = 0; | ||||||
|             int node_end   = n_nodes_0; |             int node_end   = n_nodes_0; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Jack Mousseau
					Jack Mousseau