Skip to content

Commit

Permalink
Add memory effects for check ops (#877)
Browse files Browse the repository at this point in the history
  • Loading branch information
chelini authored Feb 2, 2024
1 parent 0c5f14e commit bbce5a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions include/TPP/Dialect/Check/CheckOps.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Dialect.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"

#define GET_OP_CLASSES
#include "TPP/Dialect/Check/CheckOps.h.inc"
Expand Down
9 changes: 6 additions & 3 deletions include/TPP/Dialect/Check/CheckOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#define CHECK_DIALECT_CHECK_OPS

include "mlir/IR/OpBase.td"
include "mlir/Interfaces/SideEffectInterfaces.td"

def CHECK_Dialect : Dialect {
let name = "check";
Expand All @@ -15,7 +16,8 @@ def CHECK_Dialect : Dialect {
}];
}

def CHECK_ExpectTrueOp : Op<CHECK_Dialect, "expect_true"> {
def CHECK_ExpectTrueOp : Op<CHECK_Dialect, "expect_true",
[MemoryEffects<[MemWrite, MemRead]>]> {
let summary = [{Checks that the operand is true}];
let description = [{
Verifies that the operand contains a true value, which is represented by
Expand All @@ -39,7 +41,8 @@ def CHECK_ExpectAlmostEqOp :
Op<CHECK_Dialect, "expect_almost_eq",
[TypesMatchWith<"Operand types match",
"lhs", "rhs",
"$_self.cast<ShapedType>()">]> {
"$_self.cast<ShapedType>()">,
MemoryEffects<[MemWrite, MemRead]>]> {
let summary = [{Checks that the operands are almost equal}];
let description = [{
Verifies that the tensor operands with float elements are
Expand All @@ -64,7 +67,7 @@ def CHECK_ExpectAlmostEqOp :
}

def CHECK_ExpectSaneOp :
Op<CHECK_Dialect, "expect_sane"> {
Op<CHECK_Dialect, "expect_sane", [MemoryEffects<[MemWrite, MemRead]>]> {
let summary = [{Checks that the operand is neither NaN nor infinite}];
let description = [{
Verifies that the contents of tensor operand with float elements
Expand Down

0 comments on commit bbce5a8

Please sign in to comment.