encode(withMTL4CommandEncoder:sourceArrays:destinationArray:)
Declaration
func encode(withMTL4CommandEncoder encoder: any MTL4ComputeCommandEncoder, sourceArrays: [MPSNDArray], destinationArray destination: MPSNDArray)Parameters
- encoder:
The MTL4ComputeCommandEncoder to encode the kernel with.
- sourceArrays:
The source NDArray instances in a NSArray. Make sure the instances are arranged in the order required by the MPSNDArrayMultiaryKernel subclass.
- destination:
The destination NDArray.
Discussion
Encode a simple inference NDArray kernel. The encoder associates the commands with MTLStageDispatch. Synchronize your workloads against this stage when using this function to prevent race conditions.