From 9d2e777314012100b8119951c54875c91a519466 Mon Sep 17 00:00:00 2001 From: Koan-Sin Tan Date: Sat, 29 Jun 2019 11:20:17 +0800 Subject: [PATCH] make mlir related stuff build on macos 1. exp10() is not a standard C function, macos has __exp10() 2. include "mlir/StandardOps/Ops.h" earlier to avoid TRUE and FALSE being defined in --- tensorflow/compiler/mlir/lite/ir/tfl_traits.h | 5 +++++ .../compiler/mlir/tensorflow/translate/export_graphdef.h | 1 + .../compiler/mlir/tensorflow/translate/import_graphdef.h | 1 + .../compiler/mlir/tensorflow/translate/mlir_roundtrip_pass.h | 1 + tensorflow/compiler/mlir/tensorflow/utils/export_utils.h | 1 + 5 files changed, 9 insertions(+) diff --git a/tensorflow/compiler/mlir/lite/ir/tfl_traits.h b/tensorflow/compiler/mlir/lite/ir/tfl_traits.h index c9174dfdd07..8a61a72d169 100644 --- a/tensorflow/compiler/mlir/lite/ir/tfl_traits.h +++ b/tensorflow/compiler/mlir/lite/ir/tfl_traits.h @@ -22,6 +22,11 @@ limitations under the License. #include "mlir/Support/LLVM.h" // TF:local_config_mlir #include "tensorflow/compiler/mlir/lite/utils/quantization_utils.h" +// exp10() is not a standard function +#if defined(__APPLE__) +#define exp10(x) __exp10(x) +#endif + namespace mlir { namespace OpTrait { namespace TFL { diff --git a/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h b/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h index bfdceac9de0..ada401f9224 100644 --- a/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h +++ b/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h @@ -20,6 +20,7 @@ limitations under the License. #include "mlir/IR/MLIRContext.h" // TF:local_config_mlir #include "mlir/IR/Module.h" // TF:local_config_mlir #include "mlir/IR/Operation.h" // TF:local_config_mlir +#include "mlir/StandardOps/Ops.h" // TF:local_config_mlir #include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/framework/graph.pb.h" diff --git a/tensorflow/compiler/mlir/tensorflow/translate/import_graphdef.h b/tensorflow/compiler/mlir/tensorflow/translate/import_graphdef.h index c494526bb4d..97b89914cd1 100644 --- a/tensorflow/compiler/mlir/tensorflow/translate/import_graphdef.h +++ b/tensorflow/compiler/mlir/tensorflow/translate/import_graphdef.h @@ -18,6 +18,7 @@ limitations under the License. #include "mlir/IR/MLIRContext.h" // TF:local_config_mlir #include "mlir/IR/Module.h" // TF:local_config_mlir +#include "mlir/StandardOps/Ops.h" // TF:local_config_mlir #include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/framework/graph.pb.h" diff --git a/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_pass.h b/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_pass.h index 6e8547f3dcd..96a66d4eab3 100644 --- a/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_pass.h +++ b/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_pass.h @@ -16,6 +16,7 @@ limitations under the License. #ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_ROUNDTRIP_PASS_H_ #define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_ROUNDTRIP_PASS_H_ +#include "mlir/StandardOps/Ops.h" // TF:local_config_mlir #include "tensorflow/core/common_runtime/optimization_registry.h" #include "tensorflow/core/lib/core/status.h" diff --git a/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h b/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h index 4c6d8ade04a..ab2db3d57e6 100644 --- a/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h +++ b/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h @@ -27,6 +27,7 @@ limitations under the License. #include "mlir/IR/Location.h" // TF:local_config_mlir #include "mlir/IR/Operation.h" // TF:local_config_mlir #include "mlir/IR/Types.h" // TF:local_config_mlir +#include "mlir/StandardOps/Ops.h" // TF:local_config_mlir #include "tensorflow/core/framework/attr_value.pb.h" #include "tensorflow/core/framework/function.h" #include "tensorflow/core/framework/node_def.pb.h"