Skip to content

MetalPerformanceShadersGraph iOS xcode14.3 beta1

Alex Soto edited this page Feb 16, 2023 · 1 revision

#MetalPerformanceShadersGraph.framework

diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h	2022-11-10 19:16:14
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphConvolutionOps.h	2023-02-11 22:22:04
@@ -68,6 +68,73 @@
 
 @end
 
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+@interface MPSGraphConvolution3DOpDescriptor : NSObject<NSCopying>
+
+
+@property (readwrite, nonatomic) NSUInteger strideInX;
+@property (readwrite, nonatomic) NSUInteger strideInY;
+@property (readwrite, nonatomic) NSUInteger strideInZ;
+@property (readwrite, nonatomic) NSUInteger dilationRateInX;
+@property (readwrite, nonatomic) NSUInteger dilationRateInY;
+@property (readwrite, nonatomic) NSUInteger dilationRateInZ;
+
+@property (readwrite, nonatomic) NSUInteger paddingLeft;
+@property (readwrite, nonatomic) NSUInteger paddingRight;
+@property (readwrite, nonatomic) NSUInteger paddingTop;
+@property (readwrite, nonatomic) NSUInteger paddingBottom;
+@property (readwrite, nonatomic) NSUInteger paddingFront;
+@property (readwrite, nonatomic) NSUInteger paddingBack;
+
+@property (readwrite, nonatomic) MPSGraphPaddingStyle paddingStyle;
+@property (readwrite, nonatomic) MPSGraphTensorNamedDataLayout dataLayout;
+@property (readwrite, nonatomic) MPSGraphTensorNamedDataLayout weightsLayout;
+
+/*! @property   groups
+ *  @discussion groups of the operation
+ */
+@property (readwrite, nonatomic) NSUInteger groups;
+
+
++(nullable instancetype) descriptorWithStrideInX:(NSUInteger) strideInX
+                                       strideInY:(NSUInteger) strideInY
+                                       strideInZ:(NSUInteger) strideInZ
+                                 dilationRateInX:(NSUInteger) dilationRateInX
+                                 dilationRateInY:(NSUInteger) dilationRateInY
+                                 dilationRateInZ:(NSUInteger) dilationRateInZ
+                                          groups:(NSUInteger) groups
+                                     paddingLeft:(NSUInteger) paddingLeft
+                                    paddingRight:(NSUInteger) paddingRight
+                                      paddingTop:(NSUInteger) paddingTop
+                                   paddingBottom:(NSUInteger) paddingBottom
+                                    paddingFront:(NSUInteger) paddingFront
+                                     paddingBack:(NSUInteger) paddingBack
+                                    paddingStyle:(MPSGraphPaddingStyle) paddingStyle
+                                      dataLayout:(MPSGraphTensorNamedDataLayout) dataLayout
+                                   weightsLayout:(MPSGraphTensorNamedDataLayout) weightsLayout;
+
++(nullable instancetype) descriptorWithStrideInX:(NSUInteger) strideInX
+                                       strideInY:(NSUInteger) strideInY
+                                       strideInZ:(NSUInteger) strideInZ
+                                 dilationRateInX:(NSUInteger) dilationRateInX
+                                 dilationRateInY:(NSUInteger) dilationRateInY
+                                 dilationRateInZ:(NSUInteger) dilationRateInZ
+                                          groups:(NSUInteger) groups
+                                    paddingStyle:(MPSGraphPaddingStyle) paddingStyle
+                                      dataLayout:(MPSGraphTensorNamedDataLayout) dataLayout
+                                   weightsLayout:(MPSGraphTensorNamedDataLayout) weightsLayout;
+
+
+-(void) setExplicitPaddingWithPaddingLeft:(NSUInteger) paddingLeft
+                             paddingRight:(NSUInteger) paddingRight
+                               paddingTop:(NSUInteger) paddingTop
+                            paddingBottom:(NSUInteger) paddingBottom
+                             paddingFront:(NSUInteger) paddingFront
+                              paddingBack:(NSUInteger) paddingBack;
+
+
+@end
+
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
 @interface MPSGraph(MPSGraphConvolutionOps)
 
