Skip to content

Commit b6abc39

Browse files
committed
[MLIR][SPIRV] Replace some auto to concrete type
1 parent 35f6cc6 commit b6abc39

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

mlir/lib/Dialect/SPIRV/Utils/LayoutUtils.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ VulkanLayoutUtils::decorateType(spirv::StructType structType,
4343
Size memberSize = 0;
4444
Size memberAlignment = 1;
4545

46-
auto memberType =
46+
Type memberType =
4747
decorateType(structType.getElementType(i), memberSize, memberAlignment);
4848
structMemberOffset = llvm::alignTo(structMemberOffset, memberAlignment);
4949
memberTypes.push_back(memberType);
@@ -105,12 +105,12 @@ Type VulkanLayoutUtils::decorateType(Type type, VulkanLayoutUtils::Size &size,
105105
Type VulkanLayoutUtils::decorateType(VectorType vectorType,
106106
VulkanLayoutUtils::Size &size,
107107
VulkanLayoutUtils::Size &alignment) {
108-
const auto numElements = vectorType.getNumElements();
109-
auto elementType = vectorType.getElementType();
108+
const unsigned numElements = vectorType.getNumElements();
109+
Type elementType = vectorType.getElementType();
110110
Size elementSize = 0;
111111
Size elementAlignment = 1;
112112

113-
auto memberType = decorateType(elementType, elementSize, elementAlignment);
113+
Type memberType = decorateType(elementType, elementSize, elementAlignment);
114114
// According to the Vulkan spec:
115115
// 1. "A two-component vector has a base alignment equal to twice its scalar
116116
// alignment."
@@ -124,12 +124,12 @@ Type VulkanLayoutUtils::decorateType(VectorType vectorType,
124124
Type VulkanLayoutUtils::decorateType(spirv::ArrayType arrayType,
125125
VulkanLayoutUtils::Size &size,
126126
VulkanLayoutUtils::Size &alignment) {
127-
const auto numElements = arrayType.getNumElements();
128-
auto elementType = arrayType.getElementType();
127+
const unsigned numElements = arrayType.getNumElements();
128+
Type elementType = arrayType.getElementType();
129129
Size elementSize = 0;
130130
Size elementAlignment = 1;
131131

132-
auto memberType = decorateType(elementType, elementSize, elementAlignment);
132+
Type memberType = decorateType(elementType, elementSize, elementAlignment);
133133
// According to the Vulkan spec:
134134
// "An array has a base alignment equal to the base alignment of its element
135135
// type."
@@ -140,10 +140,10 @@ Type VulkanLayoutUtils::decorateType(spirv::ArrayType arrayType,
140140

141141
Type VulkanLayoutUtils::decorateType(spirv::RuntimeArrayType arrayType,
142142
VulkanLayoutUtils::Size &alignment) {
143-
auto elementType = arrayType.getElementType();
143+
Type elementType = arrayType.getElementType();
144144
Size elementSize = 0;
145145

146-
auto memberType = decorateType(elementType, elementSize, alignment);
146+
Type memberType = decorateType(elementType, elementSize, alignment);
147147
return spirv::RuntimeArrayType::get(memberType, elementSize);
148148
}
149149

@@ -154,7 +154,7 @@ VulkanLayoutUtils::getScalarTypeAlignment(Type scalarType) {
154154
// 2. "A scalar has a base alignment equal to its scalar alignment."
155155
// 3. "A scalar, vector or matrix type has an extended alignment equal to its
156156
// base alignment."
157-
auto bitWidth = scalarType.getIntOrFloatBitWidth();
157+
unsigned bitWidth = scalarType.getIntOrFloatBitWidth();
158158
if (bitWidth == 1)
159159
return 1;
160160
return bitWidth / 8;
@@ -166,7 +166,7 @@ bool VulkanLayoutUtils::isLegalType(Type type) {
166166
return true;
167167
}
168168

169-
auto storageClass = ptrType.getStorageClass();
169+
std::optional<spirv::StorageClass> storageClass = ptrType.getStorageClass();
170170
auto structType = dyn_cast<spirv::StructType>(ptrType.getPointeeType());
171171
if (!structType) {
172172
return true;

0 commit comments

Comments
 (0)