The options used when creating a kernel.
- iOS 9.0+
- macOS 10.13+
- Mac Catalyst 13.0+
- tvOS 9.0+
- Metal Performance Shaders
The Metal Performance Shaders framework uses the same API validation layer that Metal uses to alert you to API mistakes during development. While this option is turned on in your Xcode scheme, common programming errors will either trigger an assert or send a warning to the debug log. Except in the case of serious errors, little or no output should arrive in the console under standard usage. You can set a kernel’s
options parameter to the
skipAPIValidation value to skip most of this checking. This flag may also lead to small reductions in CPU cost.
static var none: MPSKernelOptions
The default option for the kernel. Kernels created with this option will not skip any API validation and will not use reduced precision.
static var skipAPIValidation: MPSKernelOptions
Most kernels will sanity check their arguments. This has a small but non-zero CPU cost. Setting this option, however, does not skip checks for memory allocation failure. Turning on this option can result in undefined behavior if the requested operation cannot be completed for some reason. Most error states will be passed through to Metal, which may do nothing or abort the program if Metal API validation is turned on.
static var allowReducedPrecision: MPSKernelOptions
When possible, kernels use a higher-precision data representation internally than the destination storage format to avoid excessive accumulation of computational rounding error in the result. This option advises the kernel that the destination storage format already has too much precision for what is ultimately required downstream, and the kernel may use reduced precision internally when it determines that a less precise result would yield better performance. When enabled, the performance win is often small and the precision of the result may vary by hardware and OS.
static var disableInternalTiling: MPSKernelOptions
Some kernels may automatically split up their work internally into multiple tiles. This improves performance on larger textures and reduces the amount of memory needed by the framework for temporary storage. However, if you are using your own tiling scheme to achieve similar results, your tile sizes and the framework’s choice of tile sizes may interfere with one another, causing the framework to subdivide your tiles for its own use inefficiently. Use this option to force the framework to process your data tile as a single chunk.