Skip to content

Commit 775c88f

Browse files
author
arnamoy.bhattacharyya
committed
Make sure that the first arg is a SYCL memref
1 parent 6954b4b commit 775c88f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mlir-sycl/lib/Dialect/IR/SYCLOps.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "mlir/IR/OpImplementation.h"
1212
#include "llvm/ADT/TypeSwitch.h"
13+
#include "mlir/Dialect/SYCL/IR/SYCLOpsTypes.h"
1314

1415
bool mlir::sycl::SYCLCastOp::areCastCompatible(::mlir::TypeRange Inputs,
1516
::mlir::TypeRange Outputs) {
@@ -46,10 +47,11 @@ bool mlir::sycl::SYCLCastOp::areCastCompatible(::mlir::TypeRange Inputs,
4647
}
4748

4849
mlir::LogicalResult mlir::sycl::SYCLConstructorOp::verify() {
49-
if (!getOperand(0).getType().dyn_cast<mlir::MemRefType>())
50-
return emitOpError(
51-
"The first argument of a sycl::constructor op has to be a MemRef");
52-
return success();
50+
if (getOperand(0).getType().dyn_cast<mlir::MemRefType>() && isSYCLType(getOperand(0).getType().cast<mlir::MemRefType>().getElementType()))
51+
return success();
52+
53+
return emitOpError(
54+
"The first argument of a sycl::constructor op has to be a MemRef to a SYCL type");
5355
}
5456

5557
mlir::LogicalResult mlir::sycl::SYCLAccessorSubscriptOp::verify() {

0 commit comments

Comments
 (0)