@@ -50,6 +50,20 @@ static Optional<Type> getArrayTy(MLIRContext &context, unsigned dimNum,
50
50
// Type conversion
51
51
// ===----------------------------------------------------------------------===//
52
52
53
+ // / Converts SYCL array type to LLVM type.
54
+ static Optional<Type> convertArrayType (sycl::ArrayType type,
55
+ LLVMTypeConverter &converter) {
56
+ assert (type.getBody ().size () == 1 &&
57
+ " Expecting SYCL array body to have size 1" );
58
+ assert (type.getBody ()[0 ].isa <MemRefType>() &&
59
+ " Expecting SYCL array body entry to be MemRefType" );
60
+ assert (type.getBody ()[0 ].cast <MemRefType>().getElementType () ==
61
+ converter.getIndexType () &&
62
+ " Expecting SYCL array body entry element type to be the index type" );
63
+ return getArrayTy (converter.getContext (), type.getDimension (),
64
+ converter.getIndexType ());
65
+ }
66
+
53
67
// / Converts SYCL range or id type to LLVM type, given \p dimNum - number of
54
68
// / dimensions, \p name - the expected LLVM type name, \p converter - LLVM type
55
69
// / converter.
@@ -127,8 +141,7 @@ void mlir::sycl::populateSYCLToLLVMTypeConversion(
127
141
return convertAccessorType (type, typeConverter);
128
142
});
129
143
typeConverter.addConversion ([&](sycl::ArrayType type) {
130
- llvm_unreachable (" SYCLToLLVM - sycl::ArrayType not handle (yet)" );
131
- return llvm::None;
144
+ return convertArrayType (type, typeConverter);
132
145
});
133
146
typeConverter.addConversion ([&](sycl::GroupType type) {
134
147
llvm_unreachable (" SYCLToLLVM - sycl::GroupType not handle (yet)" );
0 commit comments