[XLA:CPU] Disable AVX512 in XLA:CPU due to miscompilations.
PiperOrigin-RevId: 256377398
This commit is contained in:
parent
6f0584298b
commit
7a8fd724ea
@ -56,12 +56,24 @@ llvm::SmallVector<std::string, 0> 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<llvm::TargetMachine>
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user