From 1880f877377e45b4a05917043598d53eaf2ef523 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Wed, 16 Sep 2020 05:56:43 -0700 Subject: [PATCH] Integrate LLVM at llvm/llvm-project@e1669843f2aa Updates LLVM usage to match [e1669843f2aa](https://github.com/llvm/llvm-project/commit/e1669843f2aa) PiperOrigin-RevId: 331987679 --- build_tools/llvm_version.txt | 2 +- include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h | 6 ++++++ include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td | 2 +- include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h | 14 ++++++++------ include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td | 2 +- include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h | 8 +++++--- include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.td | 2 +- lib/Dialect/mhlo/IR/chlo_ops.cc | 6 ++++++ lib/Dialect/mhlo/IR/hlo_ops.cc | 10 ++++++++++ lib/Dialect/mhlo/IR/lhlo_ops.cc | 8 +++++++- 10 files changed, 46 insertions(+), 14 deletions(-) diff --git a/build_tools/llvm_version.txt b/build_tools/llvm_version.txt index c4e9ea4..f4ea0f6 100644 --- a/build_tools/llvm_version.txt +++ b/build_tools/llvm_version.txt @@ -1,2 +1,2 @@ -7841e21c98495ba5e33e0d2507d985bd5b938445 +e1669843f2aaf1e4929afdd8f125c14536d27664 diff --git a/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h b/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h index 282b056..05b2277 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h +++ b/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.h @@ -44,9 +44,15 @@ class HloClientDialect : public Dialect { static StringRef getDialectNamespace() { return "chlo"; } }; +} // namespace chlo +} // namespace mlir + #define GET_OP_CLASSES #include "mlir-hlo/Dialect/mhlo/IR/chlo_ops.h.inc" +namespace mlir { +namespace chlo { + template static Value getConstantLike(OpBuilder& b, Location loc, T constant, Value val) { diff --git a/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td b/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td index 5b6cf34..04f984a 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td +++ b/include/mlir-hlo/Dialect/mhlo/IR/chlo_ops.td @@ -37,7 +37,7 @@ include "mlir-hlo/Dialect/mhlo/IR/infer_fusibility_op_interface.td" def HLOClient_Dialect : Dialect { let name = "chlo"; - let cppNamespace = "chlo"; + let cppNamespace = "::mlir::chlo"; let summary = [{ Client HLO Ops }]; diff --git a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h index 4286c83..60ee4e6 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h +++ b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h @@ -19,7 +19,6 @@ limitations under the License. #define TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_HLO_OPS_H_ #include "llvm/ADT/StringRef.h" -#include "mlir-hlo/Dialect/mhlo/IR/infer_fusibility_op_interface.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Dialect.h" #include "mlir/IR/DialectImplementation.h" @@ -32,11 +31,14 @@ limitations under the License. #include "mlir/Interfaces/InferTypeOpInterface.h" #include "mlir/Interfaces/SideEffectInterfaces.h" +// clang-format off +#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_structs.h.inc" +#include "mlir-hlo/Dialect/mhlo/IR/infer_fusibility_op_interface.h" +// clang-format on + namespace mlir { class OpBuilder; -#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_structs.h.inc" - namespace mhlo { class MhloDialect : public Dialect { @@ -77,10 +79,10 @@ LogicalResult deriveShapeFromFirstOperand( OpBuilder *builder, Operation *op, SmallVectorImpl *reifiedReturnShapes); -#define GET_OP_CLASSES -#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h.inc" - } // end namespace mhlo } // end namespace mlir +#define GET_OP_CLASSES +#include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.h.inc" + #endif // TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_HLO_OPS_H_ diff --git a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td index 0372136..22afeaa 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td +++ b/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.td @@ -27,7 +27,7 @@ include "mlir-hlo/Dialect/mhlo/IR/infer_fusibility_op_interface.td" def HLO_Dialect : Dialect { let name = "mhlo"; - let cppNamespace = "mhlo"; + let cppNamespace = "::mlir::mhlo"; } class HLO_Op traits> : diff --git a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h index 6ad513d..cc24e17 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h +++ b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h @@ -33,9 +33,11 @@ limitations under the License. namespace mlir { class OpBuilder; +} // namespace mlir #include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops_structs.h.inc" +namespace mlir { namespace lmhlo { class LmhloDialect : public Dialect { @@ -44,10 +46,10 @@ class LmhloDialect : public Dialect { static StringRef getDialectNamespace() { return "lmhlo"; } }; -#define GET_OP_CLASSES -#include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h.inc" - } // namespace lmhlo } // end namespace mlir +#define GET_OP_CLASSES +#include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h.inc" + #endif // TENSORFLOW_COMPILER_MLIR_HLO_INCLUDE_MLIR_HLO_DIALECT_MHLO_IR_LHLO_OPS_H_ diff --git a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.td b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.td index 1c9820e..9225d02 100644 --- a/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.td +++ b/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.td @@ -41,7 +41,7 @@ include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_base.td" def LHLO_Dialect : Dialect { let name = "lmhlo"; - let cppNamespace = "lmhlo"; + let cppNamespace = "::mlir::lmhlo"; } //===----------------------------------------------------------------------===// diff --git a/lib/Dialect/mhlo/IR/chlo_ops.cc b/lib/Dialect/mhlo/IR/chlo_ops.cc index b5eacd6..99b22a7 100644 --- a/lib/Dialect/mhlo/IR/chlo_ops.cc +++ b/lib/Dialect/mhlo/IR/chlo_ops.cc @@ -303,9 +303,15 @@ void ConstantLikeOp::getCanonicalizationPatterns( results.insert(context); } +} // namespace chlo +} // namespace mlir + #define GET_OP_CLASSES #include "mlir-hlo/Dialect/mhlo/IR/chlo_ops.cc.inc" +namespace mlir { +namespace chlo { + //===----------------------------------------------------------------------===// // chlo Dialect Constructor //===----------------------------------------------------------------------===// diff --git a/lib/Dialect/mhlo/IR/hlo_ops.cc b/lib/Dialect/mhlo/IR/hlo_ops.cc index dc3dd21..fcd91f8 100644 --- a/lib/Dialect/mhlo/IR/hlo_ops.cc +++ b/lib/Dialect/mhlo/IR/hlo_ops.cc @@ -60,7 +60,11 @@ limitations under the License. namespace mlir { #include "hlo_patterns.cc.inc" +} // namespace mlir + #include "mlir-hlo/Dialect/mhlo/IR/hlo_ops_structs.cc.inc" + +namespace mlir { namespace mhlo { Operation* MhloDialect::materializeConstant(OpBuilder& builder, Attribute value, @@ -2469,9 +2473,15 @@ void CompareOp::build(OpBuilder& builder, OperationState& result, Value lhs, build(builder, result, new_type, lhs, rhs, comparison_direction); } +} // namespace mhlo +} // namespace mlir + #define GET_OP_CLASSES #include "mlir-hlo/Dialect/mhlo/IR/hlo_ops.cc.inc" +namespace mlir { +namespace mhlo { + //===----------------------------------------------------------------------===// // mhlo Dialect Interfaces //===----------------------------------------------------------------------===// diff --git a/lib/Dialect/mhlo/IR/lhlo_ops.cc b/lib/Dialect/mhlo/IR/lhlo_ops.cc index 81407c8..cba0d3b 100644 --- a/lib/Dialect/mhlo/IR/lhlo_ops.cc +++ b/lib/Dialect/mhlo/IR/lhlo_ops.cc @@ -29,6 +29,7 @@ limitations under the License. #include "llvm/ADT/StringRef.h" #include "llvm/Support/FormatVariadic.h" #include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h.inc" +#include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops_structs.cc.inc" #include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/Builders.h" @@ -46,7 +47,6 @@ limitations under the License. #include "mlir/IR/Value.h" namespace mlir { -#include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops_structs.cc.inc" namespace lmhlo { LmhloDialect::LmhloDialect(MLIRContext *context) @@ -159,9 +159,15 @@ static LogicalResult Verify(ReshapeMemRefCastOp op) { return success(); } +} // namespace lmhlo +} // namespace mlir + #define GET_OP_CLASSES #include "mlir-hlo/Dialect/mhlo/IR/lhlo_ops.cc.inc" +namespace mlir { +namespace lmhlo { + // TODO(cheshire): Support folding, reuse code from hlo_ops.cc. void FusionOp::build(OpBuilder &builder, OperationState &result,