--- layout: stdlib-reference --- # coopVecMatMulPacked ## Description Multiply a cooperative vector with a matrix and return the result. ## Signature
/// Requires Capability Set 1:
CoopVec<T, M> coopVecMatMulPacked<T, int M, int PackedK, U>(
    CoopVec<U, PackedK> input,
    CoopVecComponentType inputInterpretation,
    int k,
    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> coopVecMatMulPacked<T, int M, int PackedK, U>(
    CoopVec<U, PackedK> input,
    CoopVecComponentType inputInterpretation,
    int k,
    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> coopVecMatMulPacked<T, int M, int PackedK, U, IgnoredBufferElementType>(
    CoopVec<U, PackedK> input,
    CoopVecComponentType inputInterpretation,
    int k,
    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> coopVecMatMulPacked<T, int M, int PackedK, U, IgnoredBufferElementType>(
    CoopVec<U, PackedK> input,
    CoopVecComponentType inputInterpretation,
    int k,
    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> coopVecMatMulPacked<T, int M, int PackedK, U>(
    CoopVec<U, PackedK> input,
    CoopVecComponentType inputInterpretation,
    int k,
    Ptr<void> matrixPtr,
    CoopVecComponentType matrixInterpretation,
    CoopVecMatrixLayout memoryLayout,
    bool transpose,
    uint matrixStride)
    where T : __BuiltinArithmeticType
    where U : __BuiltinArithmeticType;

## Generic Parameters #### T: [\_\_BuiltinArithmeticType](../interfaces/0_builtinarithmetictype-029j/index.html) #### M : int #### PackedK : int #### U: [\_\_BuiltinArithmeticType](../interfaces/0_builtinarithmetictype-029j/index.html) #### IgnoredBufferElementType ## Parameters #### input : [CoopVec](../types/coopvec-04/index.html)\ The input cooperative vector to multiply with the matrix. #### inputInterpretation : [CoopVecComponentType](../types/coopveccomponenttype-047g/index.html) Specifies how to interpret the values in the input vector (e.g. as packed values). #### k : int The number of columns in the matrix. #### matrix : [RWByteAddressBuffer](../types/rwbyteaddressbuffer-0126d/index.html) The matrix buffer to multiply with. #### matrixOffset : int Byte offset into the matrix buffer. #### matrixInterpretation : [CoopVecComponentType](../types/coopveccomponenttype-047g/index.html) Specifies how to interpret the values in the matrix. #### memoryLayout : [CoopVecMatrixLayout](../types/coopvecmatrixlayout-047d/index.html) 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 between matrix rows/columns in bytes. #### matrix : [ByteAddressBuffer](../types/byteaddressbuffer-04b/index.html) The matrix buffer to multiply with. #### matrix : [RWStructuredBuffer](../types/rwstructuredbuffer-012c/index.html)\ The matrix buffer to multiply with. #### matrix : [StructuredBuffer](../types/structuredbuffer-0a/index.html)\ The matrix buffer to multiply with. #### matrixPtr : [Ptr](../types/ptr-0/index.html)\ ## Return value A new cooperative vector containing the result of the matrix multiplication. ## Remarks Unlike coopVecMatMul, this function supports packed input interpretations where multiple values can be packed into each element of the input vector. The k parameter specifies the actual number of values to use from the packed input. ## 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`.