iOS Guides | Samples

MetalPerformanceShaders Namespace

Highly-optimized image and computer shaders.


The Metal Performance Shaders namespace defines the MPSKernel class and a number of subclasses that provide highly-optimized shaders tuned for available GPU hardware.


IMPSCnnConvolutionDataSourceInterface representing the required methods (if any) of the protocol MPSCnnConvolutionDataSource.
IMPSHandleInterface describing a Metal Performance Shaders-specific identifier.
IMPSImageAllocatorInterface defining a factory that generates a MPSImage from a MTLCommandBuffer, a MPSImageDescriptor, and a MPSKernel.
IMPSImageSizeEncodingStateInterface defining methods relating to when image size is stored elsewhere in the graph.
IMPSImageTransformProviderInterface defining image resampling methods.
IMPSNNPaddingInterface describing how kernels should pad their inputs.
MPSAlphaTypeEnumerates values that indicate if and what kind of color premultiplication will be applied to color values.
MPSBinaryImageKernelA image kernel that combines two textures into one texture result.
MPSCnnBinaryConvolutionA MPSCnnKernel that has binary weights and convolves its input.
MPSCnnBinaryConvolutionFlagsFlagging enumeration for options available to binary convolution kernels.
MPSCnnBinaryConvolutionNodeA MPSCnnConvolutionNode that represents a binary convolution kernel.
MPSCnnBinaryConvolutionTypeEnumerates the operation used in a binary convolution.
MPSCnnBinaryFullyConnectedA MPSCnnBinaryConvolution that is a fully-connected convolution layer that uses binary weights.
MPSCnnBinaryFullyConnectedNodeA MPSCnnBinaryConvolutionNode that represents a fully-connected convolution layer that uses binary weights.
MPSCnnBinaryKernelA MPSKernel that has binary weights.
MPSCnnConvolutionA MPSCnnKernel that convolves its inputs, producing a feature map for each of its constituent filters.
MPSCnnConvolutionDataSourceBase class for classes that provide weights and bias terms to convolution filters.
MPSCnnConvolutionDataSource_ExtensionsExtension methods to the IMPSCnnConvolutionDataSource interface to support all the methods from the MPSCnnConvolutionDataSource protocol.
MPSCnnConvolutionDescriptorDescribes a convolution kernel.
MPSCnnConvolutionFlagsDevelopers should not use this deprecated class.
MPSCnnConvolutionNodeSubclass of MPSNNFilterNode that is the base class for convolution representation nodes.
MPSCnnConvolutionTransposeA MPSCnnKernel that transposes its input.
MPSCnnConvolutionTransposeNodeA MPSCnnConvolutionNode that represents a transpose kernel.
MPSCnnCrossChannelNormalizationA MPSCnnKernel that normalizes across feature channels.
MPSCnnCrossChannelNormalizationNodeA MPSCnnNormalizationNode that represents a cross-channel normalization kernel.
MPSCnnDepthWiseConvolutionDescriptorA MPSCnnConvolutionDescriptor that describes depthwise convolution.
MPSCnnDilatedPoolingMaxA dilated max MPSCnnPooling filter.
MPSCnnDilatedPoolingMaxNodeA MPSCnnFilterNode that represents a dilated max pooling filter.
MPSCnnFullyConnectedA fully connected layer.
MPSCnnFullyConnectedNodeA MPSCnnConvolutionNode that represents a fully connected layer.
MPSCnnKernelThe base class for layers in a convolutional neural network.
MPSCnnLocalContrastNormalizationA local contrast MPSCnnKernel.
MPSCnnLocalContrastNormalizationNodeA MPSCnnNormalizationNode representing a local contrast normalization kernel.
MPSCnnLogSoftMaxThe logarithmic softmax loss function.
MPSCnnLogSoftMaxNodeA MPSNNFilterNode that represents the logarithmic softmax loss function.
MPSCnnNeuronThe base class for activation functions.
MPSCnnNeuronAbsoluteThe absolute-value activation function.
MPSCnnNeuronAbsoluteNodeA MPSCnnNeuronNode that represents the absolute-value activation function.
MPSCnnNeuronEluThe exponential linear unit activation function.
MPSCnnNeuronEluNodeA MPSCnnNeuronNode that represents the exponential linear unit activation function.
MPSCnnNeuronHardSigmoidThe hard sigmoid activation function.
MPSCnnNeuronHardSigmoidNodeA MPSCnnNeuronNode that represents the hard sigmoid activation function.
MPSCnnNeuronLinearThe linear activation function.
MPSCnnNeuronLinearNodeA MPSCnnNeuronNode that represents the linear activation function.
MPSCnnNeuronNodeThe base class for representations of activation functions.
MPSCnnNeuronPReLUThe parametric rectified linear unit activation function.
MPSCnnNeuronPReLUNodeA MPSCnnNeuroNode that represents the parametric rectified linear unit activation function.
MPSCnnNeuronReLUThe rectified linear unit activation function.
MPSCnnNeuronReLunThe ReLUN activation function.
MPSCnnNeuronReLunNodeA MPSCnnNeuronNode that represents the ReLUN activation function.
MPSCnnNeuronReLUNodeA MPSCnnNeuronNode that represents the rectified linear unit activation function.
MPSCnnNeuronSigmoidThe sigmoid activation function.
MPSCnnNeuronSigmoidNodeA MPSCnnNeuronNode that represents the sigmoid activation function.
MPSCnnNeuronSoftPlusThe softplus activation function.
MPSCnnNeuronSoftPlusNodeA MPSCnnNeuronNode that represents the softplus activation function.
MPSCnnNeuronSoftSignThe softsign activation function.
MPSCnnNeuronSoftSignNodeA MPSCnnNeuronNode that represents the softsign activation function.
MPSCnnNeuronTanHThe hyperbolic tangent activation function.
MPSCnnNeuronTanHNodeA MPSCNNNeuronNode that represents a tanh activation function.
MPSCnnNeuronTypeEnumerates the available activation functions of a neuron.
MPSCnnNormalizationNodeAbstract base class for normalization MPSNNFilterNode subclasses.
MPSCnnPoolingA subclass of MPSCNNKernel that sub-samples its input.
MPSCnnPoolingAverageAn average pooling filter.
MPSCnnPoolingAverageNodeA MPSNNFilterNode that returns the average value of its input region.
MPSCnnPoolingL2NormAn L2-norm pooling filter.
MPSCnnPoolingL2NormNodeRepresentation of an L2-norm pooling filter.
MPSCnnPoolingMaxA MPSCNNPooling subclass that performs max-pooling.
MPSCnnPoolingMaxNodeA MPSCNNPoolingNode that represents a max-pooling kernel in a convolutional neural net.
MPSCnnPoolingNodeA MPSNNFilterNode that represents a pooling kernel in a convolutional neural net.
MPSCnnSoftMaxA MPSCnnKernel commonly used in categorization tasks.
MPSCnnSoftMaxNodeA MPSNNFilterNode that represents a softmax filter.
MPSCnnSpatialNormalizationA MPSCNNKernel that performs spatial normalization.
MPSCnnSpatialNormalizationNodeA MPSCNNNormalizationNode that represents a spatial normalization kernel.
MPSCnnSubPixelConvolutionDescriptorA MPSCNNConvolutionDescriptor that describes subpixel upsampling and reshaping.
MPSCnnUpsamplingA MPSCNNKernel that upsamples an image.
MPSCnnUpsamplingBilinearA MPSCNNUpsampling filter that performs bilinear spatial upsampling.
MPSCnnUpsamplingBilinearNodeA MPSNNFilterNode that performs bilinear spatial upsampling.
MPSCnnUpsamplingNearestA MPSCNNUpsampling filter that performs nearest spatial upsampling.
MPSCnnUpsamplingNearestNodeA MPSNNFilterNode that performs nearest spatial upsampling.
MPSCopyAllocatorCommands to copy a source texture to a new location. Used for out-of-place filters.
MPSDataLayoutEnumerates whether a data buffer is row- or column-major
MPSDataTypeEnumerates values that specify floating point data types.
MPSGRUDescriptorDescribes a gated recurrent unit layer in a neural net.
MPSImageAn image that may contain more than 4 channels. (For example, an image in a layer of a convolutional neural network.)
MPSImageAddA MPSImageArithmetic kernel that performs element-wise addition of two images.
MPSImageAreaMaxFilter that finds the maximum pixel value in a window around each pixel in the source image.(Individual channels are processed separately.)
MPSImageAreaMinFilter that finds the minimum pixel value in a window around each pixel in the source image.(Individual channels are processed separately.)
MPSImageArithmeticBase class for MPSBinaryImageKernel classes that perform arithmetic on images.
MPSImageBilinearScaleA MPSImageScale subclass that uses bilinear sampling to scale the image.
MPSImageBoxFilter that blurs by transforming each pixel of the source image to the average of itself and its neighbors.
MPSImageConversionAn image that can convert its color space, alpha, or pixel format.
MPSImageConvolutionFilter that represents a convolution.
MPSImageCopyToMatrixA MPSKernel that copies image data into a MPSMatrix object.
MPSImageDescriptorContains the attributes for a new or existing MPSImage.
MPSImageDilateFinds the maximum value in a region, offset by a corresponding value in a mask.
MPSImageDivideA MPSImageArithmetic kernel that performs element-wise division of two images.
MPSImageEdgeModeEnumerates shader behavior at the edges of regions and images.
MPSImageErodeFinds the mininum value in a region, offset by a corresponding value in a mask.
MPSImageFeatureChannelFormatEnumerates image channel descriptions.
MPSImageGaussianBlurFilter that applies a fast Gaussian blur to an image.
MPSImageGaussianPyramidRepresents a Gaussian image pyramid.
MPSImageHistogramCalculates a histogram of image data.
MPSImageHistogramEqualizationA MPSUnaryImageKernel that equalizes the histogram of an image.
MPSImageHistogramInfoSpecifies the range of histogram data in a histogram, the number of entries, and whether to encode the alpha channel.
MPSImageHistogramSpecificationTransforms an image so that its histogram matches a desired histogram.
MPSImageIntegralFilter that sums the values of pixels in a region.
MPSImageIntegralOfSquaresFilter that sums the squared values of pixels in a region.
MPSImageKeypointRangeInfoOptions for the discovery of keypoints in an image.
MPSImageLanczosScaleFilter that performs a scaling operation with Lanczos resampling.
MPSImageLaplacianAn optimized Laplacian filter.
MPSImageMedianFilter that finds the median value of each channel for pixels in the region around each source image pixel.
MPSImageMultiplyA MPSImageArithmetic kernel that performs element-wise multiplication of two images.
MPSImagePyramidBase class for image pyramids.
MPSImageReadWriteParamsOptions for the reading and writing of feature channels in an image.
MPSImageScaleA MPSUnaryImageKernel that can resize and change aspect ratio of an image.
MPSImageSobelFilter that detects edges by using a Sobel filter.
MPSImageStatisticsMeanA MPSUnaryImageKernel that calculates the mean of pixel values for a region.
MPSImageStatisticsMeanAndVarianceA MPSUnaryImageKernel that calculates the mean and variance of pixel values for a region.
MPSImageStatisticsMinAndMaxA MPSUnaryImageKernel that calculates the minimum and maximum pixel values for a region.
MPSImageSubtractA MPSImageArithmetic kernel that performs element-wise subtraction of two images.
MPSImageTentFilter that blurs an image with a tent function.
MPSImageThresholdBinaryFilter that changes all pixels above a threshold luminance to a specified maximum single-channel value, and completely darkens the rest.
MPSImageThresholdBinaryInverseFilter that changes all pixels above a threshold luminance to 0, and brightens the rest to a specified maximum single-channel value.
MPSImageThresholdToZeroFilter that darkens all pixels dimmer than or equal in brightness to a threshold luminance to 0, and leaves the rest unchanged.
MPSImageThresholdToZeroInverseFilter that leaves all pixels dimmer than or equal in brightness to a threshold luminance unchangedt, and darkens the rest to 0.
MPSImageThresholdTruncateFilter that clamps brightness values to a threshold value.
MPSImageTransposeFilter that transposes an image.
MPSKernelBase class that represents the kernel of a shader.
MPSKernelOptionsEnumerates ORable kernel options that improve performance in certain cases.
MPSLSTMDescriptorDescribes a Long-Short Term Memory layer in neural net.
MPSMatrixA matrix that represents the kernel of a linear transformation.
MPSMatrixBinaryKernelA kernel that operates on two matrices to create a new matrix.
MPSMatrixCopyPerforms multiple matrix copy operations.
MPSMatrixCopyDescriptorDescribes multiple matrix copy operations.
MPSMatrixCopyOffsetsDescribes a copy operation that supports offsets.
MPSMatrixDecompositionCholeskyA MPSMatrixUnaryKernel that computes the Cholesky factorization.
MPSMatrixDecompositionLUA MPSMatrixUnaryKernel that computes LU factorization using partial pivoting.
MPSMatrixDecompositionStatusEnumerates the result forms of a matrix decomposition.
MPSMatrixDescriptorDescribes the size, data type, and stride of a row-major matrix.
MPSMatrixMultiplicationRepresents a weighted matrix multiplication operation, followed by a weighted addition operation.
MPSMatrixSolveCholeskyA MPSMatrixBinaryKernel that solves a linear system of equations via Cholesky factorization.
MPSMatrixSolveTriangularA MPSMatrixBinaryKernel that solves a linear system of equations via a triangular coefficient matrix.
MPSMatrixUnaryKernelA kernel that performs a mapping from one matrix to another.
MPSMatrixVectorMultiplicationPerforms matrix multiplication.
MPSNNAdditionNodeAdds the results of two kernels.
MPSNNBilinearScaleNodeA MPSNNFilterNode that performs bilinear sampling.
MPSNNBinaryArithmeticNodeAbstract base class of arithmetic nodes.
MPSNNConcatenationNodeConcatenates the results of two kernels.
MPSNNDefaultPaddingPredefined common padding policies.
MPSNNDivisionNodeDivides the results of two kernels.
MPSNNFilterNodeA placeholder node in a neural network graph for an image filtering stage.
MPSNNGraphAn optimized neural network graph.
MPSNNImageNodeA placeholder node for an image in a neural network graph.
MPSNNLanczosScaleNodeA MPSNNFilterNode that performs Lanczos resampling.
MPSNNMultiplicationNodeMultiplies the results of two kernels.
MPSNNPaddingMethodOptions for how a neural network graph will pad results.
MPSNNScaleNodeAbstract neural network graph node for image resampling.
MPSNNStateNodeA state object in a neural network graph.
MPSNNSubtractionNodeSubtracts the results of two kernels.
MPSOffsetA coordinate that represents an offset.
MPSOriginA coordinate that represents the origin of a coordinate system.
MPSPurgeableStateEnumerates an image's underlying texture's purgeable state.
MPSRegionStructure that represents a region as an origin and a size.
MPSRnnBidirectionalCombineModeEnumerates how input matrices or images should be combined in a recurrent neural net.
MPSRnnDescriptorA structural description of a recurrent neural net layer.
MPSRnnImageInferenceLayerA recurrent neural net layer specifically for image data.
MPSRnnMatrixInferenceLayerA recurrent neural net layer.
MPSRnnRecurrentImageStateThe image containing the state in an image-baed recurrent neural net as it iterates through its sequence.
MPSRnnRecurrentMatrixStateThe matrix containing the state as a recurrent neural net iterates through its sequence.
MPSRnnSequenceDirectionEnumerates the propagation direction in a layer in a recurrent neural net.
MPSRnnSingleGateDescriptorDescribes the internal gate in a recurrent neural net.
MPSScaleTransformA transformation for use with a Lanczos kernel.
MPSSizeA structure that represents a width, height, and depth.
MPSStateTemporary storage used by convolutional neural nets.
MPSTemporaryImageDiscardable image data.
MPSTemporaryMatrixA matrix allocated in GPU private memory.
MPSTemporaryVectorA one-dimensional array allocated in GPU private memory.
MPSUnaryImageKernelRepresents a shader transformation produces one texture from another.
MPSVectorA one-dimensional array.
MPSVectorDescriptorDescribes the length and data type of a MPSVector.