mirror of
https://github.com/nomic-ai/gpt4all.git
synced 2025-09-11 21:39:11 +00:00
mixpanel: report cpu_supports_avx2 on startup (#2299)
Signed-off-by: Jared Van Bortel <jared@nomic.ai>
This commit is contained in:
@@ -33,13 +33,13 @@ std::string s_implementations_search_path = ".";
|
|||||||
}
|
}
|
||||||
|
|
||||||
// AVX via EAX=1: Processor Info and Feature Bits, bit 28 of ECX
|
// AVX via EAX=1: Processor Info and Feature Bits, bit 28 of ECX
|
||||||
#define cpu_supports_avx() (get_cpu_info(1, 2) & (1 << 28))
|
#define cpu_supports_avx() !!(get_cpu_info(1, 2) & (1 << 28))
|
||||||
// AVX2 via EAX=7, ECX=0: Extended Features, bit 5 of EBX
|
// AVX2 via EAX=7, ECX=0: Extended Features, bit 5 of EBX
|
||||||
#define cpu_supports_avx2() (get_cpu_info(7, 1) & (1 << 5))
|
#define cpu_supports_avx2() !!(get_cpu_info(7, 1) & (1 << 5))
|
||||||
#else
|
#else
|
||||||
// gcc/clang
|
// gcc/clang
|
||||||
#define cpu_supports_avx() __builtin_cpu_supports("avx")
|
#define cpu_supports_avx() !!__builtin_cpu_supports("avx")
|
||||||
#define cpu_supports_avx2() __builtin_cpu_supports("avx2")
|
#define cpu_supports_avx2() !!__builtin_cpu_supports("avx2")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LLModel::Implementation::Implementation(Dlhandle &&dlhandle_)
|
LLModel::Implementation::Implementation(Dlhandle &&dlhandle_)
|
||||||
@@ -260,3 +260,7 @@ const std::string& LLModel::Implementation::implementationsSearchPath() {
|
|||||||
bool LLModel::Implementation::hasSupportedCPU() {
|
bool LLModel::Implementation::hasSupportedCPU() {
|
||||||
return cpu_supports_avx() != 0;
|
return cpu_supports_avx() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int LLModel::Implementation::cpuSupportsAVX2() {
|
||||||
|
return cpu_supports_avx2();
|
||||||
|
}
|
||||||
|
@@ -68,6 +68,8 @@ public:
|
|||||||
static void setImplementationsSearchPath(const std::string &path);
|
static void setImplementationsSearchPath(const std::string &path);
|
||||||
static const std::string &implementationsSearchPath();
|
static const std::string &implementationsSearchPath();
|
||||||
static bool hasSupportedCPU();
|
static bool hasSupportedCPU();
|
||||||
|
// 0 for no, 1 for yes, -1 for non-x86_64
|
||||||
|
static int cpuSupportsAVX2();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Implementation(Dlhandle &&);
|
Implementation(Dlhandle &&);
|
||||||
|
@@ -259,6 +259,7 @@ void Network::sendStartup()
|
|||||||
{"display", QString("%1x%2").arg(display->size().width()).arg(display->size().height())},
|
{"display", QString("%1x%2").arg(display->size().width()).arg(display->size().height())},
|
||||||
{"ram", LLM::globalInstance()->systemTotalRAMInGB()},
|
{"ram", LLM::globalInstance()->systemTotalRAMInGB()},
|
||||||
{"cpu", getCPUModel()},
|
{"cpu", getCPUModel()},
|
||||||
|
{"cpu_supports_avx2", LLModel::Implementation::cpuSupportsAVX2()},
|
||||||
{"datalake_active", mySettings->networkIsActive()},
|
{"datalake_active", mySettings->networkIsActive()},
|
||||||
});
|
});
|
||||||
sendIpify();
|
sendIpify();
|
||||||
|
Reference in New Issue
Block a user