What's New / Graphics & Metal

What's new in MetalPerformanceShadersGraph

+5 NewiOS · macOS · tvOS

MetalPerformanceShadersGraph builds and runs compute graphs of tensor operations on the GPU through Metal.

The 27 SDK adds 5 APIs, with no deprecations or removals. New entry points include run and several runAsync overloads for dispatching a graph, plus disableAutoLayoutConversion to opt out of automatic layout conversion.

New

5
func

disableAutoLayoutConversion

NewiOSmacOStvOS
open func disableAutoLayoutConversion()

Turns off Automatic Layout Conversion (for conv like operations) for GPU.

func

run

NewiOSmacOStvOS
open func run(on commandQueue: any MTL4CommandQueue, inputs inputsArray: [MPSGraphTensorData], results resultsArray: [MPSGraphTensorData]?, executionDescriptor: MPSGraphExecutableExecutionDescriptor?) -> [MPSGraphTensorData]

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

This call is synchronous and will return on completion of execution.

Parameters

commandQueue
MTL4CommandQueue passed to exectute the graph on.
inputsArray
Feeds tensorData for the placeholder tensors, same order as arguments of main function.
resultsArray
Results tensorData for which the caller wishes MPSGraphTensorData to be returned.

ReturnsA valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

func

runAsync

NewiOSmacOStvOS
open func runAsync(on commandQueue: any MTL4CommandQueue, feeds: [MPSGraphTensor : MPSGraphTensorData], targetTensors: [MPSGraphTensor], targetOperations: [MPSGraphOperation]?, executionDescriptor: MPSGraphExecutionDescriptor?) -> [MPSGraphTensor : MPSGraphTensorData]

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed.

This call is asynchronous and will return immediately if a completionHandler is set.

Parameters

commandQueue
MTL4CommandQueue passed to exectute the graph on.
feeds
Feeds dictionary for the placeholder tensors.
targetTensors
Tensors for which the caller wishes MPSGraphTensorData to be returned.
targetOperations
Operations to be completed at the end of the run.
executionDescriptor
ExecutionDescriptor to be passed in and used.

ReturnsA valid MPSGraphTensor : MPSGraphTensorData dictionary with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

func

runAsync

NewiOSmacOStvOS
open func runAsync(on commandQueue: any MTL4CommandQueue, feeds: [MPSGraphTensor : MPSGraphTensorData], targetOperations: [MPSGraphOperation]?, resultsDictionary: [MPSGraphTensor : MPSGraphTensorData], executionDescriptor: MPSGraphExecutionDescriptor?)

Encodes the graph for the given feeds to returns the target tensor values in the results dictionary provided by the user.

It ensures all target operations also executed. This call is asynchronous and will return immediately if a completionHandler is set.

Parameters

commandQueue
MTL4CommandQueue passed to exectute the graph on.
feeds
Feeds dictionary for the placeholder tensors.
targetOperations
Operations to be completed at the end of the run.
resultsDictionary
MPSGraphTensors dictionary passed by user, these will be filled with graph output data.
executionDescriptor
ExecutionDescriptor to be passed in and used.
func

runAsync

NewiOSmacOStvOS
open func runAsync(on commandQueue: any MTL4CommandQueue, inputs inputsArray: [MPSGraphTensorData], results resultsArray: [MPSGraphTensorData]?, executionDescriptor: MPSGraphExecutableExecutionDescriptor?) -> [MPSGraphTensorData]

Runs the graph for the given feeds and returns the target tensor values, ensuring all target operations also executed. This call is asynchronous and will return immediately.

Parameters

commandQueue
MTL4CommandQueue passed to exectute the graph on.
inputsArray
Feeds tensorData for the placeholder tensors, same order as arguments of main function.
resultsArray
Tensors for which the caller wishes MPSGraphTensorData to be returned.
executionDescriptor
ExecutionDescriptor to be passed in and used.

ReturnsA valid MPSGraphTensorData array with results synchronized to the CPU memory if MPSGraphOptionsSynchronizeResults set.

No APIs match your filter.

← More in Graphics & Metal