@@ -160,6 +227,99 @@
                                                                       name:(NSString * _Nullable) name
 MPS_CLASS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0))
 MPS_SWIFT_NAME( convolution2DWeightsGradient(_:source:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
+
+
+-(MPSGraphTensor *) convolution3DWithSourceTensor:(MPSGraphTensor *) source
+                                    weightsTensor:(MPSGraphTensor *) weights
+                                       descriptor:(MPSGraphConvolution3DOpDescriptor *) descriptor
+                                             name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3D(_:weights:descriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of source input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradient                              Incoming gradient tensor
+ *  @param      weights                                                  Forward pass weights tensor
+ *  @param      outputShape                                         Shape of the forward pass source tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
+                                                          weightsTensor:(MPSGraphTensor *) weights
+                                                            outputShape:(MPSShape *) outputShape
+                                           forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                   name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DDataGradient(_:weights:outputShape:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of source input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      gradient                                                Incoming gradient tensor
+ *  @param      weights                                                  Forward pass weights tensor
+ *  @param      outputShapeTensor                           1D Int32 or Int64 Tensor. Shape of the forward pass source tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DDataGradientWithIncomingGradientTensor:(MPSGraphTensor *) gradient
+                                                          weightsTensor:(MPSGraphTensor *) weights
+                                                      outputShapeTensor:(MPSGraphTensor *) outputShapeTensor
+                                           forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                   name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DDataGradient(_:weights:outputShapeTensor:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of weights input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      incomingGradient                              Incoming gradient tensor
+ *  @param      source                                                    Forward pass source tensor
+ *  @param      outputShape                                         Shape of the forward pass weights tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) incomingGradient
+                                                              sourceTensor:(MPSGraphTensor *) source
+                                                               outputShape:(MPSShape *) outputShape
+                                              forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                      name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DWeightsGradient(_:source:outputShape:forwardConvolutionDescriptor:name:) );
+
+/*!
+ *  @abstract   Create Convolution 3D gradient op and return the result tensor
+ *  @discussion Computes the gradient of weights input for the forward pass Convolution op with identical parameters.
+ *              See discussion of convolution3DWithSourceTensor for more in depth description of  paramters.
+ *
+ *  @param      gradient                                                Incoming gradient tensor
+ *  @param      source                                                    Forward pass source tensor
+ *  @param      outputShapeTensor                           1D int32 or Int64 Tensor. Shape of the forward pass weights tensor
+ *  @param      forwardConvolutionDescriptor   Forward pass op descriptor
+ *  @param      name                                                        The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+-(MPSGraphTensor *) convolution3DWeightsGradientWithIncomingGradientTensor:(MPSGraphTensor *) gradient
+                                                              sourceTensor:(MPSGraphTensor *) source
+                                                         outputShapeTensor:(MPSGraphTensor *) outputShapeTensor
+                                              forwardConvolutionDescriptor:(MPSGraphConvolution3DOpDescriptor *) forwardConvolutionDescriptor
+                                                                      name:(NSString * _Nullable) name
+MPS_CLASS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))
+MPS_SWIFT_NAME( convolution3DWeightsGradient(_:source:outputShapeTensor:forwardConvolutionDescriptor:name:) );
 
 @end
 
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h	2022-11-10 19:18:36
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphCore.h	2023-02-11 22:22:05
@@ -55,6 +55,10 @@
  *  @constant   MPSGraphTensorNamedDataLayoutCHW             LayoutCHW
  *  @constant   MPSGraphTensorNamedDataLayoutHWC             LayoutHWC
  *  @constant   MPSGraphTensorNamedDataLayoutHW                LayoutHW
+ *  @constant   MPSGraphTensorNamedDataLayoutNCDHW        LayoutNCDHW
+ *  @constant   MPSGraphTensorNamedDataLayoutNDHWC        LayoutNDHWC
+ *  @constant   MPSGraphTensorNamedDataLayoutOIDHW         LayoutOIDHW
+ *  @constant   MPSGraphTensorNamedDataLayoutDHWIO         LayoutDHWIO
  */
 typedef NS_ENUM(NSUInteger, MPSGraphTensorNamedDataLayout)
 {
@@ -65,6 +69,10 @@
     MPSGraphTensorNamedDataLayoutCHW        MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                        =  4L,
     MPSGraphTensorNamedDataLayoutHWC        MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                        =  5L,
     MPSGraphTensorNamedDataLayoutHW         MPS_ENUM_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))                        =  6L,
+    MPSGraphTensorNamedDataLayoutNCDHW      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  7L,
+    MPSGraphTensorNamedDataLayoutNDHWC      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  8L,
+    MPSGraphTensorNamedDataLayoutOIDHW      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  9L,
+    MPSGraphTensorNamedDataLayoutDHWIO      MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                        =  10L,
 };
 
 /*!
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h	2022-11-12 15:59:14
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphExecutable.h	2023-02-12 14:14:00
@@ -107,6 +107,19 @@
        compilationDescriptor:(MPSGraphCompilationDescriptor * _Nullable) compilationDescriptor;
 
 /*!
+ *  @abstract   Get output shapes for a specialized  MPSGraphExecutable - in case specialization has not been done yet then calling this function will specialize for the given input shapes.
+ *
+ *  @param      device                                    optional MPSGraph device to compile with
+ *  @param      inputTypes                           input types
+ *  @param      compilationDescriptor  compilationDescriptor to be used to specialize, since the executable was created with a compilationDescriptor already this one overrides those settings to the extent it can
+ *
+ */
+-(NSArray<MPSGraphShapedType *> * _Nullable) getOutputTypesWithDevice:(MPSGraphDevice * _Nullable) device
+                                                           inputTypes:(NSArray<MPSGraphType *> *) inputTypes
+                                                compilationDescriptor:(MPSGraphCompilationDescriptor * _Nullable) compilationDescriptor
+MPS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3));
+
+/*!
  *  @abstract   Runs the graph for given feeds to return targetTensor values, ensuring all target operations also executed.
  *              This call  is synchronous and will return on completion of execution
  *
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h	2022-10-06 13:21:15
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphResizeOps.h	2023-02-11 22:22:05
@@ -23,6 +23,8 @@
     MPSGraphResizeNearestRoundingModeRoundPreferFloor       MPS_ENUM_AVAILABLE_STARTING(macos(13.0), ios(16.0), tvos(16.0))                                    =  1L,
     MPSGraphResizeNearestRoundingModeCeil                   MPS_ENUM_AVAILABLE_STARTING(macos(13.0), ios(16.0), tvos(16.0))                                    =  2L,
     MPSGraphResizeNearestRoundingModeFloor                  MPS_ENUM_AVAILABLE_STARTING(macos(13.0), ios(16.0), tvos(16.0))                                    =  3L,
+    MPSGraphResizeNearestRoundingModeRoundToEven            MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                                    =  4L,
+    MPSGraphResizeNearestRoundingModeRoundToOdd             MPS_ENUM_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3))                                    =  5L,
 };
 
 MPS_CLASS_AVAILABLE_STARTING(macos(11.0), ios(14.0), tvos(14.0))
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h	2022-11-10 19:18:35
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorData.h	2023-02-12 14:10:49
@@ -130,7 +130,7 @@
 
 /*! @abstract   Initialize an MPSGraphTensorData with an MPSImage batch, the dataLayout used will be NHWC,
  *              call a transpose or permute to change to a layout of your choice.
- *  @param      imageBatch  The device on which the kernel will run
+ *  @param      imageBatch  The device on which the kernel will run, unorm8 and unorm16 images will create a float32 tensorData
  *  @return     A valid MPSGraphTensorData, or nil if allocation failure.
  */
 -(instancetype) initWithMPSImageBatch:(MPSImageBatch *) imageBatch
