Re-apply 328481481 after fixing more internal issues

PiperOrigin-RevId: 328675981
Change-Id: Ie0329e0fdd34d6505ddffc20b65c26d5c6967078
This commit is contained in:
A. Unique TensorFlower 2020-08-26 22:22:56 -07:00 committed by TensorFlower Gardener
parent ecc6730253
commit 53c7442789
5 changed files with 4 additions and 17 deletions

View File

@ -238,6 +238,7 @@ cc_library(
deps = [ deps = [
":type_to_shape", ":type_to_shape",
"//tensorflow/compiler/mlir/hlo", "//tensorflow/compiler/mlir/hlo",
"//tensorflow/compiler/mlir/hlo:hlo_dialect_force_registration",
"//tensorflow/compiler/mlir/tensorflow:convert_type", "//tensorflow/compiler/mlir/tensorflow:convert_type",
"//tensorflow/compiler/mlir/tensorflow:error_util", "//tensorflow/compiler/mlir/tensorflow:error_util",
"//tensorflow/compiler/tf2xla:common", "//tensorflow/compiler/tf2xla:common",
@ -388,6 +389,7 @@ cc_library(
":xla_legalize_tf_with_tf2xla", ":xla_legalize_tf_with_tf2xla",
"//tensorflow/compiler/mlir/hlo", "//tensorflow/compiler/mlir/hlo",
"//tensorflow/compiler/mlir/hlo:chlo_legalize_to_hlo", "//tensorflow/compiler/mlir/hlo:chlo_legalize_to_hlo",
"//tensorflow/compiler/mlir/hlo:hlo_dialect_force_registration",
"//tensorflow/compiler/mlir/hlo:hlo_legalize_to_lhlo", "//tensorflow/compiler/mlir/hlo:hlo_legalize_to_lhlo",
"//tensorflow/compiler/mlir/hlo:legalize_control_flow", "//tensorflow/compiler/mlir/hlo:legalize_control_flow",
"//tensorflow/compiler/mlir/hlo:legalize_tanh_to_approximation", "//tensorflow/compiler/mlir/hlo:legalize_tanh_to_approximation",

View File

@ -254,7 +254,6 @@ cc_library(
":target_util", ":target_util",
":thunk", ":thunk",
":thunk_emitter", ":thunk_emitter",
"//tensorflow/compiler/mlir/hlo",
"//tensorflow/compiler/mlir/hlo:lhlo", "//tensorflow/compiler/mlir/hlo:lhlo",
"//tensorflow/compiler/mlir/xla:hlo_utils", "//tensorflow/compiler/mlir/xla:hlo_utils",
"//tensorflow/compiler/mlir/xla:mhlo_to_lhlo_with_xla", "//tensorflow/compiler/mlir/xla:mhlo_to_lhlo_with_xla",

View File

@ -17,10 +17,7 @@ limitations under the License.
#define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_IR_EMITTER_CONTEXT_H_ #define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_IR_EMITTER_CONTEXT_H_
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project
#include "mlir/IR/MLIRContext.h" // from @llvm-project #include "mlir/IR/MLIRContext.h" // from @llvm-project
#include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
#include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h"
#include "tensorflow/compiler/xla/service/buffer_assignment.h" #include "tensorflow/compiler/xla/service/buffer_assignment.h"
#include "tensorflow/compiler/xla/service/gpu/launch_dimensions.h" #include "tensorflow/compiler/xla/service/gpu/launch_dimensions.h"
#include "tensorflow/compiler/xla/service/hlo_execution_profile.h" #include "tensorflow/compiler/xla/service/hlo_execution_profile.h"
@ -47,11 +44,7 @@ class IrEmitterContext {
cuda_compute_capability_(cuda_compute_capability), cuda_compute_capability_(cuda_compute_capability),
profile_index_map_(profile_index_map), profile_index_map_(profile_index_map),
mlir_context_(mlir_context), mlir_context_(mlir_context),
llvm_module_(llvm_module) { llvm_module_(llvm_module) {}
mlir_context_
->loadDialect<mlir::lmhlo::LmhloDialect, mlir::mhlo::MhloDialect,
mlir::StandardOpsDialect>();
}
// Disallow copy and assign. // Disallow copy and assign.
IrEmitterContext(const IrEmitterContext&) = delete; IrEmitterContext(const IrEmitterContext&) = delete;
IrEmitterContext& operator=(const IrEmitterContext&) = delete; IrEmitterContext& operator=(const IrEmitterContext&) = delete;

View File

@ -41,12 +41,9 @@ cc_library(
srcs = ["emission_context.cc"], srcs = ["emission_context.cc"],
hdrs = ["emission_context.h"], hdrs = ["emission_context.h"],
deps = [ deps = [
"//tensorflow/compiler/mlir/hlo",
"//tensorflow/compiler/mlir/hlo:lhlo",
"//tensorflow/compiler/xla/service:hlo", "//tensorflow/compiler/xla/service:hlo",
"@com_google_absl//absl/strings", "@com_google_absl//absl/strings",
"@llvm-project//mlir:IR", "@llvm-project//mlir:IR",
"@llvm-project//mlir:StandardOps",
], ],
) )

View File

@ -16,11 +16,8 @@ limitations under the License.
#include "tensorflow/compiler/xla/service/mlir_gpu/emission_context.h" #include "tensorflow/compiler/xla/service/mlir_gpu/emission_context.h"
#include "absl/strings/substitute.h" #include "absl/strings/substitute.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" // from @llvm-project
#include "mlir/IR/Location.h" // from @llvm-project #include "mlir/IR/Location.h" // from @llvm-project
#include "mlir/IR/MLIRContext.h" // from @llvm-project #include "mlir/IR/MLIRContext.h" // from @llvm-project
#include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/hlo_ops.h"
#include "tensorflow/compiler/mlir/hlo/include/mlir-hlo/Dialect/mhlo/IR/lhlo_ops.h"
#include "tensorflow/compiler/xla/service/hlo_instruction.h" #include "tensorflow/compiler/xla/service/hlo_instruction.h"
namespace xla { namespace xla {
@ -28,8 +25,7 @@ namespace mlir_gpu {
EmissionContext::EmissionContext(std::unique_ptr<HloModule> module) EmissionContext::EmissionContext(std::unique_ptr<HloModule> module)
: module_(std::move(module)), context_() { : module_(std::move(module)), context_() {
context_.loadDialect<mlir::mhlo::MhloDialect, mlir::lmhlo::LmhloDialect, context_.loadAllGloballyRegisteredDialects();
mlir::StandardOpsDialect>();
error_handler_ = [](const ErrorMap& instructions_with_error, error_handler_ = [](const ErrorMap& instructions_with_error,
HloModule* module) { HloModule* module) {
std::set<const HloComputation*> computations_with_error; std::set<const HloComputation*> computations_with_error;