From a575636862d0eaa7211b13b1b9ed041ea9a2628f Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Wed, 8 Jul 2020 17:19:13 +0000 Subject: [PATCH] Rename XlaHloDialect class into MhloDialect following the recent dialect namespace renaming PiperOrigin-RevId: 320213526 --- include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h | 4 ++-- lib/Dialect/mhlo/IR/dialect_registration.cc | 2 +- lib/Dialect/mhlo/IR/hlo_ops.cc | 11 +++++------ .../mhlo/transforms/chlo_legalize_to_hlo_pass.cc | 2 +- lib/Dialect/mhlo/transforms/hlo_legalize_to_lhlo.cc | 2 +- .../mhlo/transforms/materialize_broadcasts_pass.cc | 2 +- .../mhlo/transforms/xla_transform_unranked_hlo.cc | 2 +- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h index ee55325..e57aa60 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h +++ b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h @@ -39,9 +39,9 @@ class OpBuilder; namespace mhlo { -class XlaHloDialect : public Dialect { +class MhloDialect : public Dialect { public: - explicit XlaHloDialect(MLIRContext *context); + explicit MhloDialect(MLIRContext *context); static StringRef getDialectNamespace() { return "mhlo"; } // Registered hook to materialize a constant operation from a given attribute diff --git a/lib/Dialect/mhlo/IR/dialect_registration.cc b/lib/Dialect/mhlo/IR/dialect_registration.cc index 743fb81..44c68b8 100644 --- a/lib/Dialect/mhlo/IR/dialect_registration.cc +++ b/lib/Dialect/mhlo/IR/dialect_registration.cc @@ -18,6 +18,6 @@ limitations under the License. #include "third_party/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h" // Static initialization for XLA dialect registration. -static mlir::DialectRegistration mhlo_ops; +static mlir::DialectRegistration mhlo_ops; static mlir::DialectRegistration chlo_ops; static mlir::DialectRegistration lmhlo_ops; diff --git a/lib/Dialect/mhlo/IR/hlo_ops.cc b/lib/Dialect/mhlo/IR/hlo_ops.cc index 93f9ad7..645bffc 100644 --- a/lib/Dialect/mhlo/IR/hlo_ops.cc +++ b/lib/Dialect/mhlo/IR/hlo_ops.cc @@ -62,9 +62,8 @@ namespace mlir { #include "third_party/tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_structs.cc.inc" namespace mhlo { -Operation* XlaHloDialect::materializeConstant(OpBuilder& builder, - Attribute value, Type type, - Location loc) { +Operation* MhloDialect::materializeConstant(OpBuilder& builder, Attribute value, + Type type, Location loc) { // HLO dialect constants only support ElementsAttr unlike standard dialect // constant which supports all attributes. if (value.isa()) @@ -2128,7 +2127,7 @@ struct HLOInlinerInterface : public DialectInlinerInterface { // mhlo Dialect Constructor //===----------------------------------------------------------------------===// -XlaHloDialect::XlaHloDialect(MLIRContext* context) +MhloDialect::MhloDialect(MLIRContext* context) : Dialect(getDialectNamespace(), context) { addOperations< #define GET_OP_LIST @@ -2140,7 +2139,7 @@ XlaHloDialect::XlaHloDialect(MLIRContext* context) // allowUnknownOperations(); } -Type XlaHloDialect::parseType(DialectAsmParser& parser) const { +Type MhloDialect::parseType(DialectAsmParser& parser) const { StringRef data_type; if (parser.parseKeyword(&data_type)) return Type(); @@ -2149,7 +2148,7 @@ Type XlaHloDialect::parseType(DialectAsmParser& parser) const { return nullptr; } -void XlaHloDialect::printType(Type type, DialectAsmPrinter& os) const { +void MhloDialect::printType(Type type, DialectAsmPrinter& os) const { if (type.isa()) { os << "token"; return; diff --git a/lib/Dialect/mhlo/transforms/chlo_legalize_to_hlo_pass.cc b/lib/Dialect/mhlo/transforms/chlo_legalize_to_hlo_pass.cc index 11be2cc..e006072 100644 --- a/lib/Dialect/mhlo/transforms/chlo_legalize_to_hlo_pass.cc +++ b/lib/Dialect/mhlo/transforms/chlo_legalize_to_hlo_pass.cc @@ -33,7 +33,7 @@ struct TestChloLegalizeToHloPass conversionTarget.addIllegalDialect(); // Consider the mhlo dialect legal for tests. - conversionTarget.addLegalDialect(); + conversionTarget.addLegalDialect(); // The conversion uses helpers from the Standard dialect. conversionTarget.addLegalDialect(); conversionTarget.addLegalDialect(); diff --git a/lib/Dialect/mhlo/transforms/hlo_legalize_to_lhlo.cc b/lib/Dialect/mhlo/transforms/hlo_legalize_to_lhlo.cc index fb5dfc4..8425f0f 100644 --- a/lib/Dialect/mhlo/transforms/hlo_legalize_to_lhlo.cc +++ b/lib/Dialect/mhlo/transforms/hlo_legalize_to_lhlo.cc @@ -413,7 +413,7 @@ struct HloLegalizeToLhlo target.addIllegalOp(); target.addLegalOp(); target.addLegalOp(); - target.addIllegalDialect(); + target.addIllegalDialect(); BufferAssignmentTypeConverter converter; auto isMemRefType = [](Type type) { return type.isa(); }; diff --git a/lib/Dialect/mhlo/transforms/materialize_broadcasts_pass.cc b/lib/Dialect/mhlo/transforms/materialize_broadcasts_pass.cc index 1f55bfa..b267642 100644 --- a/lib/Dialect/mhlo/transforms/materialize_broadcasts_pass.cc +++ b/lib/Dialect/mhlo/transforms/materialize_broadcasts_pass.cc @@ -34,7 +34,7 @@ struct TestMaterializeBroadcastsPass OwningRewritePatternList conversionPatterns; // Consider the mhlo dialect legal for tests. - conversionTarget.addLegalDialect(); + conversionTarget.addLegalDialect(); // The conversion uses helpers from the Standard dialect. conversionTarget.addLegalDialect(); diff --git a/lib/Dialect/mhlo/transforms/xla_transform_unranked_hlo.cc b/lib/Dialect/mhlo/transforms/xla_transform_unranked_hlo.cc index c238085..fb8630a 100644 --- a/lib/Dialect/mhlo/transforms/xla_transform_unranked_hlo.cc +++ b/lib/Dialect/mhlo/transforms/xla_transform_unranked_hlo.cc @@ -152,7 +152,7 @@ struct TransformUnrankedHloPass // Setup conversion target. MLIRContext &ctx = getContext(); ConversionTarget target(ctx); - target.addLegalDialect(); target.addLegalOp(); AddLegalOpOnRankedTensor(&target);