diff -ruN /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h
--- /Applications/Xcode_14.2.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2022-11-10 19:18:36
+++ /Applications/Xcode_14.3.0-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/MetalPerformanceShadersGraph.framework/Headers/MPSGraphTensorShapeOps.h	2023-02-11 16:43:29
@@ -560,6 +560,24 @@
 MPS_AVAILABLE_STARTING(macos(12.0), ios(15.0), tvos(15.0));
 
 /*!
+ *  @abstract   Create reinterpret cast op and return the result tensor
+ *  @discussion Returns input tensor (with element type `tensor_type`)  reinterpreted to element type `type`
+ *              passed in with the last dimension scaled by `sizeof(tensor_type) / sizeof(type)`.
+ *              This operation is endianness agnostic and data will be reinterpreted with the endianness of the
+ *              system.
+ *
+ *  @param      tensor        Input tensor
+ *  @param      type        The element type of the returned tensor.
+ *  @param      name            The name for the operation
+ *
+ *  @return     A valid MPSGraphTensor object
+ */
+- (MPSGraphTensor *)reinterpretCastTensor:(MPSGraphTensor *)tensor
+                                   toType:(MPSDataType)type
+                                     name:(NSString *_Nullable)name
+MPS_AVAILABLE_STARTING(macos(13.2), ios(16.3), tvos(16.3));
+
+/*!
  *  @abstract   Create stack op and return the result
  *  @discussion Stacks all input tensors along `axis` into a result tensor of rank + 1. Tensors must be broadcast
  *              compatible along all dimensions, and have the same type.
Clone this wiki locally