mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-12 15:46:54 +08:00
Improved code [skip ci]
This commit is contained in:
@@ -118,11 +118,11 @@ HalfvecInnerProductF16cFma(int dim, half * ax, half * bx)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HALFVEC_DISPATCH
|
#ifdef HALFVEC_DISPATCH
|
||||||
#define FEATURE_FMA (1 << 12)
|
#define CPU_FEATURE_FMA (1 << 12)
|
||||||
#define FEATURE_F16C (1 << 29)
|
#define CPU_FEATURE_F16C (1 << 29)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
SupportsFeature(unsigned int feature)
|
SupportsCpuFeature(unsigned int feature)
|
||||||
{
|
{
|
||||||
unsigned int exx[4] = {0, 0, 0, 0};
|
unsigned int exx[4] = {0, 0, 0, 0};
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ HalfvecInit(void)
|
|||||||
HalfvecInnerProduct = HalfvecInnerProductDefault;
|
HalfvecInnerProduct = HalfvecInnerProductDefault;
|
||||||
|
|
||||||
#ifdef HALFVEC_DISPATCH
|
#ifdef HALFVEC_DISPATCH
|
||||||
if (SupportsFeature(FEATURE_FMA | FEATURE_F16C))
|
if (SupportsCpuFeature(CPU_FEATURE_FMA | CPU_FEATURE_F16C))
|
||||||
{
|
{
|
||||||
HalfvecL2SquaredDistance = HalfvecL2SquaredDistanceF16cFma;
|
HalfvecL2SquaredDistance = HalfvecL2SquaredDistanceF16cFma;
|
||||||
HalfvecInnerProduct = HalfvecInnerProductF16cFma;
|
HalfvecInnerProduct = HalfvecInnerProductF16cFma;
|
||||||
|
|||||||
Reference in New Issue
Block a user