NoSideEffect not defined?

I am having an issue when building my own dialect Ops. For some reason, the NoSideEffect trait provided by MLIR is not being found.

This is the error in question:

root@758fbcecd25d:~/mlir-batch/build# make
Scanning dependencies of target MLIRSmallOpsIncGen
[  7%] Building SmallOps.h.inc...
/workdir/mlir-batch/include/Small/SmallOps.td:17:40: error: Variable not defined: 'NoSideEffect'
def ConstantOp : Small_Op<"constant", [NoSideEffect]> {
                                       ^
make[2]: *** [include/Small/CMakeFiles/MLIRSmallOpsIncGen.dir/build.make:116: include/Small/SmallOps.h.inc] Error 1
make[1]: *** [CMakeFiles/Makefile2:449: include/Small/CMakeFiles/MLIRSmallOpsIncGen.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

Here is the respective td file that is being targeted:

include "SmallDialect.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
include "mlir/IR/OpBase.td"
include "mlir/IR/FunctionInterfaces.td"
include "mlir/IR/SymbolInterfaces.td"

//===----------------------------------------------------------------------===//
// ConstantOp
//===----------------------------------------------------------------------===//

// The constant operation is marked as 'NoSideEffect' as it is a pure operation
// and may be removed if dead.
def ConstantOp : Small_Op<"constant", [NoSideEffect]> {
  let summary = "constant";

  let description = [{
    Constant operation turns a literal into an SSA value. The data is attached
    to the operation as an attribute. For example:

    ```mlir
      %0 = "small.constant"()
      { value = dense<[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]> : tensor<2x3xf64> }
      : () -> tensor<2x3xf64>
    ```
  }];

  let builders = [
    OpBuilder<(ins "mlir::DenseElementsAttr":$value), [{
      build($_builder, $_state, value.getType(), value);
    }]>,
    OpBuilder<(ins "double":$value)>
  ];

//  let parser = [{ return ::parseConstantOp(parser, result); }];
  let arguments = (ins F64ElementsAttr:$value);
  let results = (outs F64Tensor);
}

Is there just a simple file I am missing, or is my build corrupt in some way?

Thank you.

have a look at: Introduce a ConditionallySpeculatable op interface · llvm/llvm-project@86771d0 · GitHub

1 Like

Oh that was an easy fix. Thank you!!