forked from OSchip/llvm-project
Add support to TF f32_ref type in MLIR
PiperOrigin-RevId: 214722005
This commit is contained in:
parent
c6e4aa9ba7
commit
430172ab47
|
@ -80,6 +80,7 @@ public:
|
|||
OtherType *getTFVariantType();
|
||||
OtherType *getTFComplex64Type();
|
||||
OtherType *getTFComplex128Type();
|
||||
OtherType *getTFF32REFType();
|
||||
|
||||
IntegerType *getIntegerType(unsigned width);
|
||||
FunctionType *getFunctionType(ArrayRef<Type *> inputs,
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
TFVariant,
|
||||
TFComplex64,
|
||||
TFComplex128,
|
||||
TFF32REF,
|
||||
TFString,
|
||||
|
||||
/// These are marker for the first and last 'other' type.
|
||||
|
@ -81,6 +82,7 @@ public:
|
|||
bool isTFVariant() const { return getKind() == Kind::TFVariant; }
|
||||
bool isTFComplex64() const { return getKind() == Kind::TFComplex64; }
|
||||
bool isTFComplex128() const { return getKind() == Kind::TFComplex128; }
|
||||
bool isTFF32REF() const { return getKind() == Kind::TFF32REF; }
|
||||
bool isTFString() const { return getKind() == Kind::TFString; }
|
||||
bool isBF16() const { return getKind() == Kind::BF16; }
|
||||
bool isF16() const { return getKind() == Kind::F16; }
|
||||
|
@ -103,6 +105,7 @@ public:
|
|||
static OtherType *getTFVariant(MLIRContext *ctx);
|
||||
static OtherType *getTFComplex64(MLIRContext *ctx);
|
||||
static OtherType *getTFComplex128(MLIRContext *ctx);
|
||||
static OtherType *getTFF32REF(MLIRContext *ctx);
|
||||
|
||||
/// Print the current type.
|
||||
void print(raw_ostream &os) const;
|
||||
|
@ -242,6 +245,9 @@ inline OtherType *Type::getTFComplex64(MLIRContext *ctx) {
|
|||
inline OtherType *Type::getTFComplex128(MLIRContext *ctx) {
|
||||
return OtherType::get(Kind::TFComplex128, ctx);
|
||||
}
|
||||
inline OtherType *Type::getTFF32REF(MLIRContext *ctx) {
|
||||
return OtherType::get(Kind::TFF32REF, ctx);
|
||||
}
|
||||
|
||||
/// Function types map from a list of inputs to a list of results.
|
||||
class FunctionType : public Type {
|
||||
|
|
|
@ -489,6 +489,9 @@ void ModulePrinter::printType(const Type *type) {
|
|||
case Type::Kind::TFComplex128:
|
||||
os << "tf_complex128";
|
||||
return;
|
||||
case Type::Kind::TFF32REF:
|
||||
os << "tf_f32ref";
|
||||
return;
|
||||
case Type::Kind::TFString:
|
||||
os << "tf_string";
|
||||
return;
|
||||
|
|
|
@ -76,6 +76,8 @@ OtherType *Builder::getTFComplex128Type() {
|
|||
return Type::getTFComplex128(context);
|
||||
}
|
||||
|
||||
OtherType *Builder::getTFF32REFType() { return Type::getTFF32REF(context); }
|
||||
|
||||
OtherType *Builder::getTFStringType() { return Type::getTFString(context); }
|
||||
|
||||
IntegerType *Builder::getIntegerType(unsigned width) {
|
||||
|
|
|
@ -118,6 +118,7 @@ TOK_KEYWORD(tf_variant)
|
|||
TOK_KEYWORD(tf_complex64)
|
||||
TOK_KEYWORD(tf_complex128)
|
||||
TOK_KEYWORD(tf_string)
|
||||
TOK_KEYWORD(tf_f32ref)
|
||||
TOK_KEYWORD(to)
|
||||
TOK_KEYWORD(true)
|
||||
TOK_KEYWORD(vector)
|
||||
|
|
Loading…
Reference in New Issue