HORIZON HASKELLDocslts/ghc-9.14.x45dd5372026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 45dd537 · 2026-10-11

Modulevulkan-3.27GHC2021

Vulkan.Extensions.VK_NV_cooperative_vector

Name

VK_NV_cooperative_vector - device extension

VK_NV_cooperative_vector

Name String

VK_NV_cooperative_vector

Extension Type

Device extension

Registered Extension Number

492

Revision

4

Ratification Status

Not ratified

Extension and Version Dependencies

VK_KHR_get_physical_device_properties2

or

Vulkan Version 1.1

SPIR-V Dependencies
Contact
Extension Proposal

VK_NV_cooperative_vector

Other Extension Metadata

Last Modified Date

2024-05-23

Interactions and External Dependencies
Contributors
  • Jeff Bolz, NVIDIA

Description

This extension adds support for using cooperative vector types in SPIR-V. Unlike cooperative matrix types, a variable with a cooperative vector type is logically stored in the invocation it belongs to, but they can cooperate behind the scenes when performing matrix-vector multiplies. Cooperative vectors do not require a fully occupied subgroup or uniform control flow like cooperative matrices, although these do increase the likelihood of being on the fast path. And unlike normal vector types, they have arbitrary length and support a relatively limited set of operations. These types are intended to help accelerate the evaluation of small neural networks, where each invocation is performing its own independent evaluation of the network.

Cooperative vector types are defined by the SPV_NV_cooperative_vector SPIR-V extension and can be used with the GL_NV_cooperative_vector GLSL extension.

This extension includes support for enumerating the combinations of types that are supported by the implementation, and for converting matrix data to and from an optimized opaque layout.

New Commands

New Structures

New Unions

New Enums

New Enum Constants

New SPIR-V Capabilities

Version History

  • Revision 4, 2024-05-23 (Jeff Bolz)

    • Add maxCooperativeVectorComponents

  • Revision 3, 2024-05-23 (Jeff Bolz)

    • Add training functions

  • Revision 2, 2024-02-10 (Jeff Bolz)

    • Add device-side matrix conversion

  • Revision 1, 2023-12-13 (Jeff Bolz)

    • Initial revisions

See Also

No cross-references are available

Document Notes

For more information, see the Vulkan Specification.

This page is a generated document. Fixes and changes should be made to the generator scripts, not directly.

  • 10 types
  • 3 values
  • Packagevulkan-3.27
  • Exports37
  • LanguageGHC2021
  • LicenceBSD-3-Clause
  • SourceVK_NV_cooperative_vector.hs
valuegetPhysicalDeviceCooperativeVectorPropertiesNV
  1. :: MonadIO io
  2. => PhysicalDevice

    physicalDevice is the physical device.

  3. -> io (Result, "properties" ::: Vector CooperativeVectorPropertiesNV)
#

vkGetPhysicalDeviceCooperativeVectorPropertiesNV - Returns properties describing what cooperative vector types are supported

Description

If pProperties is NULL, then the number of cooperative vector properties available is returned in pPropertyCount. Otherwise, pPropertyCount must point to a variable set by the user to the number of elements in the pProperties array, and on return the variable is overwritten with the number of structures actually written to pProperties. If pPropertyCount is less than the number of cooperative vector properties available, at most pPropertyCount structures will be written, and INCOMPLETE will be returned instead of SUCCESS, to indicate that not all the available cooperative vector properties were returned.

Valid Usage (Implicit)

  • pPropertyCount must be a valid pointer to a uint32_t value

  • If the value referenced by pPropertyCount is not 0, and pProperties is not NULL, pProperties must be a valid pointer to an array of pPropertyCount CooperativeVectorPropertiesNV structures

Return Codes

Success
Failure

See Also

VK_NV_cooperative_vector, CooperativeVectorPropertiesNV, PhysicalDevice

valueconvertCooperativeVectorMatrixNV
  1. :: MonadIO io
  2. => Device

    device is the device.

  3. -> ConvertCooperativeVectorMatrixInfoNV

    pInfo is a pointer to a ConvertCooperativeVectorMatrixInfoNV structure containing information about the layout conversion.

  4. -> io Result
#

vkConvertCooperativeVectorMatrixNV - Convert a cooperative vector matrix from one layout and type to another

Description

If pInfo->dstData is NULL, then the number of bytes required to store the converted matrix is returned in pDstSize. Otherwise, pInfo->pDstSize must point to a variable set by the user to the number of bytes in pInfo->dstData, and on return the variable is overwritten with the number of bytes actually written to pInfo->dstData. pInfo->srcData can be NULL when pInfo->dstData is NULL. If pInfo->pDstSize is less than the number of bytes required to store the converted matrix, no bytes will be written, and INCOMPLETE will be returned instead of SUCCESS, to indicate that not enough space was provided.

