mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-08-28 12:30:40 +00:00
Fix Windows unable to load models on older Windows builds
- Replace high-level IsProcessorFeaturePresent - Reintroduce low-level compiler intrinsics implementation
This commit is contained in:
parent
0f2bb506a8
commit
108d950874
@ -11,8 +11,7 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#include <windows.h>
|
#include <intrin.h>
|
||||||
#include <processthreadsapi.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string s_implementations_search_path = ".";
|
std::string s_implementations_search_path = ".";
|
||||||
@ -22,7 +21,9 @@ static bool has_at_least_minimal_hardware() {
|
|||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
return __builtin_cpu_supports("avx");
|
return __builtin_cpu_supports("avx");
|
||||||
#else
|
#else
|
||||||
return IsProcessorFeaturePresent(PF_AVX_INSTRUCTIONS_AVAILABLE);
|
int cpuInfo[4];
|
||||||
|
__cpuid(cpuInfo, 1);
|
||||||
|
return cpuInfo[2] & (1 << 28);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
return true; // Don't know how to handle non-x86_64
|
return true; // Don't know how to handle non-x86_64
|
||||||
@ -34,7 +35,9 @@ static bool requires_avxonly() {
|
|||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
return !__builtin_cpu_supports("avx2");
|
return !__builtin_cpu_supports("avx2");
|
||||||
#else
|
#else
|
||||||
return !IsProcessorFeaturePresent(PF_AVX2_INSTRUCTIONS_AVAILABLE);
|
int cpuInfo[4];
|
||||||
|
__cpuidex(cpuInfo, 7, 0);
|
||||||
|
return !(cpuInfo[1] & (1 << 5));
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
return false; // Don't know how to handle non-x86_64
|
return false; // Don't know how to handle non-x86_64
|
||||||
|
Loading…
Reference in New Issue
Block a user