File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ bool AVXCapable() {
8484 uint64_t xcrFeatureMask = xgetbv (_XCR_XFEATURE_ENABLED_MASK);
8585 avxSupported = (xcrFeatureMask & 0x6 ) == 0x6 ;
8686 }
87- return avxSupported;
87+ return HW_AVX && avxSupported;
8888}
8989
9090bool AVX512Capable () {
@@ -96,8 +96,8 @@ bool AVX512Capable() {
9696 cpuid (cpuInfo, 0 , 0 );
9797 int nIds = cpuInfo[0 ];
9898
99- bool HW_AVX512F = false ; // AVX512 Foundation
100- if (nIds >= 0x00000007 ) {
99+ bool HW_AVX512F = false ;
100+ if (nIds >= 0x00000007 ) { // AVX512 Foundation
101101 cpuid (cpuInfo, 0x00000007 , 0 );
102102 HW_AVX512F = (cpuInfo[1 ] & ((int )1 << 16 )) != 0 ;
103103 }
@@ -108,13 +108,12 @@ bool AVX512Capable() {
108108 bool osUsesXSAVE_XRSTORE = (cpuInfo[2 ] & (1 << 27 )) != 0 ;
109109 bool cpuAVXSuport = (cpuInfo[2 ] & (1 << 28 )) != 0 ;
110110
111- bool avxSupported = false ;
112111 bool avx512Supported = false ;
113112 if (osUsesXSAVE_XRSTORE && cpuAVXSuport) {
114113 uint64_t xcrFeatureMask = xgetbv (_XCR_XFEATURE_ENABLED_MASK);
115114 avx512Supported = (xcrFeatureMask & 0xe6 ) == 0xe6 ;
116115 }
117- return avx512Supported;
116+ return HW_AVX512F && avx512Supported;
118117}
119118
120119namespace hnswlib {
You can’t perform that action at this time.
0 commit comments