diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td --- a/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td +++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeBase.td @@ -124,4 +124,30 @@ def Shape_SizeOrIndexType : AnyTypeOf<[Shape_SizeType, Index], "size or index">; +def Shape_WitnessType : DialectType()">, "witness">, + BuildableType<"$_builder.getType<::mlir::shape::WitnessType>()"> { + let typeDescription = [{ + A witness is a structural device in the compiler to maintain ordering of + code relying on information obtained from passing assertions. Witnesses do + not represent any physical data. + + "cstr_" operations will return witnesses and be lowered into assertion logic + when not resolvable at compile time. + + "assuming_" operations will take witnesses as input and represent only + information to the compiler, so they do not exist in executing code. Code + that is dependent on "assuming_" operations can assume all cstr operations + transitively before are honored as true. + + These abstractions are intended to allow the compiler more freedom with + assertions by merely showing the assertion through dataflow at this time + rather than a side effecting operation that acts as a barrier. This can be + viewed similarly to a compiler representation of promises from asynchronous, + possibly crashing assertions. Reliant code will not be reordered to before + the code and non-reliant code can be reordered freely, and there are no + guarantees on the final ordering of the assertions or their related code. + }]; +} + #endif // SHAPE_BASE_TD diff --git a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td --- a/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td +++ b/mlir/include/mlir/Dialect/Shape/IR/ShapeOps.td @@ -19,32 +19,6 @@ include "mlir/Interfaces/SideEffectInterfaces.td" include "mlir/IR/OpAsmInterface.td" -def Shape_WitnessType : DialectType()">, "witness">, - BuildableType<"$_builder.getType<::mlir::shape::WitnessType>()"> { - let typeDescription = [{ - A witness is a structural device in the compiler to maintain ordering of - code relying on information obtained from passing assertions. Witnesses do - not represent any physical data. - - "cstr_" operations will return witnesses and be lowered into assertion logic - when not resolvable at compile time. - - "assuming_" operations will take witnesses as input and represent only - information to the compiler, so they do not exist in executing code. Code - that is dependent on "assuming_" operations can assume all cstr operations - transitively before are honored as true. - - These abstractions are intended to allow the compiler more freedom with - assertions by merely showing the assertion through dataflow at this time - rather than a side effecting operation that acts as a barrier. This can be - viewed similarly to a compiler representation of promises from asynchronous, - possibly crashing assertions. Reliant code will not be reordered to before - the code and non-reliant code can be reordered freely, and there are no - guarantees on the final ordering of the assertions or their related code. - }]; -} - //===----------------------------------------------------------------------===// // Shape op definitions //===----------------------------------------------------------------------===//