Valid Usage

  • If pInfo->srcData.hostAddress is NULL, then pInfo->dstData.hostAddress must be NULL

  • If pInfo->srcData.hostAddress is not NULL, then pInfo->srcSize must be large enough to contain the source matrix, based either on the standard matrix layout or based on the size filled out by this command

  • If pInfo->dstData.hostAddress is not NULL, then the value pointed to by pInfo->pDstSize must be large enough to contain the destination matrix, based either on the standard matrix layout or based on the size filled out by this command

  • If pInfo->dstData.hostAddress is not NULL, the source and destination memory ranges must not overlap

Valid Usage (Implicit)

  • device must be a valid Device handle

Return Codes

Success
Failure

See Also

VK_NV_cooperative_vector, ConvertCooperativeVectorMatrixInfoNV, Device

valuecmdConvertCooperativeVectorMatrixNV
  1. :: MonadIO io
  2. => CommandBuffer

    commandBuffer is the command buffer into which the command will be recorded.

  3. -> "infos" ::: Vector ConvertCooperativeVectorMatrixInfoNV

    pInfos is a pointer to an array of ConvertCooperativeVectorMatrixInfoNV structures containing information about the layout conversion.

  4. -> io ()
#

vkCmdConvertCooperativeVectorMatrixNV - Convert a cooperative vector matrix from one layout and type to another

Description

This command does the same conversions as convertCooperativeVectorMatrixNV, but executes on the device. One conversion is performed for each of the infoCount elements of pInfos.

This command’s execution is synchronized using PIPELINE_STAGE_2_CONVERT_COOPERATIVE_VECTOR_MATRIX_BIT_NV.

Valid Usage

  • For each element of pInfo, srcData.deviceAddress must be a valid DeviceAddress

  • For each element of pInfo, dstData.deviceAddress must be a valid DeviceAddress

  • For each element of pInfo, srcData.deviceAddress must be 64 byte aligned

  • For each element of pInfo, dstData.deviceAddress must be 64 byte aligned

  • For each element of pInfo, srcSize must be large enough to contain the source matrix, based either on the standard matrix layout or based on the size filled out by convertCooperativeVectorMatrixNV

  • For each element of pInfo, the value pointed to by pDstSize must be large enough to contain the destination matrix, based either on the standard matrix layout or based on the size filled out by convertCooperativeVectorMatrixNV

  • Memory accessed by the sources and destinations of all of the conversions must not overlap

Valid Usage (Implicit)

  • pInfos must be a valid pointer to an array of infoCount valid ConvertCooperativeVectorMatrixInfoNV structures

  • commandBuffer must be in the recording state

  • The CommandPool that commandBuffer was allocated from must support QUEUE_COMPUTE_BIT, or QUEUE_GRAPHICS_BIT operations

  • This command must only be called outside of a render pass instance

  • This command must not be called between suspended render pass instances

  • This command must only be called outside of a video coding scope

  • infoCount must be greater than 0

Host Synchronization

  • Host access to commandBuffer must be externally synchronized

  • Host access to the CommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties

'

Command Buffer Levels

Render Pass Scope

Video Coding Scope

Supported Queue Types

Command Type

Primary Secondary

Outside

Outside

VK_QUEUE_COMPUTE_BIT VK_QUEUE_GRAPHICS_BIT

Action

Conditional Rendering

vkCmdConvertCooperativeVectorMatrixNV is not affected by conditional rendering

See Also

VK_NV_cooperative_vector, CommandBuffer, ConvertCooperativeVectorMatrixInfoNV

VkPhysicalDeviceCooperativeVectorFeaturesNV - Structure describing cooperative vector features that can be supported by an implementation

Members

This structure describes the following features:

Description

If the PhysicalDeviceCooperativeVectorFeaturesNV structure is included in the pNext chain of the PhysicalDeviceFeatures2 structure passed to getPhysicalDeviceFeatures2, it is filled in to indicate whether each corresponding feature is supported. If the application wishes to use a Device with any features described by PhysicalDeviceCooperativeVectorFeaturesNV, it must add an instance of the structure, with the desired feature members set to TRUE, to the pNext chain of DeviceCreateInfo when creating the Device.

Structure Chaining

Extends the structures

See Also

VK_NV_cooperative_vector, Bool32, StructureType

Constructors

Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero

VkCooperativeVectorPropertiesNV - Structure specifying cooperative vector properties

Description

COMPONENT_TYPE_SINT8_PACKED_NV and COMPONENT_TYPE_UINT8_PACKED_NV must not be used for members other than inputInterpretation.

