mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 23:56:55 +08:00
Improved check [skip ci]
This commit is contained in:
@@ -192,13 +192,13 @@ HalfvecCosineSimilarityF16cFma(int dim, half * ax, half * bx)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HALFVEC_DISPATCH
|
#ifdef HALFVEC_DISPATCH
|
||||||
#define CPU_FEATURE_FMA (1 << 12)
|
#define CPU_FEATURE_FMA (1 << 12)
|
||||||
#define CPU_FEATURE_F16C (1 << 29)
|
#define CPU_FEATURE_OSXSAVE (1 << 27)
|
||||||
|
#define CPU_FEATURE_F16C (1 << 29)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
SupportsCpuFeature(unsigned int feature)
|
SupportsCpuFeature(unsigned int feature)
|
||||||
{
|
{
|
||||||
/* TODO Fix check */
|
|
||||||
unsigned int exx[4] = {0, 0, 0, 0};
|
unsigned int exx[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
#if defined(HAVE__GET_CPUID)
|
#if defined(HAVE__GET_CPUID)
|
||||||
@@ -207,6 +207,12 @@ SupportsCpuFeature(unsigned int feature)
|
|||||||
__cpuid(exx, 1);
|
__cpuid(exx, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if ((exx[2] & CPU_FEATURE_OSXSAVE) != CPU_FEATURE_OSXSAVE)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if ((_xgetbv(0) & 6) != 6)
|
||||||
|
return false;
|
||||||
|
|
||||||
return (exx[2] & feature) == feature;
|
return (exx[2] & feature) == feature;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user