Skip to content

Commit 0eb1acd

Browse files
author
arnamoy.bhattacharyya
committed
Add verifier
1 parent 7384caf commit 0eb1acd

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

mlir-sycl/include/mlir/Dialect/SYCL/IR/SYCLOps.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def SYCLConstructorOp : SYCL_Op<"constructor", []> {
157157
);
158158
let results = (outs);
159159

160+
let hasVerifier = 1;
161+
160162
let assemblyFormat = [{
161163
`(` $Args `)` attr-dict `:` functional-type($Args, results)
162164
}];

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ bool mlir::sycl::SYCLCastOp::areCastCompatible(::mlir::TypeRange Inputs,
5757
return false;
5858
}
5959

60+
mlir::LogicalResult mlir::sycl::SYCLConstructorOp::verify() {
61+
if (!getOperand(0).getType().dyn_cast<mlir::MemRefType>())
62+
return emitOpError("The first argument of a sycl::constructor op has to be a MemRef");
63+
return success();
64+
}
65+
6066
mlir::LogicalResult mlir::sycl::SYCLAccessorSubscriptOp::verify() {
6167
// Available only when: (Dimensions > 0)
6268
// reference operator[](id<Dimensions> index) const;

0 commit comments

Comments
 (0)