Skip to content

Commit

Permalink
[Fix][LLVM] Fix getHostCPUFeatures LLVM version cutoff (#17403)
Browse files Browse the repository at this point in the history
This PR fixes the LLVM version cutoff for `llvm::sys::getHostCPUFeatures`.
Previously the cutoff version is set to 20.0, assuming that the
signature change happens since LLVM 20.0.
While actually the signature change happens at 19.0.

Reference:
* LLVM 18.1.8 https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/include/llvm/TargetParser/Host.h#L56
* LLVM 19.1.0 https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0-rc1/llvm/include/llvm/TargetParser/Host.h#L55
  • Loading branch information
MasterJH5574 authored Sep 23, 2024
1 parent ce46185 commit 66b21d3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/target/llvm/codegen_llvm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2315,7 +2315,7 @@ TVM_REGISTER_GLOBAL("tvm.codegen.llvm.GetHostCPUName").set_body_typed([]() -> st

TVM_REGISTER_GLOBAL("tvm.codegen.llvm.GetHostCPUFeatures")
.set_body_typed([]() -> Map<String, IntImm> {
#if TVM_LLVM_VERSION >= 200
#if TVM_LLVM_VERSION >= 190
Map<String, IntImm> ret;
auto features = llvm::sys::getHostCPUFeatures();
for (auto it = features.begin(); it != features.end(); ++it) {
Expand Down

0 comments on commit 66b21d3

Please sign in to comment.