Skip to content

Commit 5151fa7

Browse files
author
arnamoy.bhattacharyya
committed
Make sure that the first arg is a SYCL memref
1 parent f190b2d commit 5151fa7

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) {
@@ -58,10 +59,11 @@ bool mlir::sycl::SYCLCastOp::areCastCompatible(::mlir::TypeRange Inputs,
5859
}
5960

6061
mlir::LogicalResult mlir::sycl::SYCLConstructorOp::verify() {
61-
if (!getOperand(0).getType().dyn_cast<mlir::MemRefType>())
62-
return emitOpError(
63-
"The first argument of a sycl::constructor op has to be a MemRef");
64-
return success();
62+
if (getOperand(0).getType().dyn_cast<mlir::MemRefType>() && isSYCLType(getOperand(0).getType().cast<mlir::MemRefType>().getElementType()))
63+
return success();
64+
65+
return emitOpError(
66+
"The first argument of a sycl::constructor op has to be a MemRef to a SYCL type");
6567
}
6668

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

0 commit comments

Comments
 (0)