Instance Method

encode(commandBuffer:leftMatrix:rightMatrix:resultMatrix:)

Encodes a matrix multiplication kernel to a command buffer.

Declaration

func encode(commandBuffer: MTLCommandBuffer, leftMatrix: MPSMatrix, rightMatrix: MPSMatrix, resultMatrix: MPSMatrix)

Parameters

commandBuffer

The command buffer that will receive the encoded kernel.

leftMatrix

The left input matrix.

rightMatrix

The right input matrix.

resultMatrix

The addend matrix which will also be overwritten by the operation result.

Discussion

The following constraints apply to the sizes of the matrices depending on the transposition operations and the sizes requested at initialization time, as well as the origins at the time this method is called:

  • The left input matrix must be large enough to hold an array of size resultRows x interiorColumns elements, beginning at the value of the leftMatrixOrigin property.

  • The right input matrix must be large enough to hold an array of size interiorColumns x resultColumns elements, beginning at the value of the rightMatrixOrigin property.

  • The result matrix must be large enough to hold an array of size resultRows x resultColumns elements, beginning at the value of the resultMatrixOrigin property.