mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-06 12:20:11 +01:00
[XLA:CPU] Guard LLVM command line options when infering target machine
PiperOrigin-RevId: 825233596
This commit is contained in:
parent
281fa6f4d3
commit
8ab9ebee94
1
third_party/xla/xla/service/cpu/BUILD
vendored
1
third_party/xla/xla/service/cpu/BUILD
vendored
|
|
@ -2170,6 +2170,7 @@ cc_library(
|
||||||
"//xla/service:compiler",
|
"//xla/service:compiler",
|
||||||
"//xla/service:executable",
|
"//xla/service:executable",
|
||||||
"//xla/service:hlo_module_config",
|
"//xla/service:hlo_module_config",
|
||||||
|
"//xla/service/llvm_ir:llvm_command_line_options",
|
||||||
"//xla/tsl/platform:errors",
|
"//xla/tsl/platform:errors",
|
||||||
"//xla/tsl/platform:statusor",
|
"//xla/tsl/platform:statusor",
|
||||||
"@com_google_absl//absl/log",
|
"@com_google_absl//absl/log",
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ limitations under the License.
|
||||||
#include "xla/service/cpu/runtime_symbol_generator.h"
|
#include "xla/service/cpu/runtime_symbol_generator.h"
|
||||||
#include "xla/service/executable.h"
|
#include "xla/service/executable.h"
|
||||||
#include "xla/service/hlo_module_config.h"
|
#include "xla/service/hlo_module_config.h"
|
||||||
|
#include "xla/service/llvm_ir/llvm_command_line_options.h"
|
||||||
#include "xla/tsl/platform/errors.h"
|
#include "xla/tsl/platform/errors.h"
|
||||||
#include "xla/tsl/platform/statusor.h"
|
#include "xla/tsl/platform/statusor.h"
|
||||||
#include "xla/util.h"
|
#include "xla/util.h"
|
||||||
|
|
@ -88,6 +89,11 @@ absl::StatusOr<std::unique_ptr<FunctionLibrary>> LoadFunctionLibrary(
|
||||||
absl::Span<const ObjFileProto> obj_files, const HloModule* hlo_module) {
|
absl::Span<const ObjFileProto> obj_files, const HloModule* hlo_module) {
|
||||||
const HloModuleConfig& config = hlo_module->config();
|
const HloModuleConfig& config = hlo_module->config();
|
||||||
const DebugOptions& debug_options = config.debug_options();
|
const DebugOptions& debug_options = config.debug_options();
|
||||||
|
|
||||||
|
auto llvm_options = llvm_ir::ExtractXlaBackendExtraOptions(
|
||||||
|
config.debug_options().xla_backend_extra_options());
|
||||||
|
llvm_ir::LLVMCommandLineOptionsLock llvm_lock(llvm_options);
|
||||||
|
|
||||||
TF_ASSIGN_OR_RETURN(
|
TF_ASSIGN_OR_RETURN(
|
||||||
std::unique_ptr<llvm::TargetMachine> target_machine,
|
std::unique_ptr<llvm::TargetMachine> target_machine,
|
||||||
IrCompiler::InferTargetMachine(
|
IrCompiler::InferTargetMachine(
|
||||||
|
|
@ -159,6 +165,10 @@ CpuAotLoader::LoadAotCompilationResult(
|
||||||
std::unique_ptr<HloModule> hlo_module,
|
std::unique_ptr<HloModule> hlo_module,
|
||||||
HloModule::CreateFromProtoWithConfig(aot_result_proto.hlo_module()));
|
HloModule::CreateFromProtoWithConfig(aot_result_proto.hlo_module()));
|
||||||
|
|
||||||
|
auto llvm_options = llvm_ir::ExtractXlaBackendExtraOptions(
|
||||||
|
hlo_module->config().debug_options().xla_backend_extra_options());
|
||||||
|
llvm_ir::LLVMCommandLineOptionsLock llvm_lock(llvm_options);
|
||||||
|
|
||||||
TF_ASSIGN_OR_RETURN(
|
TF_ASSIGN_OR_RETURN(
|
||||||
std::unique_ptr<llvm::TargetMachine> target_machine,
|
std::unique_ptr<llvm::TargetMachine> target_machine,
|
||||||
IrCompiler::InferTargetMachine(
|
IrCompiler::InferTargetMachine(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user