coopVecMatMul
Description
Multiply a matrix with a cooperative vector. Given a M-row by K-col matrix, and a K-element column vector input, computes matrix*input, and returns a M-element vector.
Signature
/// Requires Capability Set 1: CoopVec<T, M> coopVecMatMul<T, int M, int K, U>( CoopVec<U, K> input, CoopVecComponentType inputInterpretation, RWByteAddressBuffer matrix, int matrixOffset, CoopVecComponentType matrixInterpretation, CoopVecMatrixLayout memoryLayout, bool transpose, uint matrixStride) where T : __BuiltinArithmeticType where U : __BuiltinArithmeticType; /// Requires Capability Set 1: CoopVec<T, M> coopVecMatMul<T, int M, int K, U>( CoopVec<U, K> input, CoopVecComponentType inputInterpretation, ByteAddressBuffer matrix, int matrixOffset, CoopVecComponentType matrixInterpretation, CoopVecMatrixLayout memoryLayout, bool transpose, uint matrixStride) where T : __BuiltinArithmeticType where U : __BuiltinArithmeticType; /// Requires Capability Set 2: CoopVec<T, M> coopVecMatMul<T, int M, int K, U, IgnoredBufferElementType>( CoopVec<U, K> input, CoopVecComponentType inputInterpretation, RWStructuredBuffer<IgnoredBufferElementType, DefaultDataLayout> matrix, int matrixOffset, CoopVecComponentType matrixInterpretation, CoopVecMatrixLayout memoryLayout, bool transpose, uint matrixStride) where T : __BuiltinArithmeticType where U : __BuiltinArithmeticType; /// Requires Capability Set 2: CoopVec<T, M> coopVecMatMul<T, int M, int K, U, IgnoredBufferElementType>( CoopVec<U, K> input, CoopVecComponentType inputInterpretation, StructuredBuffer<IgnoredBufferElementType, DefaultDataLayout> matrix, int matrixOffset, CoopVecComponentType matrixInterpretation, CoopVecMatrixLayout memoryLayout, bool transpose, uint matrixStride) where T : __BuiltinArithmeticType where U : __BuiltinArithmeticType; /// Requires Capability Set 2: CoopVec<T, M> coopVecMatMul<T, int M, int K, U>( CoopVec<U, K> input, CoopVecComponentType inputInterpretation, Ptr<void> matrix, CoopVecComponentType matrixInterpretation, CoopVecMatrixLayout memoryLayout, bool transpose, uint matrixStride) where T : __BuiltinArithmeticType where U : __BuiltinArithmeticType;
Generic Parameters
T: __BuiltinArithmeticType
M : int
K : int
U: __BuiltinArithmeticType
IgnoredBufferElementType
Parameters
input : CoopVec<U, K>
The K-element input cooperative vector to multiply with the matrix.
inputInterpretation : CoopVecComponentType
Specifies how to interpret the values in the input vector (e.g. as 8-bit integers, 16-bit floats, etc).
matrix : RWByteAddressBuffer
The M-by-K matrix to multiply with the input vector.
matrixOffset : int
Byte offset into the matrix buffer.
matrixInterpretation : CoopVecComponentType
Specifies how to interpret the values in the matrix (e.g. as 8-bit integers, 16-bit floats, etc).
memoryLayout : CoopVecMatrixLayout
Specifies the memory layout of the matrix (row-major or column-major).
transpose : bool
Whether to transpose the matrix before multiplication.
matrixStride : uint
The stride in bytes between rows/columns of the matrix.
matrix : ByteAddressBuffer
The M-by-K matrix to multiply with the input vector.
matrix : RWStructuredBuffer<IgnoredBufferElementType, DefaultDataLayout>
The M-by-K matrix to multiply with the input vector.
matrix : StructuredBuffer<IgnoredBufferElementType, DefaultDataLayout>
The M-by-K matrix to multiply with the input vector.
matrix : Ptr<void>
The M-by-K matrix to multiply with the input vector.
Return value
A new cooperative vector containing the result of the matrix multiplication.
Remarks
Depending on target hardware, some combinations of inputInterpretation, matrixInterpretation and memoryLayout may not be supported. For example, CoopVecComponentType.Float32 is not widely supported. Developers should query device properties through the host graphics API to find out which interpretations are supported.
Transposing is not supported when memoryLayout is RowMajor or ColumnMajor, and transpose must be false. Not all component types support transposing. When memoryLayout is InferencingOptimal or TrainingOptimal, matrixStride is ignored.
Availability and Requirements
Capability Set 1
Defined for the following targets:
hlsl
Available in all stages.
Requires capability: hlsl_coopvec_poc
.
cpp
Available in all stages.
cuda
Available in all stages.
spirv
Available in all stages.
Requires capability: spvCooperativeVectorNV
.
Capability Set 2
Defined for the following targets:
spirv
Available in all stages.
Requires capability: spvCooperativeVectorNV
.