Skip to content

Commit 98723e6

Browse files
[mlir][SPIRV] Fix build (2) (#111265)
1 parent e36a393 commit 98723e6

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

mlir/lib/Conversion/SPIRVToLLVM/SPIRVToLLVM.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ static Value optionallyTruncateOrExtend(Location loc, Value value,
149149

150150
/// Broadcasts the value to vector with `numElements` number of elements.
151151
static Value broadcast(Location loc, Value toBroadcast, unsigned numElements,
152-
const LLVMTypeConverter &typeConverter,
152+
const TypeConverter &typeConverter,
153153
ConversionPatternRewriter &rewriter) {
154154
auto vectorType = VectorType::get(numElements, toBroadcast.getType());
155155
auto llvmVectorType = typeConverter.convertType(vectorType);
@@ -166,7 +166,7 @@ static Value broadcast(Location loc, Value toBroadcast, unsigned numElements,
166166

167167
/// Broadcasts the value. If `srcType` is a scalar, the value remains unchanged.
168168
static Value optionallyBroadcast(Location loc, Value value, Type srcType,
169-
const LLVMTypeConverter &typeConverter,
169+
const TypeConverter &typeConverter,
170170
ConversionPatternRewriter &rewriter) {
171171
if (auto vectorType = dyn_cast<VectorType>(srcType)) {
172172
unsigned numElements = vectorType.getNumElements();
@@ -186,8 +186,7 @@ static Value optionallyBroadcast(Location loc, Value value, Type srcType,
186186
/// Then cast `Offset` and `Count` if their bit width is different
187187
/// from `Base` bit width.
188188
static Value processCountOrOffset(Location loc, Value value, Type srcType,
189-
Type dstType,
190-
const LLVMTypeConverter &converter,
189+
Type dstType, const TypeConverter &converter,
191190
ConversionPatternRewriter &rewriter) {
192191
Value broadcasted =
193192
optionallyBroadcast(loc, value, srcType, converter, rewriter);
@@ -197,7 +196,7 @@ static Value processCountOrOffset(Location loc, Value value, Type srcType,
197196
/// Converts SPIR-V struct with a regular (according to `VulkanLayoutUtils`)
198197
/// offset to LLVM struct. Otherwise, the conversion is not supported.
199198
static Type convertStructTypeWithOffset(spirv::StructType type,
200-
const LLVMTypeConverter &converter) {
199+
const TypeConverter &converter) {
201200
if (type != VulkanLayoutUtils::decorateType(type))
202201
return nullptr;
203202

@@ -210,7 +209,7 @@ static Type convertStructTypeWithOffset(spirv::StructType type,
210209

211210
/// Converts SPIR-V struct with no offset to packed LLVM struct.
212211
static Type convertStructTypePacked(spirv::StructType type,
213-
const LLVMTypeConverter &converter) {
212+
const TypeConverter &converter) {
214213
SmallVector<Type> elementsVector;
215214
if (failed(converter.convertTypes(type.getElementTypes(), elementsVector)))
216215
return nullptr;
@@ -227,10 +226,11 @@ static Value createI32ConstantOf(Location loc, PatternRewriter &rewriter,
227226
}
228227

229228
/// Utility for `spirv.Load` and `spirv.Store` conversion.
230-
static LogicalResult replaceWithLoadOrStore(
231-
Operation *op, ValueRange operands, ConversionPatternRewriter &rewriter,
232-
const LLVMTypeConverter &typeConverter, unsigned alignment, bool isVolatile,
233-
bool isNonTemporal) {
229+
static LogicalResult replaceWithLoadOrStore(Operation *op, ValueRange operands,
230+
ConversionPatternRewriter &rewriter,
231+
const TypeConverter &typeConverter,
232+
unsigned alignment, bool isVolatile,
233+
bool isNonTemporal) {
234234
if (auto loadOp = dyn_cast<spirv::LoadOp>(op)) {
235235
auto dstType = typeConverter.convertType(loadOp.getType());
236236
if (!dstType)
@@ -271,7 +271,7 @@ static std::optional<Type> convertArrayType(spirv::ArrayType type,
271271
/// Converts SPIR-V pointer type to LLVM pointer. Pointer's storage class is not
272272
/// modelled at the moment.
273273
static Type convertPointerType(spirv::PointerType type,
274-
const LLVMTypeConverter &converter,
274+
const TypeConverter &converter,
275275
spirv::ClientAPI clientAPI) {
276276
unsigned addressSpace =
277277
storageClassToAddressSpace(clientAPI, type.getStorageClass());
@@ -292,7 +292,7 @@ static std::optional<Type> convertRuntimeArrayType(spirv::RuntimeArrayType type,
292292
/// Converts SPIR-V struct to LLVM struct. There is no support of structs with
293293
/// member decorations. Also, only natural offset is supported.
294294
static Type convertStructType(spirv::StructType type,
295-
const LLVMTypeConverter &converter) {
295+
const TypeConverter &converter) {
296296
SmallVector<spirv::StructType::MemberDecorationInfo, 4> memberDecorations;
297297
type.getMemberDecorations(memberDecorations);
298298
if (!memberDecorations.empty())
@@ -1378,9 +1378,10 @@ class FuncConversionPattern : public SPIRVToLLVMConversion<spirv::FuncOp> {
13781378
auto funcType = funcOp.getFunctionType();
13791379
TypeConverter::SignatureConversion signatureConverter(
13801380
funcType.getNumInputs());
1381-
auto llvmType = getTypeConverter()->convertFunctionSignature(
1382-
funcType, /*isVariadic=*/false, /*useBarePtrCallConv=*/false,
1383-
signatureConverter);
1381+
auto llvmType = static_cast<const LLVMTypeConverter *>(getTypeConverter())
1382+
->convertFunctionSignature(
1383+
funcType, /*isVariadic=*/false,
1384+
/*useBarePtrCallConv=*/false, signatureConverter);
13841385
if (!llvmType)
13851386
return failure();
13861387

0 commit comments

Comments
 (0)