encode(commandBuffer:leftMatrix:rightMatrix:resultMatrix:)
Encodes a matrix multiplication kernel to a command buffer.
Declaration
func encode(commandBuffer: any 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 interiorColumnselements, beginning at the value of the leftMatrixOrigin property.The right input matrix must be large enough to hold an array of size
interiorColumns x resultColumnselements, beginning at the value of the rightMatrixOrigin property.The result matrix must be large enough to hold an array of size
resultRows x resultColumnselements, beginning at the value of the resultMatrixOrigin property.