@@ -50,6 +50,20 @@ static Optional<Type> getArrayTy(MLIRContext &context, unsigned dimNum,
5050// Type conversion
5151// ===----------------------------------------------------------------------===//
5252
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+
5367// / Converts SYCL range or id type to LLVM type, given \p dimNum - number of
5468// / dimensions, \p name - the expected LLVM type name, \p converter - LLVM type
5569// / converter.
@@ -127,8 +141,7 @@ void mlir::sycl::populateSYCLToLLVMTypeConversion(
127141 return convertAccessorType (type, typeConverter);
128142 });
129143 typeConverter.addConversion ([&](sycl::ArrayType type) {
130- llvm_unreachable (" SYCLToLLVM - sycl::ArrayType not handle (yet)" );
131- return llvm::None;
144+ return convertArrayType (type, typeConverter);
132145 });
133146 typeConverter.addConversion ([&](sycl::GroupType type) {
134147 llvm_unreachable (" SYCLToLLVM - sycl::GroupType not handle (yet)" );
0 commit comments