We no longer have an avx_only repository and better error handling for minimum hardware requirements. (#833)

This commit is contained in:
AT
2023-06-04 15:28:58 -04:00
committed by GitHub
parent 9f590db98d
commit 5f95aa9fc6
6 changed files with 33 additions and 29 deletions

View File

@@ -11,6 +11,20 @@
std::string LLModel::m_implementations_search_path = ".";
static bool has_at_least_minimal_hardware() {
#ifdef __x86_64__
#ifndef _MSC_VER
return __builtin_cpu_supports("avx");
#else
int cpuInfo[4];
__cpuid(cpuInfo, 1);
return cpuInfo[2] & (1 << 28);
#endif
#else
return true; // Don't know how to handle non-x86_64
#endif
}
static bool requires_avxonly() {
#ifdef __x86_64__
#ifndef _MSC_VER
@@ -98,6 +112,10 @@ const LLModel::Implementation* LLModel::implementation(std::ifstream& f, const s
}
LLModel *LLModel::construct(const std::string &modelPath, std::string buildVariant) {
if (!has_at_least_minimal_hardware())
return nullptr;
//TODO: Auto-detect CUDA/OpenCL
if (buildVariant == "auto") {
if (requires_avxonly()) {