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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user