|
MLIR 22.0.0git
|
According to the Vulkan spec "15.6.4. Offset and Stride Assignment": "There are different alignment requirements depending on the specific resources and on the features enabled on the device. More...
#include "mlir/Dialect/SPIRV/Utils/LayoutUtils.h"
Public Types | |
| using | Size = uint64_t |
Static Public Member Functions | |
| static spirv::StructType | decorateType (spirv::StructType structType) |
| Returns a new StructType with layout decoration. | |
| static bool | isLegalType (Type type) |
| Checks whether a type is legal in terms of Vulkan layout info decoration. | |
According to the Vulkan spec "15.6.4. Offset and Stride Assignment": "There are different alignment requirements depending on the specific resources and on the features enabled on the device.
" There are 3 types of alignment: scalar, base, extended. See the spec for details. Note: Even if scalar alignment is supported, it is generally more performant to use the base alignment. So here the calculation is based on base alignment. The memory layout must obey the following rules: 1. The Offset decoration of any member must be a multiple of its alignment. 2. Any ArrayStride or MatrixStride decoration must be a multiple of the alignment of the array or matrix as defined above. According to the SPIR-V spec: "The ArrayStride, MatrixStride, and Offset decorations must be large enough to hold the size of the objects they affect (that is, specifying overlap is invalid)."
Definition at line 50 of file LayoutUtils.h.
| using mlir::VulkanLayoutUtils::Size = uint64_t |
Definition at line 52 of file LayoutUtils.h.
|
static |
Returns a new StructType with layout decoration.
Definition at line 20 of file LayoutUtils.cpp.
References decorateType().
Referenced by convertStructTypeWithOffset(), createGlobalVarForEntryPointArgument(), and decorateType().
Checks whether a type is legal in terms of Vulkan layout info decoration.
A type is dynamically illegal if it's a composite type in the StorageBuffer, PhysicalStorageBuffer, Uniform, and PushConstant Storage Classes without layout information.
Definition at line 183 of file LayoutUtils.cpp.
References mlir::spirv::StructType::getNumElements(), and mlir::spirv::StructType::hasOffset().
Referenced by mlir::spirv::impl::SPIRVCompositeTypeLayoutPassBase< DerivedT >::clonePass(), and mlir::spirv::impl::SPIRVCompositeTypeLayoutPassBase< DerivedT >::getName().