Metal: Force Compute shaders workgroup max thread count

This forces the max thread count to be inlined with what
blender expects. While this will make some shaders less
eficient it avoid crashes / assert on shaders that
could not compile. The performance impacts can be fixed
by tackling the individual cases.
This commit is contained in:
Clément Foucault
2023-05-19 18:08:49 +02:00
parent 560e9c654b
commit b40b59935d
+8 -2
View File
@@ -1390,9 +1390,15 @@ bool MTLShader::bake_compute_pipeline_state(MTLContext *ctx)
}
/* Compile PSO. */
MTLComputePipelineDescriptor *desc = [[MTLComputePipelineDescriptor alloc] init];
desc.maxTotalThreadsPerThreadgroup = 1024;
desc.computeFunction = compute_function;
id<MTLComputePipelineState> pso = [ctx->device
newComputePipelineStateWithFunction:compute_function
error:&error];
newComputePipelineStateWithDescriptor:desc
options:MTLPipelineOptionNone
reflection:nullptr
error:&error];
if (error) {
NSLog(@"Failed to create PSO for compute shader: %s error %@\n", this->name, error);