From 7a8fd724ea44dec812d57fa380375e71f6454828 Mon Sep 17 00:00:00 2001 From: Peter Hawkins Date: Wed, 3 Jul 2019 08:59:35 -0700 Subject: [PATCH] [XLA:CPU] Disable AVX512 in XLA:CPU due to miscompilations. PiperOrigin-RevId: 256377398 --- .../compiler/xla/service/cpu/simple_orc_jit.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tensorflow/compiler/xla/service/cpu/simple_orc_jit.cc b/tensorflow/compiler/xla/service/cpu/simple_orc_jit.cc index d8b27f32e75..bf55e9e22cf 100644 --- a/tensorflow/compiler/xla/service/cpu/simple_orc_jit.cc +++ b/tensorflow/compiler/xla/service/cpu/simple_orc_jit.cc @@ -56,12 +56,24 @@ llvm::SmallVector DetectMachineAttributes() { if (llvm::sys::getHostCPUFeatures(host_features)) { for (auto& feature : host_features) { if (feature.second) { - result.push_back(feature.first()); + llvm::StringRef feature_name = feature.first(); + // Skip avx512 for now, it isn't quite ready in LLVM. + if (feature_name.startswith("avx512")) { + continue; + } + result.push_back(feature_name); } } } return result; } + +llvm::StringRef GetHostCpuName() { + auto cpu_name = llvm::sys::getHostCPUName(); + // Skip avx512 for now, it isn't quite ready in LLVM. + cpu_name.consume_back("-avx512"); + return cpu_name; +} } // namespace /*static*/ std::unique_ptr @@ -74,7 +86,7 @@ SimpleOrcJIT::InferTargetMachineForJIT( .setOptLevel(opt_level) .selectTarget( /*TargetTriple=*/llvm::Triple(), /*MArch=*/"", - /*MCPU=*/llvm::sys::getHostCPUName(), + /*MCPU=*/GetHostCpuName(), /*MAttrs=*/DetectMachineAttributes())); CHECK(target_machine != nullptr); return target_machine;