Skip to content

Commit d1a7a76

Browse files
author
arnamoy.bhattacharyya
committed
Add verifier
1 parent ac058dc commit d1a7a76

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
@@ -45,6 +45,12 @@ bool mlir::sycl::SYCLCastOp::areCastCompatible(::mlir::TypeRange Inputs,
4545
return HasArrayTrait && IsArray;
4646
}
4747

48+
mlir::LogicalResult mlir::sycl::SYCLConstructorOp::verify() {
49+
if (!getOperand(0).getType().dyn_cast<mlir::MemRefType>())
50+
return emitOpError("The first argument of a sycl::constructor op has to be a MemRef");
51+
return success();
52+
}
53+
4854
mlir::LogicalResult mlir::sycl::SYCLAccessorSubscriptOp::verify() {
4955
// Available only when: (Dimensions > 0)
5056
// reference operator[](id<Dimensions> index) const;

0 commit comments

Comments
 (0)