infrt_base.td 1.2 KB
Newer Older
Y
Yan Chunwei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
#ifndef INFRT_BASE
#define INFRT_BASE

include "mlir/IR/OpBase.td"

def INFRT_Dialect : Dialect {
  let name = "infrt";

  let description = [{
    The INFRT host dialect.
  }];

  let cppNamespace = "::infrt::dialect";
}

// Type definitions
def StringType :
    Type<CPred<"$_self.isa<::infrt::dt::StringType>()">, "!infrt.string type">,
    BuildableType<"$_builder.getType<::infrt::dt::StringType>()">;

def TensorType :
    Type<CPred<"$_self.isa<::infrt::dt::TensorType>()">, "!infrt.tensor type">;

def TensorMapType :
    Type<CPred<"$_self.isa<::infrt::dt::TensorMapType>()">, "!infrt.tensor_map type">,
    BuildableType<"$_builder.getType<::infrt::dt::TensorMapType>()">;

def BufferType : OpaqueType<"b", "buffer", "buffer">;

class INFRT_createI32Attr<string value> : NativeCodeCall<
    "mlir::createI32Attr($_builder, $_loc, " # value # ")">;

def INFRT_cvtValueToValueRange : NativeCodeCall<
    "mlir::cvtValueToValueRange($0)">;

def INFRT_concatTwoValueRange : NativeCodeCall<
    "mlir::concatTwoValueRange($0, $1)">;

class IsBoolAttrEq<string value> : Constraint<
    CPred<"($0.getValue() ==" # value # ")">,
    "Bool attrbute value constraint">;
#endif  // INFRT_BASE