Contents

encode(withMTL4CommandEncoder:sourceArray:destinationArray:)

Declaration

func encode(withMTL4CommandEncoder encoder: any MTL4ComputeCommandEncoder, sourceArray: MPSNDArray, destinationArray destination: MPSNDArray)

Parameters

  • encoder:

    The MTL4ComputeCommandEncoder to encode the kernel with.

  • sourceArray:

    The source NDArray.

  • 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.