C Specification
The VkTensorDescriptionARM
structure is defined as:
// Provided by VK_ARM_tensors
typedef struct VkTensorDescriptionARM {
VkStructureType sType;
const void* pNext;
VkTensorTilingARM tiling;
VkFormat format;
uint32_t dimensionCount;
const int64_t* pDimensions;
const int64_t* pStrides;
VkTensorUsageFlagsARM usage;
} VkTensorDescriptionARM;
Members
-
sType
is a VkStructureType value identifying this structure. -
pNext
isNULL
or a pointer to a structure extending this structure. -
tiling
is a VkTensorTilingARM value specifying the tiling of the tensor -
format
is a one component VkFormat describing the format and type of the data elements that will be contained in the tensor. -
dimensionCount
is the number of dimensions for the tensor. -
pDimensions
is a pointer to an array of integers of sizedimensionCount
providing the number of data elements in each dimension. -
pStrides
is eitherNULL
or is an array of sizedimensionCount
providing the strides in bytes for the tensor in each dimension. -
usage
is a bitmask of VkTensorUsageFlagBitsARM specifying the usage of the tensor.
Description
When describing a tensor created with VK_TENSOR_TILING_OPTIMAL_ARM
,
pStrides
must be equal to NULL
.
When describing a tensor created with VK_TENSOR_TILING_LINEAR_ARM
,
pStrides
is either an array of size dimensionCount
or NULL
.
The formats that must be supported for format
are documented in
https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#features-formats-mandatory-features-tensor.
Each element in the pStrides
array describes the offset in bytes
between increments of the given dimension.
For example, pStrides
[0] describes the offset between element
[x0,x1,x2,x3] and element [x0+1,x1,x2,x3].
The pStrides
array can be used to determine whether a tensor is
packed or not.
If pStrides
[dimensionCount
-1] is equal to the size of a tensor
element and for each dimension n
greater than 0 and less than
dimensionCount
, pStrides
[n-1] is equal to pStrides
[n] *
pDimensions
[n], then the tensor is a packed tensor.
If the tensorNonPacked feature is not enabled,
the tensor must be a packed tensor.
When a tensor is created with VK_TENSOR_TILING_LINEAR_ARM
and
pStrides
equal to NULL
the tensor strides are calculated by the
vulkan implementation such that the resulting tensor is a packed tensor.
Expressed as an addressing formula, the starting byte of an element in a 4-dimensional, for example, linear tensor has address:
// Assume (x0,x1,x2,x3) are in units of elements.
address(x0,x1,x2,x3) = x0*pStrides[0] + x1*pStrides[1] + x2*pStrides[2] + x3*pStrides[3]
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.