summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sugihara <peter@campsh.com>2023-11-03 12:18:18 -0700
committerGitHub <noreply@github.com>2023-11-03 21:18:18 +0200
commitd9b33fe95bd257b36c84ee5769cc048230067d6f (patch)
treeeb85223d65bda18d6f5e68c5f57d1a2df5ec01a1
parent5ba37461711095c0284233dbd14f0d9010cdbf56 (diff)
metal : round up to 16 to fix MTLDebugComputeCommandEncoder assertion (#3938)
-rw-r--r--ggml-metal.m4
1 files changed, 2 insertions, 2 deletions
diff --git a/ggml-metal.m b/ggml-metal.m
index acdb8384..78ae4485 100644
--- a/ggml-metal.m
+++ b/ggml-metal.m
@@ -1017,7 +1017,7 @@ void ggml_metal_graph_compute(
[encoder setBytes:&ne00 length:sizeof(ne00) atIndex:2];
[encoder setBytes:&ne01 length:sizeof(ne01) atIndex:3];
[encoder setBytes:&ne02 length:sizeof(ne02) atIndex:4];
- [encoder setThreadgroupMemoryLength:nth/32*sizeof(float) atIndex:0];
+ [encoder setThreadgroupMemoryLength:MAX(16, nth/32*sizeof(float)) atIndex:0];
[encoder dispatchThreadgroups:MTLSizeMake(ne01*ne02*ne03, 1, 1) threadsPerThreadgroup:MTLSizeMake(nth, 1, 1)];
} break;
@@ -1348,7 +1348,7 @@ void ggml_metal_graph_compute(
[encoder setBytes:&ne00 length:sizeof( int64_t) atIndex:2];
[encoder setBytes:&nb01 length:sizeof(uint64_t) atIndex:3];
[encoder setBytes:&eps length:sizeof( float) atIndex:4];
- [encoder setThreadgroupMemoryLength:nth*sizeof(float) atIndex:0];
+ [encoder setThreadgroupMemoryLength:MAX(16, nth*sizeof(float)) atIndex:0];
const int64_t nrows = ggml_nrows(src0);