Skip to content

Commit 75b0dff

Browse files
wecingtensorflower-gardener
authored andcommitted
Remove mlir::Type::isa() usages.
This is removed in MLIR upstream: llvm/llvm-project#135556 PiperOrigin-RevId: 749076356
1 parent 81de885 commit 75b0dff

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

tensorflow/compiler/mlir/quantization/common/quantization_lib/quantization_utils.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -672,9 +672,7 @@ class QuantizationPattern : public RewritePattern {
672672
void RewireFloatModelBackbone(Operation* quantized_op,
673673
Operation* float_op) const {
674674
for (int i = 0, e = quantized_op->getNumResults(); i < e; ++i) {
675-
if (!float_op->getResult(i)
676-
.getType()
677-
.cast<ShapedType>()
675+
if (!llvm::cast<ShapedType>(float_op->getResult(i).getType())
678676
.getElementType()
679677
.isF32()) {
680678
continue;

tensorflow/compiler/mlir/tensorflow/ir/tf_executor_ops.td

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ def TfExecutor_Dialect : Dialect {
4747
}
4848

4949
// Control type.
50-
def TfeControlType : Type<CPred<"$_self.isa<ControlType>()">, "control">,
50+
def TfeControlType : Type<CPred<"llvm::isa<ControlType>($_self)">, "control">,
5151
BuildableType<"$_builder.getType<ControlType>()">;
5252

5353
// Token type.
54-
def TfeTokenType : Type<CPred<"$_self.isa<TokenType>()">, "token">,
54+
def TfeTokenType : Type<CPred<"llvm::isa<TokenType>($_self)">, "token">,
5555
BuildableType<"$_builder.getType<TokenType>()">;
5656

5757
// TODO(hinsu): Define and use TensorType instead of AnyType for data operands

tensorflow/compiler/mlir/tensorflow/utils/convert_type.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ absl::Status ConvertScalarTypeToDataType(Type type, DataType* dtype) {
180180
absl::StrCat("Converting ", debugString(type), " to DataType"));
181181
}
182182

183-
#define HANDLE_TF_TYPE(tftype, enumerant, name) \
184-
if (type.isa<mlir::tf_type::tftype##Type>()) { \
185-
*dtype = DT_##enumerant; \
186-
return OkStatus(); \
183+
#define HANDLE_TF_TYPE(tftype, enumerant, name) \
184+
if (llvm::isa<mlir::tf_type::tftype##Type>(type)) { \
185+
*dtype = DT_##enumerant; \
186+
return OkStatus(); \
187187
}
188188
// NOLINTNEXTLINE
189189
#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.def"

tensorflow/core/ir/importexport/convert_types.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ Status ConvertScalarTypeToDataType(Type type, DataType* dtype) {
171171
}
172172

173173
#define HANDLE_TF_TYPE(tftype, enumerant, name) \
174-
if (type.isa<tftype##Type>()) { \
174+
if (llvm::isa<tftype##Type>(type)) { \
175175
*dtype = tensorflow::DT_##enumerant; \
176176
return ::tensorflow::OkStatus(); \
177177
}

tensorflow/core/ir/types/dialect.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ Type TensorFlowRefType::RemoveRef() {
631631
if (mlir::isa<Complex128RefType>(*this))
632632
return ComplexType::get(Float64Type::get(ctx));
633633
#define HANDLE_TF_TYPE(tftype, enumerant, name) \
634-
if (isa<tftype##RefType>()) return tftype##Type::get(ctx);
634+
if (mlir::isa<tftype##RefType>(*this)) return tftype##Type::get(ctx);
635635

636636
#define HANDLE_TF_REF_TYPE(tftype, enumerant, name)
637637
// NOLINTNEXTLINE

0 commit comments

Comments
 (0)