The maximum number of threads allowed for a threadgroup dispatched to the compute function.
- iOS 12.0+
- macOS 10.14+
- UIKit for Mac 13.0+Beta
- tvOS 12.0+
By default, when you create a
MTLCompute object, Metal calculates the maximum number of threads per threadgroup that you can dispatch to it. This total is based on the characteristics of the
MTLDevice and the compute function's use of thread and threadgroup memory. Metal tries to keep the program running within the GPU's available computing resources. For example, if you declare a large number of variables for each thread, then to keep the threadgroup running within the GPU's resources, Metal might allocate fewer threads per threadgroup.
Set this property if you want to allocate more threads per threadgroup than Metal allocates by default. Metal may return an error if the state object cannot be created or it may create a state object that has poor performance when used as part of a compute operation. Profile your app to determine whether setting this value provides acceptable performance.