faiss 0.3.1 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/LICENSE.txt +1 -1
- data/lib/faiss/version.rb +1 -1
- data/vendor/faiss/faiss/AutoTune.cpp +2 -2
- data/vendor/faiss/faiss/AutoTune.h +3 -3
- data/vendor/faiss/faiss/Clustering.cpp +37 -6
- data/vendor/faiss/faiss/Clustering.h +12 -3
- data/vendor/faiss/faiss/IVFlib.cpp +6 -3
- data/vendor/faiss/faiss/IVFlib.h +2 -2
- data/vendor/faiss/faiss/Index.cpp +6 -2
- data/vendor/faiss/faiss/Index.h +30 -8
- data/vendor/faiss/faiss/Index2Layer.cpp +2 -2
- data/vendor/faiss/faiss/Index2Layer.h +2 -2
- data/vendor/faiss/faiss/IndexAdditiveQuantizer.cpp +7 -7
- data/vendor/faiss/faiss/IndexAdditiveQuantizer.h +2 -2
- data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.cpp +14 -16
- data/vendor/faiss/faiss/IndexAdditiveQuantizerFastScan.h +2 -2
- data/vendor/faiss/faiss/IndexBinary.cpp +13 -2
- data/vendor/faiss/faiss/IndexBinary.h +8 -2
- data/vendor/faiss/faiss/IndexBinaryFlat.cpp +2 -3
- data/vendor/faiss/faiss/IndexBinaryFlat.h +2 -2
- data/vendor/faiss/faiss/IndexBinaryFromFloat.cpp +2 -2
- data/vendor/faiss/faiss/IndexBinaryFromFloat.h +2 -2
- data/vendor/faiss/faiss/IndexBinaryHNSW.cpp +2 -7
- data/vendor/faiss/faiss/IndexBinaryHNSW.h +3 -3
- data/vendor/faiss/faiss/IndexBinaryHash.cpp +2 -3
- data/vendor/faiss/faiss/IndexBinaryHash.h +2 -2
- data/vendor/faiss/faiss/IndexBinaryIVF.cpp +3 -3
- data/vendor/faiss/faiss/IndexBinaryIVF.h +2 -2
- data/vendor/faiss/faiss/IndexFastScan.cpp +32 -18
- data/vendor/faiss/faiss/IndexFastScan.h +11 -2
- data/vendor/faiss/faiss/IndexFlat.cpp +13 -10
- data/vendor/faiss/faiss/IndexFlat.h +2 -2
- data/vendor/faiss/faiss/IndexFlatCodes.cpp +170 -7
- data/vendor/faiss/faiss/IndexFlatCodes.h +25 -5
- data/vendor/faiss/faiss/IndexHNSW.cpp +156 -96
- data/vendor/faiss/faiss/IndexHNSW.h +54 -5
- data/vendor/faiss/faiss/IndexIDMap.cpp +19 -3
- data/vendor/faiss/faiss/IndexIDMap.h +5 -2
- data/vendor/faiss/faiss/IndexIVF.cpp +5 -6
- data/vendor/faiss/faiss/IndexIVF.h +13 -4
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.cpp +21 -7
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizer.h +5 -2
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.cpp +3 -14
- data/vendor/faiss/faiss/IndexIVFAdditiveQuantizerFastScan.h +2 -4
- data/vendor/faiss/faiss/IndexIVFFastScan.cpp +201 -91
- data/vendor/faiss/faiss/IndexIVFFastScan.h +33 -9
- data/vendor/faiss/faiss/IndexIVFFlat.cpp +2 -2
- data/vendor/faiss/faiss/IndexIVFFlat.h +2 -2
- data/vendor/faiss/faiss/IndexIVFIndependentQuantizer.cpp +2 -2
- data/vendor/faiss/faiss/IndexIVFIndependentQuantizer.h +2 -2
- data/vendor/faiss/faiss/IndexIVFPQ.cpp +3 -6
- data/vendor/faiss/faiss/IndexIVFPQ.h +2 -2
- data/vendor/faiss/faiss/IndexIVFPQFastScan.cpp +7 -14
- data/vendor/faiss/faiss/IndexIVFPQFastScan.h +2 -4
- data/vendor/faiss/faiss/IndexIVFPQR.cpp +2 -2
- data/vendor/faiss/faiss/IndexIVFPQR.h +2 -2
- data/vendor/faiss/faiss/IndexIVFSpectralHash.cpp +2 -3
- data/vendor/faiss/faiss/IndexIVFSpectralHash.h +2 -2
- data/vendor/faiss/faiss/IndexLSH.cpp +2 -3
- data/vendor/faiss/faiss/IndexLSH.h +2 -2
- data/vendor/faiss/faiss/IndexLattice.cpp +3 -21
- data/vendor/faiss/faiss/IndexLattice.h +5 -24
- data/vendor/faiss/faiss/IndexNNDescent.cpp +2 -31
- data/vendor/faiss/faiss/IndexNNDescent.h +3 -3
- data/vendor/faiss/faiss/IndexNSG.cpp +2 -5
- data/vendor/faiss/faiss/IndexNSG.h +3 -3
- data/vendor/faiss/faiss/IndexNeuralNetCodec.cpp +56 -0
- data/vendor/faiss/faiss/IndexNeuralNetCodec.h +49 -0
- data/vendor/faiss/faiss/IndexPQ.cpp +26 -26
- data/vendor/faiss/faiss/IndexPQ.h +2 -2
- data/vendor/faiss/faiss/IndexPQFastScan.cpp +2 -5
- data/vendor/faiss/faiss/IndexPQFastScan.h +2 -11
- data/vendor/faiss/faiss/IndexPreTransform.cpp +2 -2
- data/vendor/faiss/faiss/IndexPreTransform.h +3 -3
- data/vendor/faiss/faiss/IndexRefine.cpp +46 -9
- data/vendor/faiss/faiss/IndexRefine.h +9 -2
- data/vendor/faiss/faiss/IndexReplicas.cpp +2 -2
- data/vendor/faiss/faiss/IndexReplicas.h +2 -2
- data/vendor/faiss/faiss/IndexRowwiseMinMax.cpp +2 -2
- data/vendor/faiss/faiss/IndexRowwiseMinMax.h +2 -2
- data/vendor/faiss/faiss/IndexScalarQuantizer.cpp +5 -4
- data/vendor/faiss/faiss/IndexScalarQuantizer.h +2 -2
- data/vendor/faiss/faiss/IndexShards.cpp +2 -2
- data/vendor/faiss/faiss/IndexShards.h +2 -2
- data/vendor/faiss/faiss/IndexShardsIVF.cpp +2 -2
- data/vendor/faiss/faiss/IndexShardsIVF.h +2 -2
- data/vendor/faiss/faiss/MatrixStats.cpp +2 -2
- data/vendor/faiss/faiss/MatrixStats.h +2 -2
- data/vendor/faiss/faiss/MetaIndexes.cpp +2 -3
- data/vendor/faiss/faiss/MetaIndexes.h +2 -2
- data/vendor/faiss/faiss/MetricType.h +9 -4
- data/vendor/faiss/faiss/VectorTransform.cpp +2 -2
- data/vendor/faiss/faiss/VectorTransform.h +2 -2
- data/vendor/faiss/faiss/clone_index.cpp +2 -2
- data/vendor/faiss/faiss/clone_index.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/SaDecodeKernels.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/detail/CoarseBitType.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/detail/UintReader.h +97 -19
- data/vendor/faiss/faiss/cppcontrib/factory_tools.cpp +192 -0
- data/vendor/faiss/faiss/cppcontrib/factory_tools.h +29 -0
- data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-avx2-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-inl.h +85 -32
- data/vendor/faiss/faiss/cppcontrib/sa_decode/Level2-neon-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/MinMax-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/MinMaxFP16-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-avx2-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-inl.h +2 -2
- data/vendor/faiss/faiss/cppcontrib/sa_decode/PQ-neon-inl.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuAutoTune.cpp +2 -5
- data/vendor/faiss/faiss/gpu/GpuAutoTune.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuCloner.cpp +45 -13
- data/vendor/faiss/faiss/gpu/GpuCloner.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuClonerOptions.h +12 -6
- data/vendor/faiss/faiss/gpu/GpuDistance.h +11 -7
- data/vendor/faiss/faiss/gpu/GpuFaissAssert.h +3 -3
- data/vendor/faiss/faiss/gpu/GpuIcmEncoder.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndex.h +10 -15
- data/vendor/faiss/faiss/gpu/GpuIndexBinaryFlat.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndexCagra.h +285 -0
- data/vendor/faiss/faiss/gpu/GpuIndexFlat.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndexIVF.h +8 -2
- data/vendor/faiss/faiss/gpu/GpuIndexIVFFlat.h +4 -2
- data/vendor/faiss/faiss/gpu/GpuIndexIVFPQ.h +3 -3
- data/vendor/faiss/faiss/gpu/GpuIndexIVFScalarQuantizer.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuIndicesOptions.h +2 -2
- data/vendor/faiss/faiss/gpu/GpuResources.cpp +7 -2
- data/vendor/faiss/faiss/gpu/GpuResources.h +11 -4
- data/vendor/faiss/faiss/gpu/StandardGpuResources.cpp +66 -11
- data/vendor/faiss/faiss/gpu/StandardGpuResources.h +15 -5
- data/vendor/faiss/faiss/gpu/impl/IndexUtils.h +2 -2
- data/vendor/faiss/faiss/gpu/impl/InterleavedCodes.cpp +28 -23
- data/vendor/faiss/faiss/gpu/impl/InterleavedCodes.h +2 -2
- data/vendor/faiss/faiss/gpu/impl/RemapIndices.cpp +2 -2
- data/vendor/faiss/faiss/gpu/impl/RemapIndices.h +2 -2
- data/vendor/faiss/faiss/gpu/perf/IndexWrapper-inl.h +2 -2
- data/vendor/faiss/faiss/gpu/perf/IndexWrapper.h +2 -2
- data/vendor/faiss/faiss/gpu/perf/PerfClustering.cpp +8 -2
- data/vendor/faiss/faiss/gpu/perf/PerfIVFPQAdd.cpp +2 -3
- data/vendor/faiss/faiss/gpu/perf/WriteIndex.cpp +2 -2
- data/vendor/faiss/faiss/gpu/test/TestCodePacking.cpp +10 -7
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexBinaryFlat.cpp +2 -2
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexFlat.cpp +54 -54
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFFlat.cpp +144 -77
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFPQ.cpp +51 -51
- data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFScalarQuantizer.cpp +2 -2
- data/vendor/faiss/faiss/gpu/test/TestGpuMemoryException.cpp +3 -3
- data/vendor/faiss/faiss/gpu/test/TestGpuResidualQuantizer.cpp +70 -0
- data/vendor/faiss/faiss/gpu/test/TestUtils.cpp +74 -4
- data/vendor/faiss/faiss/gpu/test/TestUtils.h +2 -2
- data/vendor/faiss/faiss/gpu/test/demo_ivfpq_indexing_gpu.cpp +3 -3
- data/vendor/faiss/faiss/gpu/utils/{RaftUtils.h → CuvsUtils.h} +12 -11
- data/vendor/faiss/faiss/gpu/utils/DeviceUtils.h +8 -2
- data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.cpp +2 -2
- data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.h +2 -2
- data/vendor/faiss/faiss/gpu/utils/StaticUtils.h +2 -2
- data/vendor/faiss/faiss/gpu/utils/Timer.cpp +6 -3
- data/vendor/faiss/faiss/gpu/utils/Timer.h +3 -3
- data/vendor/faiss/faiss/impl/AdditiveQuantizer.cpp +79 -11
- data/vendor/faiss/faiss/impl/AdditiveQuantizer.h +17 -5
- data/vendor/faiss/faiss/impl/AuxIndexStructures.cpp +27 -2
- data/vendor/faiss/faiss/impl/AuxIndexStructures.h +11 -3
- data/vendor/faiss/faiss/impl/CodePacker.cpp +2 -2
- data/vendor/faiss/faiss/impl/CodePacker.h +2 -2
- data/vendor/faiss/faiss/impl/DistanceComputer.h +48 -2
- data/vendor/faiss/faiss/impl/FaissAssert.h +6 -4
- data/vendor/faiss/faiss/impl/FaissException.cpp +2 -2
- data/vendor/faiss/faiss/impl/FaissException.h +2 -3
- data/vendor/faiss/faiss/impl/HNSW.cpp +378 -205
- data/vendor/faiss/faiss/impl/HNSW.h +55 -24
- data/vendor/faiss/faiss/impl/IDSelector.cpp +2 -2
- data/vendor/faiss/faiss/impl/IDSelector.h +2 -2
- data/vendor/faiss/faiss/impl/LocalSearchQuantizer.cpp +10 -10
- data/vendor/faiss/faiss/impl/LocalSearchQuantizer.h +2 -2
- data/vendor/faiss/faiss/impl/LookupTableScaler.h +36 -2
- data/vendor/faiss/faiss/impl/NNDescent.cpp +15 -10
- data/vendor/faiss/faiss/impl/NNDescent.h +2 -2
- data/vendor/faiss/faiss/impl/NSG.cpp +26 -49
- data/vendor/faiss/faiss/impl/NSG.h +20 -8
- data/vendor/faiss/faiss/impl/PolysemousTraining.cpp +2 -2
- data/vendor/faiss/faiss/impl/PolysemousTraining.h +2 -2
- data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.cpp +2 -4
- data/vendor/faiss/faiss/impl/ProductAdditiveQuantizer.h +2 -2
- data/vendor/faiss/faiss/impl/ProductQuantizer-inl.h +2 -2
- data/vendor/faiss/faiss/impl/ProductQuantizer.cpp +3 -2
- data/vendor/faiss/faiss/impl/ProductQuantizer.h +7 -3
- data/vendor/faiss/faiss/impl/Quantizer.h +2 -2
- data/vendor/faiss/faiss/impl/ResidualQuantizer.cpp +2 -36
- data/vendor/faiss/faiss/impl/ResidualQuantizer.h +3 -13
- data/vendor/faiss/faiss/impl/ResultHandler.h +153 -34
- data/vendor/faiss/faiss/impl/ScalarQuantizer.cpp +721 -104
- data/vendor/faiss/faiss/impl/ScalarQuantizer.h +5 -2
- data/vendor/faiss/faiss/impl/ThreadedIndex-inl.h +2 -2
- data/vendor/faiss/faiss/impl/ThreadedIndex.h +2 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-avx2.h +7 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-avx512.h +248 -0
- data/vendor/faiss/faiss/impl/code_distance/code_distance-generic.h +2 -2
- data/vendor/faiss/faiss/impl/code_distance/code_distance-sve.h +440 -0
- data/vendor/faiss/faiss/impl/code_distance/code_distance.h +55 -2
- data/vendor/faiss/faiss/impl/index_read.cpp +31 -20
- data/vendor/faiss/faiss/impl/index_read_utils.h +37 -0
- data/vendor/faiss/faiss/impl/index_write.cpp +30 -16
- data/vendor/faiss/faiss/impl/io.cpp +15 -7
- data/vendor/faiss/faiss/impl/io.h +6 -6
- data/vendor/faiss/faiss/impl/io_macros.h +8 -9
- data/vendor/faiss/faiss/impl/kmeans1d.cpp +2 -3
- data/vendor/faiss/faiss/impl/kmeans1d.h +2 -2
- data/vendor/faiss/faiss/impl/lattice_Zn.cpp +2 -3
- data/vendor/faiss/faiss/impl/lattice_Zn.h +2 -2
- data/vendor/faiss/faiss/impl/platform_macros.h +34 -2
- data/vendor/faiss/faiss/impl/pq4_fast_scan.cpp +13 -2
- data/vendor/faiss/faiss/impl/pq4_fast_scan.h +20 -2
- data/vendor/faiss/faiss/impl/pq4_fast_scan_search_1.cpp +3 -3
- data/vendor/faiss/faiss/impl/pq4_fast_scan_search_qbs.cpp +450 -3
- data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.cpp +8 -8
- data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.h +3 -3
- data/vendor/faiss/faiss/impl/simd_result_handlers.h +151 -67
- data/vendor/faiss/faiss/index_factory.cpp +51 -34
- data/vendor/faiss/faiss/index_factory.h +2 -2
- data/vendor/faiss/faiss/index_io.h +14 -7
- data/vendor/faiss/faiss/invlists/BlockInvertedLists.cpp +30 -10
- data/vendor/faiss/faiss/invlists/BlockInvertedLists.h +5 -2
- data/vendor/faiss/faiss/invlists/DirectMap.cpp +11 -3
- data/vendor/faiss/faiss/invlists/DirectMap.h +2 -2
- data/vendor/faiss/faiss/invlists/InvertedLists.cpp +57 -19
- data/vendor/faiss/faiss/invlists/InvertedLists.h +20 -11
- data/vendor/faiss/faiss/invlists/InvertedListsIOHook.cpp +2 -2
- data/vendor/faiss/faiss/invlists/InvertedListsIOHook.h +2 -2
- data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.cpp +23 -9
- data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.h +4 -3
- data/vendor/faiss/faiss/python/python_callbacks.cpp +5 -5
- data/vendor/faiss/faiss/python/python_callbacks.h +2 -2
- data/vendor/faiss/faiss/utils/AlignedTable.h +5 -3
- data/vendor/faiss/faiss/utils/Heap.cpp +2 -2
- data/vendor/faiss/faiss/utils/Heap.h +107 -2
- data/vendor/faiss/faiss/utils/NeuralNet.cpp +346 -0
- data/vendor/faiss/faiss/utils/NeuralNet.h +147 -0
- data/vendor/faiss/faiss/utils/WorkerThread.cpp +2 -2
- data/vendor/faiss/faiss/utils/WorkerThread.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/approx_topk.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/avx2-inl.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/generic.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk/mode.h +2 -2
- data/vendor/faiss/faiss/utils/approx_topk_hamming/approx_topk_hamming.h +2 -2
- data/vendor/faiss/faiss/utils/bf16.h +36 -0
- data/vendor/faiss/faiss/utils/distances.cpp +249 -90
- data/vendor/faiss/faiss/utils/distances.h +8 -8
- data/vendor/faiss/faiss/utils/distances_fused/avx512.cpp +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/avx512.h +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/distances_fused.cpp +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/distances_fused.h +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.cpp +2 -2
- data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.h +2 -2
- data/vendor/faiss/faiss/utils/distances_simd.cpp +1543 -56
- data/vendor/faiss/faiss/utils/extra_distances-inl.h +72 -2
- data/vendor/faiss/faiss/utils/extra_distances.cpp +87 -140
- data/vendor/faiss/faiss/utils/extra_distances.h +5 -4
- data/vendor/faiss/faiss/utils/fp16-arm.h +2 -2
- data/vendor/faiss/faiss/utils/fp16-fp16c.h +2 -2
- data/vendor/faiss/faiss/utils/fp16-inl.h +2 -2
- data/vendor/faiss/faiss/utils/fp16.h +2 -2
- data/vendor/faiss/faiss/utils/hamming-inl.h +2 -2
- data/vendor/faiss/faiss/utils/hamming.cpp +3 -4
- data/vendor/faiss/faiss/utils/hamming.h +2 -2
- data/vendor/faiss/faiss/utils/hamming_distance/avx2-inl.h +2 -2
- data/vendor/faiss/faiss/utils/hamming_distance/avx512-inl.h +490 -0
- data/vendor/faiss/faiss/utils/hamming_distance/common.h +2 -2
- data/vendor/faiss/faiss/utils/hamming_distance/generic-inl.h +6 -3
- data/vendor/faiss/faiss/utils/hamming_distance/hamdis-inl.h +7 -3
- data/vendor/faiss/faiss/utils/hamming_distance/neon-inl.h +5 -5
- data/vendor/faiss/faiss/utils/ordered_key_value.h +2 -2
- data/vendor/faiss/faiss/utils/partitioning.cpp +2 -2
- data/vendor/faiss/faiss/utils/partitioning.h +2 -2
- data/vendor/faiss/faiss/utils/prefetch.h +2 -2
- data/vendor/faiss/faiss/utils/quantize_lut.cpp +2 -2
- data/vendor/faiss/faiss/utils/quantize_lut.h +2 -2
- data/vendor/faiss/faiss/utils/random.cpp +45 -2
- data/vendor/faiss/faiss/utils/random.h +27 -2
- data/vendor/faiss/faiss/utils/simdlib.h +12 -3
- data/vendor/faiss/faiss/utils/simdlib_avx2.h +2 -2
- data/vendor/faiss/faiss/utils/simdlib_avx512.h +296 -0
- data/vendor/faiss/faiss/utils/simdlib_emulated.h +2 -2
- data/vendor/faiss/faiss/utils/simdlib_neon.h +7 -4
- data/vendor/faiss/faiss/utils/simdlib_ppc64.h +1084 -0
- data/vendor/faiss/faiss/utils/sorting.cpp +2 -2
- data/vendor/faiss/faiss/utils/sorting.h +2 -2
- data/vendor/faiss/faiss/utils/transpose/transpose-avx2-inl.h +2 -2
- data/vendor/faiss/faiss/utils/transpose/transpose-avx512-inl.h +176 -0
- data/vendor/faiss/faiss/utils/utils.cpp +17 -10
- data/vendor/faiss/faiss/utils/utils.h +7 -3
- metadata +22 -11
- data/vendor/faiss/faiss/impl/code_distance/code_distance_avx512.h +0 -102
@@ -0,0 +1,176 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
|
+
*
|
4
|
+
* This source code is licensed under the MIT license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#pragma once
|
9
|
+
|
10
|
+
// This file contains transposing kernels for AVX512 for // tiny float/int32
|
11
|
+
// matrices, such as 16x2.
|
12
|
+
|
13
|
+
#ifdef __AVX512F__
|
14
|
+
|
15
|
+
#include <immintrin.h>
|
16
|
+
|
17
|
+
namespace faiss {
|
18
|
+
|
19
|
+
// 16x2 -> 2x16
|
20
|
+
inline void transpose_16x2(
|
21
|
+
const __m512 i0,
|
22
|
+
const __m512 i1,
|
23
|
+
__m512& o0,
|
24
|
+
__m512& o1) {
|
25
|
+
// assume we have the following input:
|
26
|
+
// i0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
27
|
+
// i1: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
28
|
+
|
29
|
+
// 0 1 2 3 8 9 10 11 16 17 18 19 24 25 26 27
|
30
|
+
const __m512 r0 = _mm512_shuffle_f32x4(i0, i1, _MM_SHUFFLE(2, 0, 2, 0));
|
31
|
+
// 4 5 6 7 12 13 14 15 20 21 22 23 28 29 30 31
|
32
|
+
const __m512 r1 = _mm512_shuffle_f32x4(i0, i1, _MM_SHUFFLE(3, 1, 3, 1));
|
33
|
+
|
34
|
+
// 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
|
35
|
+
o0 = _mm512_shuffle_ps(r0, r1, _MM_SHUFFLE(2, 0, 2, 0));
|
36
|
+
// 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
|
37
|
+
o1 = _mm512_shuffle_ps(r0, r1, _MM_SHUFFLE(3, 1, 3, 1));
|
38
|
+
}
|
39
|
+
|
40
|
+
// 16x4 -> 4x16
|
41
|
+
inline void transpose_16x4(
|
42
|
+
const __m512 i0,
|
43
|
+
const __m512 i1,
|
44
|
+
const __m512 i2,
|
45
|
+
const __m512 i3,
|
46
|
+
__m512& o0,
|
47
|
+
__m512& o1,
|
48
|
+
__m512& o2,
|
49
|
+
__m512& o3) {
|
50
|
+
// assume that we have the following input:
|
51
|
+
// i0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
52
|
+
// i1: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
53
|
+
// i2: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
54
|
+
// i3: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
55
|
+
|
56
|
+
// 0 1 2 3 8 9 10 11 16 17 18 19 24 25 26 27
|
57
|
+
const __m512 r0 = _mm512_shuffle_f32x4(i0, i1, _MM_SHUFFLE(2, 0, 2, 0));
|
58
|
+
// 4 5 6 7 12 13 14 15 20 21 22 23 28 29 30 31
|
59
|
+
const __m512 r1 = _mm512_shuffle_f32x4(i0, i1, _MM_SHUFFLE(3, 1, 3, 1));
|
60
|
+
// 32 33 34 35 40 41 42 43 48 49 50 51 56 57 58 59
|
61
|
+
const __m512 r2 = _mm512_shuffle_f32x4(i2, i3, _MM_SHUFFLE(2, 0, 2, 0));
|
62
|
+
// 52 53 54 55 60 61 62 63 52 53 54 55 60 61 62 63
|
63
|
+
const __m512 r3 = _mm512_shuffle_f32x4(i2, i3, _MM_SHUFFLE(3, 1, 3, 1));
|
64
|
+
|
65
|
+
// 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
|
66
|
+
const __m512 t0 = _mm512_shuffle_ps(r0, r1, _MM_SHUFFLE(2, 0, 2, 0));
|
67
|
+
// 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31
|
68
|
+
const __m512 t1 = _mm512_shuffle_ps(r0, r1, _MM_SHUFFLE(3, 1, 3, 1));
|
69
|
+
// 32 34 52 54 40 42 60 62 48 50 52 54 56 58 60 62
|
70
|
+
const __m512 t2 = _mm512_shuffle_ps(r2, r3, _MM_SHUFFLE(2, 0, 2, 0));
|
71
|
+
// 33 35 53 55 41 43 61 63 49 51 53 55 57 59 61 63
|
72
|
+
const __m512 t3 = _mm512_shuffle_ps(r2, r3, _MM_SHUFFLE(3, 1, 3, 1));
|
73
|
+
|
74
|
+
const __m512i idx0 = _mm512_set_epi32(
|
75
|
+
30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0);
|
76
|
+
const __m512i idx1 = _mm512_set_epi32(
|
77
|
+
31, 29, 27, 25, 23, 21, 19, 17, 15, 13, 11, 9, 7, 5, 3, 1);
|
78
|
+
|
79
|
+
// 0 4 8 12 16 20 24 28 32 52 40 60 48 52 56 60
|
80
|
+
o0 = _mm512_permutex2var_ps(t0, idx0, t2);
|
81
|
+
// 1 5 9 13 17 21 25 29 33 53 41 61 49 53 57 61
|
82
|
+
o1 = _mm512_permutex2var_ps(t1, idx0, t3);
|
83
|
+
// 2 6 10 14 18 22 26 30 34 54 42 62 50 54 58 62
|
84
|
+
o2 = _mm512_permutex2var_ps(t0, idx1, t2);
|
85
|
+
// 3 7 11 15 19 23 27 31 35 55 43 63 51 55 59 63
|
86
|
+
o3 = _mm512_permutex2var_ps(t1, idx1, t3);
|
87
|
+
}
|
88
|
+
|
89
|
+
// 16x8 -> 8x16 transpose
|
90
|
+
inline void transpose_16x8(
|
91
|
+
const __m512 i0,
|
92
|
+
const __m512 i1,
|
93
|
+
const __m512 i2,
|
94
|
+
const __m512 i3,
|
95
|
+
const __m512 i4,
|
96
|
+
const __m512 i5,
|
97
|
+
const __m512 i6,
|
98
|
+
const __m512 i7,
|
99
|
+
__m512& o0,
|
100
|
+
__m512& o1,
|
101
|
+
__m512& o2,
|
102
|
+
__m512& o3,
|
103
|
+
__m512& o4,
|
104
|
+
__m512& o5,
|
105
|
+
__m512& o6,
|
106
|
+
__m512& o7) {
|
107
|
+
// assume that we have the following input:
|
108
|
+
// i0: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
109
|
+
// i1: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
110
|
+
// i2: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
111
|
+
// i3: 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
112
|
+
// i4: 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
113
|
+
// i5: 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
114
|
+
// i6: 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
115
|
+
// i7: 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
|
116
|
+
|
117
|
+
// 0 16 1 17 4 20 5 21 8 24 9 25 12 28 13 29
|
118
|
+
const __m512 r0 = _mm512_unpacklo_ps(i0, i1);
|
119
|
+
// 2 18 3 19 6 22 7 23 10 26 11 27 14 30 15 31
|
120
|
+
const __m512 r1 = _mm512_unpackhi_ps(i0, i1);
|
121
|
+
// 32 48 33 49 36 52 37 53 40 56 41 57 44 60 45 61
|
122
|
+
const __m512 r2 = _mm512_unpacklo_ps(i2, i3);
|
123
|
+
// 34 50 35 51 38 54 39 55 42 58 43 59 46 62 47 63
|
124
|
+
const __m512 r3 = _mm512_unpackhi_ps(i2, i3);
|
125
|
+
// 64 80 65 81 68 84 69 85 72 88 73 89 76 92 77 93
|
126
|
+
const __m512 r4 = _mm512_unpacklo_ps(i4, i5);
|
127
|
+
// 66 82 67 83 70 86 71 87 74 90 75 91 78 94 79 95
|
128
|
+
const __m512 r5 = _mm512_unpackhi_ps(i4, i5);
|
129
|
+
// 96 112 97 113 100 116 101 117 104 120 105 121 108 124 109 125
|
130
|
+
const __m512 r6 = _mm512_unpacklo_ps(i6, i7);
|
131
|
+
// 98 114 99 115 102 118 103 119 106 122 107 123 110 126 111 127
|
132
|
+
const __m512 r7 = _mm512_unpackhi_ps(i6, i7);
|
133
|
+
|
134
|
+
// 0 16 32 48 4 20 36 52 8 24 40 56 12 28 44 60
|
135
|
+
const __m512 t0 = _mm512_shuffle_ps(r0, r2, _MM_SHUFFLE(1, 0, 1, 0));
|
136
|
+
// 1 17 33 49 5 21 37 53 9 25 41 57 13 29 45 61
|
137
|
+
const __m512 t1 = _mm512_shuffle_ps(r0, r2, _MM_SHUFFLE(3, 2, 3, 2));
|
138
|
+
// 2 18 34 50 6 22 38 54 10 26 42 58 14 30 46 62
|
139
|
+
const __m512 t2 = _mm512_shuffle_ps(r1, r3, _MM_SHUFFLE(1, 0, 1, 0));
|
140
|
+
// 3 19 35 51 7 23 39 55 11 27 43 59 15 31 47 63
|
141
|
+
const __m512 t3 = _mm512_shuffle_ps(r1, r3, _MM_SHUFFLE(3, 2, 3, 2));
|
142
|
+
// 64 80 96 112 68 84 100 116 72 88 104 120 76 92 108 124
|
143
|
+
const __m512 t4 = _mm512_shuffle_ps(r4, r6, _MM_SHUFFLE(1, 0, 1, 0));
|
144
|
+
// 65 81 97 113 69 85 101 117 73 89 105 121 77 93 109 125
|
145
|
+
const __m512 t5 = _mm512_shuffle_ps(r4, r6, _MM_SHUFFLE(3, 2, 3, 2));
|
146
|
+
// 66 82 98 114 70 86 102 118 74 90 106 122 78 94 110 126
|
147
|
+
const __m512 t6 = _mm512_shuffle_ps(r5, r7, _MM_SHUFFLE(1, 0, 1, 0));
|
148
|
+
// 67 83 99 115 71 87 103 119 75 91 107 123 79 95 111 127
|
149
|
+
const __m512 t7 = _mm512_shuffle_ps(r5, r7, _MM_SHUFFLE(3, 2, 3, 2));
|
150
|
+
|
151
|
+
const __m512i idx0 = _mm512_set_epi32(
|
152
|
+
27, 19, 26, 18, 25, 17, 24, 16, 11, 3, 10, 2, 9, 1, 8, 0);
|
153
|
+
const __m512i idx1 = _mm512_set_epi32(
|
154
|
+
31, 23, 30, 22, 29, 21, 28, 20, 15, 7, 14, 6, 13, 5, 12, 4);
|
155
|
+
|
156
|
+
// 0 8 16 24 32 40 48 56 64 72 80 88 96 104 112 120
|
157
|
+
o0 = _mm512_permutex2var_ps(t0, idx0, t4);
|
158
|
+
// 1 9 17 25 33 41 49 57 65 73 81 89 97 105 113 121
|
159
|
+
o1 = _mm512_permutex2var_ps(t1, idx0, t5);
|
160
|
+
// 2 10 18 26 34 42 50 58 66 74 82 90 98 106 114 122
|
161
|
+
o2 = _mm512_permutex2var_ps(t2, idx0, t6);
|
162
|
+
// 3 11 19 27 35 43 51 59 67 75 83 91 99 107 115 123
|
163
|
+
o3 = _mm512_permutex2var_ps(t3, idx0, t7);
|
164
|
+
// 4 12 20 28 36 44 52 60 68 76 84 92 100 108 116 124
|
165
|
+
o4 = _mm512_permutex2var_ps(t0, idx1, t4);
|
166
|
+
// 5 13 21 29 37 45 53 61 69 77 85 93 101 109 117 125
|
167
|
+
o5 = _mm512_permutex2var_ps(t1, idx1, t5);
|
168
|
+
// 6 14 22 30 38 46 54 62 70 78 86 94 102 110 118 126
|
169
|
+
o6 = _mm512_permutex2var_ps(t2, idx1, t6);
|
170
|
+
// 7 15 23 31 39 47 55 63 71 79 87 95 103 111 119 127
|
171
|
+
o7 = _mm512_permutex2var_ps(t3, idx1, t7);
|
172
|
+
}
|
173
|
+
|
174
|
+
} // namespace faiss
|
175
|
+
|
176
|
+
#endif
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
* Copyright (c)
|
1
|
+
/*
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
// -*- c++ -*-
|
9
9
|
|
10
|
+
#include <faiss/Index.h>
|
10
11
|
#include <faiss/utils/utils.h>
|
11
12
|
|
12
13
|
#include <cassert>
|
@@ -114,10 +115,12 @@ std::string get_compile_options() {
|
|
114
115
|
options += "OPTIMIZE ";
|
115
116
|
#endif
|
116
117
|
|
117
|
-
#ifdef
|
118
|
-
options += "AVX2 ";
|
119
|
-
#elif __AVX512F__
|
118
|
+
#ifdef __AVX512F__
|
120
119
|
options += "AVX512 ";
|
120
|
+
#elif defined(__AVX2__)
|
121
|
+
options += "AVX2 ";
|
122
|
+
#elif defined(__ARM_FEATURE_SVE)
|
123
|
+
options += "SVE NEON ";
|
121
124
|
#elif defined(__aarch64__)
|
122
125
|
options += "NEON ";
|
123
126
|
#else
|
@@ -129,6 +132,10 @@ std::string get_compile_options() {
|
|
129
132
|
return options;
|
130
133
|
}
|
131
134
|
|
135
|
+
std::string get_version() {
|
136
|
+
return VERSION_STRING;
|
137
|
+
}
|
138
|
+
|
132
139
|
#ifdef _MSC_VER
|
133
140
|
double getmillisecs() {
|
134
141
|
LARGE_INTEGER ts;
|
@@ -582,9 +589,9 @@ int64_t count_gt(int64_t n, const T* row, T threshold) {
|
|
582
589
|
} // namespace
|
583
590
|
|
584
591
|
template <typename T>
|
585
|
-
void CombinerRangeKNN<T>::compute_sizes(int64_t*
|
586
|
-
this->L_res =
|
587
|
-
|
592
|
+
void CombinerRangeKNN<T>::compute_sizes(int64_t* L_res_init) {
|
593
|
+
this->L_res = L_res_init;
|
594
|
+
L_res_init[0] = 0;
|
588
595
|
int64_t j = 0;
|
589
596
|
for (int64_t i = 0; i < nq; i++) {
|
590
597
|
int64_t n_in;
|
@@ -595,11 +602,11 @@ void CombinerRangeKNN<T>::compute_sizes(int64_t* L_res_2) {
|
|
595
602
|
n_in = lim_remain[j + 1] - lim_remain[j];
|
596
603
|
j++;
|
597
604
|
}
|
598
|
-
|
605
|
+
L_res_init[i + 1] = n_in; // L_res_init[i] + n_in;
|
599
606
|
}
|
600
607
|
// cumsum
|
601
608
|
for (int64_t i = 0; i < nq; i++) {
|
602
|
-
|
609
|
+
L_res_init[i + 1] += L_res_init[i];
|
603
610
|
}
|
604
611
|
}
|
605
612
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
* Copyright (c)
|
1
|
+
/*
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
3
3
|
*
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
@@ -37,6 +37,9 @@ std::string get_compile_options();
|
|
37
37
|
* Get some stats about the system
|
38
38
|
**************************************************/
|
39
39
|
|
40
|
+
// Expose FAISS version as a string
|
41
|
+
std::string get_version();
|
42
|
+
|
40
43
|
/// ms elapsed since some arbitrary epoch
|
41
44
|
double getmillisecs();
|
42
45
|
|
@@ -87,7 +90,8 @@ size_t merge_result_table_with(
|
|
87
90
|
bool keep_min = true,
|
88
91
|
int64_t translation = 0);
|
89
92
|
|
90
|
-
/// a balanced assignment has a IF of 1
|
93
|
+
/// a balanced assignment has a IF of 1, a completely unbalanced assignment has
|
94
|
+
/// an IF = k.
|
91
95
|
double imbalance_factor(int n, int k, const int64_t* assign);
|
92
96
|
|
93
97
|
/// same, takes a histogram as input
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-01-31 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rice
|
@@ -16,14 +15,14 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
18
|
+
version: 4.3.3
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
25
|
+
version: 4.3.3
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: numo-narray
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,7 +37,6 @@ dependencies:
|
|
38
37
|
- - ">="
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '0'
|
41
|
-
description:
|
42
40
|
email: andrew@ankane.org
|
43
41
|
executables: []
|
44
42
|
extensions:
|
@@ -125,6 +123,8 @@ files:
|
|
125
123
|
- vendor/faiss/faiss/IndexNNDescent.h
|
126
124
|
- vendor/faiss/faiss/IndexNSG.cpp
|
127
125
|
- vendor/faiss/faiss/IndexNSG.h
|
126
|
+
- vendor/faiss/faiss/IndexNeuralNetCodec.cpp
|
127
|
+
- vendor/faiss/faiss/IndexNeuralNetCodec.h
|
128
128
|
- vendor/faiss/faiss/IndexPQ.cpp
|
129
129
|
- vendor/faiss/faiss/IndexPQ.h
|
130
130
|
- vendor/faiss/faiss/IndexPQFastScan.cpp
|
@@ -155,6 +155,8 @@ files:
|
|
155
155
|
- vendor/faiss/faiss/cppcontrib/SaDecodeKernels.h
|
156
156
|
- vendor/faiss/faiss/cppcontrib/detail/CoarseBitType.h
|
157
157
|
- vendor/faiss/faiss/cppcontrib/detail/UintReader.h
|
158
|
+
- vendor/faiss/faiss/cppcontrib/factory_tools.cpp
|
159
|
+
- vendor/faiss/faiss/cppcontrib/factory_tools.h
|
158
160
|
- vendor/faiss/faiss/cppcontrib/sa_decode/Level2-avx2-inl.h
|
159
161
|
- vendor/faiss/faiss/cppcontrib/sa_decode/Level2-inl.h
|
160
162
|
- vendor/faiss/faiss/cppcontrib/sa_decode/Level2-neon-inl.h
|
@@ -173,6 +175,7 @@ files:
|
|
173
175
|
- vendor/faiss/faiss/gpu/GpuIcmEncoder.h
|
174
176
|
- vendor/faiss/faiss/gpu/GpuIndex.h
|
175
177
|
- vendor/faiss/faiss/gpu/GpuIndexBinaryFlat.h
|
178
|
+
- vendor/faiss/faiss/gpu/GpuIndexCagra.h
|
176
179
|
- vendor/faiss/faiss/gpu/GpuIndexFlat.h
|
177
180
|
- vendor/faiss/faiss/gpu/GpuIndexIVF.h
|
178
181
|
- vendor/faiss/faiss/gpu/GpuIndexIVFFlat.h
|
@@ -200,11 +203,12 @@ files:
|
|
200
203
|
- vendor/faiss/faiss/gpu/test/TestGpuIndexIVFPQ.cpp
|
201
204
|
- vendor/faiss/faiss/gpu/test/TestGpuIndexIVFScalarQuantizer.cpp
|
202
205
|
- vendor/faiss/faiss/gpu/test/TestGpuMemoryException.cpp
|
206
|
+
- vendor/faiss/faiss/gpu/test/TestGpuResidualQuantizer.cpp
|
203
207
|
- vendor/faiss/faiss/gpu/test/TestUtils.cpp
|
204
208
|
- vendor/faiss/faiss/gpu/test/TestUtils.h
|
205
209
|
- vendor/faiss/faiss/gpu/test/demo_ivfpq_indexing_gpu.cpp
|
210
|
+
- vendor/faiss/faiss/gpu/utils/CuvsUtils.h
|
206
211
|
- vendor/faiss/faiss/gpu/utils/DeviceUtils.h
|
207
|
-
- vendor/faiss/faiss/gpu/utils/RaftUtils.h
|
208
212
|
- vendor/faiss/faiss/gpu/utils/StackDeviceMemory.cpp
|
209
213
|
- vendor/faiss/faiss/gpu/utils/StackDeviceMemory.h
|
210
214
|
- vendor/faiss/faiss/gpu/utils/StaticUtils.h
|
@@ -247,10 +251,12 @@ files:
|
|
247
251
|
- vendor/faiss/faiss/impl/ThreadedIndex-inl.h
|
248
252
|
- vendor/faiss/faiss/impl/ThreadedIndex.h
|
249
253
|
- vendor/faiss/faiss/impl/code_distance/code_distance-avx2.h
|
254
|
+
- vendor/faiss/faiss/impl/code_distance/code_distance-avx512.h
|
250
255
|
- vendor/faiss/faiss/impl/code_distance/code_distance-generic.h
|
256
|
+
- vendor/faiss/faiss/impl/code_distance/code_distance-sve.h
|
251
257
|
- vendor/faiss/faiss/impl/code_distance/code_distance.h
|
252
|
-
- vendor/faiss/faiss/impl/code_distance/code_distance_avx512.h
|
253
258
|
- vendor/faiss/faiss/impl/index_read.cpp
|
259
|
+
- vendor/faiss/faiss/impl/index_read_utils.h
|
254
260
|
- vendor/faiss/faiss/impl/index_write.cpp
|
255
261
|
- vendor/faiss/faiss/impl/io.cpp
|
256
262
|
- vendor/faiss/faiss/impl/io.h
|
@@ -285,6 +291,8 @@ files:
|
|
285
291
|
- vendor/faiss/faiss/utils/AlignedTable.h
|
286
292
|
- vendor/faiss/faiss/utils/Heap.cpp
|
287
293
|
- vendor/faiss/faiss/utils/Heap.h
|
294
|
+
- vendor/faiss/faiss/utils/NeuralNet.cpp
|
295
|
+
- vendor/faiss/faiss/utils/NeuralNet.h
|
288
296
|
- vendor/faiss/faiss/utils/WorkerThread.cpp
|
289
297
|
- vendor/faiss/faiss/utils/WorkerThread.h
|
290
298
|
- vendor/faiss/faiss/utils/approx_topk/approx_topk.h
|
@@ -292,6 +300,7 @@ files:
|
|
292
300
|
- vendor/faiss/faiss/utils/approx_topk/generic.h
|
293
301
|
- vendor/faiss/faiss/utils/approx_topk/mode.h
|
294
302
|
- vendor/faiss/faiss/utils/approx_topk_hamming/approx_topk_hamming.h
|
303
|
+
- vendor/faiss/faiss/utils/bf16.h
|
295
304
|
- vendor/faiss/faiss/utils/distances.cpp
|
296
305
|
- vendor/faiss/faiss/utils/distances.h
|
297
306
|
- vendor/faiss/faiss/utils/distances_fused/avx512.cpp
|
@@ -312,6 +321,7 @@ files:
|
|
312
321
|
- vendor/faiss/faiss/utils/hamming.cpp
|
313
322
|
- vendor/faiss/faiss/utils/hamming.h
|
314
323
|
- vendor/faiss/faiss/utils/hamming_distance/avx2-inl.h
|
324
|
+
- vendor/faiss/faiss/utils/hamming_distance/avx512-inl.h
|
315
325
|
- vendor/faiss/faiss/utils/hamming_distance/common.h
|
316
326
|
- vendor/faiss/faiss/utils/hamming_distance/generic-inl.h
|
317
327
|
- vendor/faiss/faiss/utils/hamming_distance/hamdis-inl.h
|
@@ -326,18 +336,20 @@ files:
|
|
326
336
|
- vendor/faiss/faiss/utils/random.h
|
327
337
|
- vendor/faiss/faiss/utils/simdlib.h
|
328
338
|
- vendor/faiss/faiss/utils/simdlib_avx2.h
|
339
|
+
- vendor/faiss/faiss/utils/simdlib_avx512.h
|
329
340
|
- vendor/faiss/faiss/utils/simdlib_emulated.h
|
330
341
|
- vendor/faiss/faiss/utils/simdlib_neon.h
|
342
|
+
- vendor/faiss/faiss/utils/simdlib_ppc64.h
|
331
343
|
- vendor/faiss/faiss/utils/sorting.cpp
|
332
344
|
- vendor/faiss/faiss/utils/sorting.h
|
333
345
|
- vendor/faiss/faiss/utils/transpose/transpose-avx2-inl.h
|
346
|
+
- vendor/faiss/faiss/utils/transpose/transpose-avx512-inl.h
|
334
347
|
- vendor/faiss/faiss/utils/utils.cpp
|
335
348
|
- vendor/faiss/faiss/utils/utils.h
|
336
349
|
homepage: https://github.com/ankane/faiss-ruby
|
337
350
|
licenses:
|
338
351
|
- MIT
|
339
352
|
metadata: {}
|
340
|
-
post_install_message:
|
341
353
|
rdoc_options: []
|
342
354
|
require_paths:
|
343
355
|
- lib
|
@@ -352,8 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
352
364
|
- !ruby/object:Gem::Version
|
353
365
|
version: '0'
|
354
366
|
requirements: []
|
355
|
-
rubygems_version: 3.
|
356
|
-
signing_key:
|
367
|
+
rubygems_version: 3.6.2
|
357
368
|
specification_version: 4
|
358
369
|
summary: Efficient similarity search and clustering for Ruby
|
359
370
|
test_files: []
|
@@ -1,102 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
3
|
-
*
|
4
|
-
* This source code is licensed under the MIT license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
// // // AVX-512 version. It is not used, but let it be for the future
|
9
|
-
// // // needs.
|
10
|
-
// // template <class SearchResultType, typename T = PQDecoder>
|
11
|
-
// // typename std::enable_if<(std::is_same<T, PQDecoder8>::value), void>::
|
12
|
-
// // type distance_four_codes(
|
13
|
-
// // const uint8_t* __restrict code0,
|
14
|
-
// // const uint8_t* __restrict code1,
|
15
|
-
// // const uint8_t* __restrict code2,
|
16
|
-
// // const uint8_t* __restrict code3,
|
17
|
-
// // float& result0,
|
18
|
-
// // float& result1,
|
19
|
-
// // float& result2,
|
20
|
-
// // float& result3
|
21
|
-
// // ) const {
|
22
|
-
// // result0 = 0;
|
23
|
-
// // result1 = 0;
|
24
|
-
// // result2 = 0;
|
25
|
-
// // result3 = 0;
|
26
|
-
|
27
|
-
// // size_t m = 0;
|
28
|
-
// // const size_t pqM16 = pq.M / 16;
|
29
|
-
|
30
|
-
// // constexpr intptr_t N = 4;
|
31
|
-
|
32
|
-
// // const float* tab = sim_table;
|
33
|
-
|
34
|
-
// // if (pqM16 > 0) {
|
35
|
-
// // // process 16 values per loop
|
36
|
-
// // const __m512i ksub = _mm512_set1_epi32(pq.ksub);
|
37
|
-
// // __m512i offsets_0 = _mm512_setr_epi32(0, 1, 2, 3, 4, 5, 6, 7,
|
38
|
-
// // 8, 9, 10, 11, 12, 13, 14, 15);
|
39
|
-
// // offsets_0 = _mm512_mullo_epi32(offsets_0, ksub);
|
40
|
-
|
41
|
-
// // // accumulators of partial sums
|
42
|
-
// // __m512 partialSums[N];
|
43
|
-
// // for (intptr_t j = 0; j < N; j++) {
|
44
|
-
// // partialSums[j] = _mm512_setzero_ps();
|
45
|
-
// // }
|
46
|
-
|
47
|
-
// // // loop
|
48
|
-
// // for (m = 0; m < pqM16 * 16; m += 16) {
|
49
|
-
// // // load 16 uint8 values
|
50
|
-
// // __m128i mm1[N];
|
51
|
-
// // mm1[0] = _mm_loadu_si128((const __m128i_u*)(code0 + m));
|
52
|
-
// // mm1[1] = _mm_loadu_si128((const __m128i_u*)(code1 + m));
|
53
|
-
// // mm1[2] = _mm_loadu_si128((const __m128i_u*)(code2 + m));
|
54
|
-
// // mm1[3] = _mm_loadu_si128((const __m128i_u*)(code3 + m));
|
55
|
-
|
56
|
-
// // // process first 8 codes
|
57
|
-
// // for (intptr_t j = 0; j < N; j++) {
|
58
|
-
// // // convert uint8 values (low part of __m128i) to int32
|
59
|
-
// // // values
|
60
|
-
// // const __m512i idx1 = _mm512_cvtepu8_epi32(mm1[j]);
|
61
|
-
|
62
|
-
// // // add offsets
|
63
|
-
// // const __m512i indices_to_read_from =
|
64
|
-
// // _mm512_add_epi32(idx1, offsets_0);
|
65
|
-
|
66
|
-
// // // gather 8 values, similar to 8 operations of
|
67
|
-
// // // tab[idx]
|
68
|
-
// // __m512 collected =
|
69
|
-
// // _mm512_i32gather_ps(
|
70
|
-
// // indices_to_read_from, tab, sizeof(float));
|
71
|
-
|
72
|
-
// // // collect partial sums
|
73
|
-
// // partialSums[j] = _mm512_add_ps(partialSums[j],
|
74
|
-
// // collected);
|
75
|
-
// // }
|
76
|
-
// // tab += pq.ksub * 16;
|
77
|
-
|
78
|
-
// // }
|
79
|
-
|
80
|
-
// // // horizontal sum for partialSum
|
81
|
-
// // result0 += _mm512_reduce_add_ps(partialSums[0]);
|
82
|
-
// // result1 += _mm512_reduce_add_ps(partialSums[1]);
|
83
|
-
// // result2 += _mm512_reduce_add_ps(partialSums[2]);
|
84
|
-
// // result3 += _mm512_reduce_add_ps(partialSums[3]);
|
85
|
-
// // }
|
86
|
-
|
87
|
-
// // //
|
88
|
-
// // if (m < pq.M) {
|
89
|
-
// // // process leftovers
|
90
|
-
// // PQDecoder decoder0(code0 + m, pq.nbits);
|
91
|
-
// // PQDecoder decoder1(code1 + m, pq.nbits);
|
92
|
-
// // PQDecoder decoder2(code2 + m, pq.nbits);
|
93
|
-
// // PQDecoder decoder3(code3 + m, pq.nbits);
|
94
|
-
// // for (; m < pq.M; m++) {
|
95
|
-
// // result0 += tab[decoder0.decode()];
|
96
|
-
// // result1 += tab[decoder1.decode()];
|
97
|
-
// // result2 += tab[decoder2.decode()];
|
98
|
-
// // result3 += tab[decoder3.decode()];
|
99
|
-
// // tab += pq.ksub;
|
100
|
-
// // }
|
101
|
-
// // }
|
102
|
-
// // }
|