The following combinations must be supported (each row is a required combination):

inputType

inputInterpretation

matrixInterpretation

biasInterpretation

resultType

FLOAT16

FLOAT16

FLOAT16

FLOAT16

FLOAT16

UINT32

SINT8_PACKED

SINT8

SINT32

SINT32

SINT8

SINT8

SINT8

SINT32

SINT32

FLOAT32

SINT8

SINT8

SINT32

SINT32

FLOAT16

FLOAT_E4M3

FLOAT_E4M3

FLOAT16

FLOAT16

FLOAT16

FLOAT_E5M2

FLOAT_E5M2

FLOAT16

FLOAT16

Valid Usage (Implicit)

See Also

VK_NV_cooperative_vector, Bool32, ComponentTypeKHR, StructureType, getPhysicalDeviceCooperativeVectorPropertiesNV

Constructors

Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero

VkPhysicalDeviceCooperativeVectorPropertiesNV - Structure describing cooperative vector properties supported by an implementation

Description

If the PhysicalDeviceCooperativeVectorPropertiesNV structure is included in the pNext chain of the PhysicalDeviceProperties2 structure passed to getPhysicalDeviceProperties2, it is filled in with each corresponding implementation-dependent property.

Structure Chaining

Extends the structure

See Also

VK_NV_cooperative_vector, Bool32, ShaderStageFlags, StructureType

Constructors

Instances6Eq, Show, Storable, FromCStruct, ToCStruct, Zero

VkConvertCooperativeVectorMatrixInfoNV - Structure specifying a request to convert the layout and type of a cooperative vector matrix

Description

When called from cmdConvertCooperativeVectorMatrixNV, the deviceAddress members of srcData and dstData are used. When called from convertCooperativeVectorMatrixNV, the hostAddress members of srcData and dstData are used.

For each of the source and destination matrix, if the layout is not either COOPERATIVE_VECTOR_MATRIX_LAYOUT_ROW_MAJOR_NV or COOPERATIVE_VECTOR_MATRIX_LAYOUT_COLUMN_MAJOR_NV, then the corresponding stride parameter is ignored.

The size of the destination is only a function of the destination layout information, and does not depend on the source layout information.

Conversion can be used to convert between COMPONENT_TYPE_FLOAT32_KHR or COMPONENT_TYPE_FLOAT16_KHR and any supported lower-precision floating-point type. In this case, the conversion uses round-to-nearest-even rounding.

Valid Usage

  • If srcLayout is row-major or column-major, then srcStride must be greater than the length of a row/column, and a multiple of the element size

Valid Usage (Implicit)

See Also

VK_NV_cooperative_vector, ComponentTypeKHR, CooperativeVectorMatrixLayoutNV, DeviceOrHostAddressConstKHR, DeviceOrHostAddressKHR, StructureType, cmdConvertCooperativeVectorMatrixNV, convertCooperativeVectorMatrixNV

Constructors

Instances3Show, ToCStruct, Zero
newtypenewtype ComponentTypeKHR
#

VkComponentTypeKHR - Specify SPIR-V cooperative matrix component type

Description

See Also

VK_KHR_cooperative_matrix, VK_NV_cooperative_matrix, VK_NV_cooperative_vector, ConvertCooperativeVectorMatrixInfoNV, CooperativeMatrixFlexibleDimensionsPropertiesNV, CooperativeMatrixPropertiesKHR, CooperativeMatrixPropertiesNV, CooperativeVectorPropertiesNV

Instances6Eq, Ord, Read, Show, Storable, Zero

VkCooperativeVectorMatrixLayoutNV - Specify cooperative vector matrix layout

Description

All enum values match the corresponding SPIR-V value.

Row-major layout has elements of each row stored consecutively in memory, with a controllable stride from the start of one row to the start of the next row. Column-major layout has elements of each column stored consecutively in memory, with a controllable stride from the start of one column to the start of the next column. Inferencing-optimal and Training-optimal layouts are implementation-dependent, and the application can convert a matrix to those layouts using convertCooperativeVectorMatrixNV or cmdConvertCooperativeVectorMatrixNV. Training-optimal layout with COMPONENT_TYPE_FLOAT16_KHR or COMPONENT_TYPE_FLOAT32_KHR type has the additional guarantee that the application can reinterpret the data as an array of elements and perform element-wise operations on the data, and finite values in any padding elements do not affect the result of a matrix-vector multiply (inf/NaN values may still cause NaN values in the result).

See Also

VK_NV_cooperative_vector, ConvertCooperativeVectorMatrixInfoNV

Instances6Eq, Ord, Read, Show, Storable, Zero