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
-
sTypeis the type of this structure. -
pNextisNULLor a pointer to a structure extending this structure. -
MSizeis the number of rows in matricesA,C, andResult. -
KSizeis the number of columns in matrixAand rows in matrixB. -
NSizeis the number of columns in matricesB,C,Result. -
ATypeis the component type of matrixA, of type VkComponentTypeKHR. -
BTypeis the component type of matrixB, of type VkComponentTypeKHR. -
CTypeis the component type of matrixC, of type VkComponentTypeKHR. -
ResultTypeis the component type of matrixResult, of type VkComponentTypeKHR. -
saturatingAccumulationindicates whether theSaturatingAccumulationoperand toOpCooperativeMatrixMulAddKHRmust be present. -
scopeis 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.
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.