File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -2315,6 +2315,16 @@ TVM_REGISTER_GLOBAL("tvm.codegen.llvm.GetHostCPUName").set_body_typed([]() -> st
23152315
23162316TVM_REGISTER_GLOBAL (" tvm.codegen.llvm.GetHostCPUFeatures" )
23172317 .set_body_typed ([]() -> Map<String, IntImm> {
2318+ #if TVM_LLVM_VERSION >= 200
2319+ Map<String, IntImm> ret;
2320+ auto features = llvm::sys::getHostCPUFeatures ();
2321+ for (auto it = features.begin (); it != features.end (); ++it) {
2322+ std::string name = it->getKey ().str ();
2323+ bool value = it->getValue ();
2324+ ret.Set (name, IntImm (DataType::Bool (), value));
2325+ }
2326+ return ret;
2327+ #else
23182328 llvm::StringMap<bool > features;
23192329 if (llvm::sys::getHostCPUFeatures (features)) {
23202330 Map<String, IntImm> ret;
@@ -2325,6 +2335,7 @@ TVM_REGISTER_GLOBAL("tvm.codegen.llvm.GetHostCPUFeatures")
23252335 }
23262336 return ret;
23272337 }
2338+ #endif
23282339 LOG (WARNING) << " Current version of LLVM does not support feature detection on your CPU" ;
23292340 return {};
23302341 });
You can’t perform that action at this time.
0 commit comments