C Specification

Each VkCooperativeMatrixPropertiesKHR structure describes a single supported combination of types for a matrix multiply/add operation (OpCooperativeMatrixMulAddKHR). The multiply can be described in terms of the following variables and types (in SPIR-V pseudocode):

~~~~ %A is of type OpTypeCooperativeMatrixKHR %AType %scope %MSize %KSize
    %MatrixAKHR %B is of type OpTypeCooperativeMatrixKHR %BType %scope
    %KSize %NSize %MatrixBKHR %C is of type OpTypeCooperativeMatrixKHR
    %CType %scope %MSize %NSize %MatrixAccumulatorKHR %Result is of type
    OpTypeCooperativeMatrixKHR %ResultType %scope %MSize %NSize
    %MatrixAccumulatorKHR
    %Result = %A * %B + %C // using OpCooperativeMatrixMulAddKHR
~~~~

A matrix multiply with these dimensions is known as an MxNxK matrix multiply.

The VkCooperativeMatrixPropertiesKHR structure is defined as:

// Provided by VK_KHR_cooperative_matrix
typedef struct VkCooperativeMatrixPropertiesKHR {
    VkStructureType       sType;
    void*                 pNext;
    uint32_t              MSize;
    uint32_t              NSize;
    uint32_t              KSize;
    VkComponentTypeKHR    AType;
    VkComponentTypeKHR    BType;
    VkComponentTypeKHR    CType;
    VkComponentTypeKHR    ResultType;
    VkBool32              saturatingAccumulation;
    VkScopeKHR            scope;
} VkCooperativeMatrixPropertiesKHR;

Members

  • sType is the type of this structure.

  • pNext is NULL or a pointer to a structure extending this structure.

  • MSize is the number of rows in matrices A, C, and Result.

  • KSize is the number of columns in matrix A and rows in matrix B.

  • NSize is the number of columns in matrices B, C, Result.

  • AType is the component type of matrix A, of type VkComponentTypeKHR.

  • BType is the component type of matrix B, of type VkComponentTypeKHR.

  • CType is the component type of matrix C, of type VkComponentTypeKHR.

  • ResultType is the component type of matrix Result, of type VkComponentTypeKHR.

  • saturatingAccumulation indicates whether the SaturatingAccumulation operand to OpCooperativeMatrixMulAddKHR must be present.

  • scope is the scope of all the matrix types, of type VkScopeKHR.

Description

If some types are preferred over other types (e.g. for performance), they should appear earlier in the list enumerated by vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR.

At least one entry in the list must have power of two values for all of MSize, KSize, and NSize.

Valid Usage (Implicit)
  • VUID-VkCooperativeMatrixPropertiesKHR-sType-sType
    sType must be VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_KHR

  • VUID-VkCooperativeMatrixPropertiesKHR-pNext-pNext
    pNext must be NULL

  • VUID-VkCooperativeMatrixPropertiesKHR-AType-parameter
    AType must be a valid VkComponentTypeKHR value

  • VUID-VkCooperativeMatrixPropertiesKHR-BType-parameter
    BType must be a valid VkComponentTypeKHR value

  • VUID-VkCooperativeMatrixPropertiesKHR-CType-parameter
    CType must be a valid VkComponentTypeKHR value

  • VUID-VkCooperativeMatrixPropertiesKHR-ResultType-parameter
    ResultType must be a valid VkComponentTypeKHR value

  • VUID-VkCooperativeMatrixPropertiesKHR-scope-parameter
    scope must be a valid VkScopeKHR value

See Also

Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

Copyright 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0