faiss 0.6.4 → 0.6.6

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.
Files changed (301) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/ext/faiss/extconf.rb +2 -1
  4. data/ext/faiss/index.cpp +42 -0
  5. data/lib/faiss/version.rb +1 -1
  6. data/vendor/faiss/faiss/AutoTune.cpp +175 -0
  7. data/vendor/faiss/faiss/Clustering.cpp +150 -60
  8. data/vendor/faiss/faiss/Clustering.h +29 -0
  9. data/vendor/faiss/faiss/IVFlib.cpp +147 -51
  10. data/vendor/faiss/faiss/IVFlib.h +21 -2
  11. data/vendor/faiss/faiss/Index.cpp +44 -0
  12. data/vendor/faiss/faiss/Index.h +18 -13
  13. data/vendor/faiss/faiss/IndexBinary.cpp +8 -0
  14. data/vendor/faiss/faiss/IndexBinary.h +8 -0
  15. data/vendor/faiss/faiss/IndexBinaryFlat.cpp +1 -0
  16. data/vendor/faiss/faiss/IndexBinaryHNSW.cpp +85 -4
  17. data/vendor/faiss/faiss/IndexBinaryHNSW.h +19 -0
  18. data/vendor/faiss/faiss/IndexBinaryIVF.cpp +40 -11
  19. data/vendor/faiss/faiss/IndexFastScan.cpp +34 -18
  20. data/vendor/faiss/faiss/IndexFastScan.h +6 -3
  21. data/vendor/faiss/faiss/IndexFlat.cpp +57 -1
  22. data/vendor/faiss/faiss/IndexFlat.h +31 -0
  23. data/vendor/faiss/faiss/IndexFlatCodes.cpp +6 -1
  24. data/vendor/faiss/faiss/IndexHNSW.cpp +461 -13
  25. data/vendor/faiss/faiss/IndexHNSW.h +40 -5
  26. data/vendor/faiss/faiss/IndexIDMap.cpp +45 -0
  27. data/vendor/faiss/faiss/IndexIDMap.h +15 -3
  28. data/vendor/faiss/faiss/IndexIVF.cpp +349 -68
  29. data/vendor/faiss/faiss/IndexIVF.h +90 -2
  30. data/vendor/faiss/faiss/IndexIVFFastScan.cpp +51 -29
  31. data/vendor/faiss/faiss/IndexIVFFastScan.h +4 -2
  32. data/vendor/faiss/faiss/IndexIVFFlat.cpp +33 -0
  33. data/vendor/faiss/faiss/IndexIVFFlat.h +22 -6
  34. data/vendor/faiss/faiss/IndexIVFPQFastScan.cpp +2 -1
  35. data/vendor/faiss/faiss/IndexIVFRaBitQ.cpp +3 -20
  36. data/vendor/faiss/faiss/IndexIVFRaBitQFastScan.cpp +78 -58
  37. data/vendor/faiss/faiss/IndexIVFRaBitQFastScan.h +7 -13
  38. data/vendor/faiss/faiss/IndexIVFRaBitQSSD.cpp +1694 -0
  39. data/vendor/faiss/faiss/IndexIVFRaBitQSSD.h +288 -0
  40. data/vendor/faiss/faiss/IndexIVFSQFastScan.cpp +860 -0
  41. data/vendor/faiss/faiss/IndexIVFSQFastScan.h +145 -0
  42. data/vendor/faiss/faiss/IndexNNDescent.cpp +21 -3
  43. data/vendor/faiss/faiss/IndexPiPNN.cpp +201 -0
  44. data/vendor/faiss/faiss/IndexPiPNN.h +83 -0
  45. data/vendor/faiss/faiss/IndexRaBitQ.cpp +189 -41
  46. data/vendor/faiss/faiss/IndexRaBitQ.h +5 -0
  47. data/vendor/faiss/faiss/IndexRaBitQFastScan.cpp +7 -4
  48. data/vendor/faiss/faiss/IndexRaBitQFastScan.h +12 -6
  49. data/vendor/faiss/faiss/IndexReplicas.cpp +20 -0
  50. data/vendor/faiss/faiss/IndexReplicas.h +9 -0
  51. data/vendor/faiss/faiss/IndexSQFastScan.cpp +648 -0
  52. data/vendor/faiss/faiss/IndexSQFastScan.h +129 -0
  53. data/vendor/faiss/faiss/IndexShards.cpp +10 -0
  54. data/vendor/faiss/faiss/IndexShards.h +5 -0
  55. data/vendor/faiss/faiss/SuperKMeans.cpp +59 -17
  56. data/vendor/faiss/faiss/SuperKMeans.h +9 -4
  57. data/vendor/faiss/faiss/VectorTransform.cpp +159 -11
  58. data/vendor/faiss/faiss/VectorTransform.h +24 -1
  59. data/vendor/faiss/faiss/clone_index.cpp +24 -0
  60. data/vendor/faiss/faiss/factory_tools.cpp +19 -1
  61. data/vendor/faiss/faiss/gpu/Dataset.h +164 -0
  62. data/vendor/faiss/faiss/gpu/GpuCloner.cpp +16 -13
  63. data/vendor/faiss/faiss/gpu/GpuCloner.h +4 -0
  64. data/vendor/faiss/faiss/gpu/GpuClonerOptions.h +3 -0
  65. data/vendor/faiss/faiss/gpu/GpuIndex.h +4 -13
  66. data/vendor/faiss/faiss/gpu/GpuIndexBinaryCagra.h +32 -13
  67. data/vendor/faiss/faiss/gpu/GpuIndexCagra.h +51 -22
  68. data/vendor/faiss/faiss/gpu/GpuIndexFlat.h +11 -0
  69. data/vendor/faiss/faiss/gpu/GpuIndexIVF.h +6 -0
  70. data/vendor/faiss/faiss/gpu/impl/optimal_kmeans/GpuOptimalKMeans.h +184 -0
  71. data/vendor/faiss/faiss/gpu/test/TestCodePacking.cpp +12 -4
  72. data/vendor/faiss/faiss/gpu/test/TestGpuDatasetHeader.cpp +18 -0
  73. data/vendor/faiss/faiss/gpu/test/TestGpuIndexFlat.cpp +215 -0
  74. data/vendor/faiss/faiss/gpu/test/TestGpuIndexIVFFlat.cpp +98 -0
  75. data/vendor/faiss/faiss/gpu/test/TestUtils.cpp +6 -5
  76. data/vendor/faiss/faiss/gpu/utils/DeviceUtils.h +11 -0
  77. data/vendor/faiss/faiss/gpu/utils/StackDeviceMemory.cpp +1 -1
  78. data/vendor/faiss/faiss/gpu_metal/GpuIndexFlat.h +1 -1
  79. data/vendor/faiss/faiss/gpu_metal/MetalCloner.h +12 -1
  80. data/vendor/faiss/faiss/gpu_metal/MetalDistance.h +93 -1
  81. data/vendor/faiss/faiss/gpu_metal/MetalFlatKernels.h +1 -1
  82. data/vendor/faiss/faiss/gpu_metal/MetalIndex.h +5 -1
  83. data/vendor/faiss/faiss/gpu_metal/MetalIndexBinaryFlat.h +69 -0
  84. data/vendor/faiss/faiss/gpu_metal/MetalIndexFlat.h +1 -1
  85. data/vendor/faiss/faiss/gpu_metal/MetalIndexIVFFlat.h +1 -1
  86. data/vendor/faiss/faiss/gpu_metal/MetalIndexIVFPQ.h +39 -1
  87. data/vendor/faiss/faiss/gpu_metal/MetalKernels.h +107 -1
  88. data/vendor/faiss/faiss/gpu_metal/MetalPythonBridge.h +11 -1
  89. data/vendor/faiss/faiss/gpu_metal/MetalResources.h +1 -1
  90. data/vendor/faiss/faiss/gpu_metal/StandardMetalResources.h +1 -1
  91. data/vendor/faiss/faiss/gpu_metal/impl/MetalIVFFlat.h +1 -1
  92. data/vendor/faiss/faiss/gpu_metal/impl/MetalIVFPQ.h +1 -1
  93. data/vendor/faiss/faiss/impl/AuxIndexStructures.cpp +3 -1
  94. data/vendor/faiss/faiss/impl/AuxIndexStructures.h +1 -6
  95. data/vendor/faiss/faiss/impl/ClusteringHelpers.cpp +134 -45
  96. data/vendor/faiss/faiss/impl/ClusteringHelpers.h +36 -0
  97. data/vendor/faiss/faiss/impl/ClusteringInitialization.cpp +267 -136
  98. data/vendor/faiss/faiss/impl/ClusteringInitialization.h +0 -15
  99. data/vendor/faiss/faiss/impl/CodePacker.cpp +2 -2
  100. data/vendor/faiss/faiss/impl/CodePackerRaBitQ.cpp +2 -2
  101. data/vendor/faiss/faiss/impl/DeterministicNNDescent.cpp +2167 -0
  102. data/vendor/faiss/faiss/impl/DeterministicNNDescent.h +301 -0
  103. data/vendor/faiss/faiss/impl/DistanceComputer.cpp +63 -0
  104. data/vendor/faiss/faiss/impl/DistanceComputer.h +3 -29
  105. data/vendor/faiss/faiss/impl/HNSW.cpp +48 -12
  106. data/vendor/faiss/faiss/impl/HNSW.h +74 -2
  107. data/vendor/faiss/faiss/impl/IDSelector.h +5 -4
  108. data/vendor/faiss/faiss/impl/LocalSearchQuantizer.cpp +6 -19
  109. data/vendor/faiss/faiss/impl/NNDescent.cpp +2 -1
  110. data/vendor/faiss/faiss/impl/NNDescent.h +4 -0
  111. data/vendor/faiss/faiss/impl/NSG.cpp +3 -2
  112. data/vendor/faiss/faiss/impl/Panorama.h +3 -2
  113. data/vendor/faiss/faiss/impl/PiPNN.cpp +824 -0
  114. data/vendor/faiss/faiss/impl/PiPNN.h +122 -0
  115. data/vendor/faiss/faiss/impl/PolysemousTraining.cpp +1 -1
  116. data/vendor/faiss/faiss/impl/ProductQuantizer.cpp +54 -11
  117. data/vendor/faiss/faiss/impl/RaBitQUtils.cpp +0 -2
  118. data/vendor/faiss/faiss/impl/RaBitQUtils.h +30 -1
  119. data/vendor/faiss/faiss/impl/RaBitQuantizer.cpp +91 -66
  120. data/vendor/faiss/faiss/impl/RaBitQuantizer.h +15 -0
  121. data/vendor/faiss/faiss/impl/ResultHandler.h +116 -0
  122. data/vendor/faiss/faiss/impl/ScalarQuantizer.cpp +29 -0
  123. data/vendor/faiss/faiss/impl/ScalarQuantizer.h +1 -6
  124. data/vendor/faiss/faiss/impl/approx_topk/avx2.cpp +0 -4
  125. data/vendor/faiss/faiss/impl/approx_topk/neon.cpp +0 -4
  126. data/vendor/faiss/faiss/impl/binary_hamming/IndexBinaryHash_impl.h +5 -2
  127. data/vendor/faiss/faiss/impl/binary_hamming/IndexBinaryIVF_impl.h +1 -3
  128. data/vendor/faiss/faiss/impl/binary_hamming/avx2.cpp +0 -4
  129. data/vendor/faiss/faiss/impl/binary_hamming/avx512.cpp +0 -4
  130. data/vendor/faiss/faiss/impl/binary_hamming/neon.cpp +0 -4
  131. data/vendor/faiss/faiss/impl/binary_hamming/rvv.cpp +0 -4
  132. data/vendor/faiss/faiss/impl/expanded_scanners.h +93 -0
  133. data/vendor/faiss/faiss/impl/fast_scan/FastScanDistancePostProcessing.h +4 -0
  134. data/vendor/faiss/faiss/impl/fast_scan/accumulate_loops.h +61 -64
  135. data/vendor/faiss/faiss/impl/fast_scan/accumulate_loops_512.h +13 -14
  136. data/vendor/faiss/faiss/impl/fast_scan/decompose_qbs.h +17 -129
  137. data/vendor/faiss/faiss/impl/fast_scan/dispatching.h +25 -19
  138. data/vendor/faiss/faiss/impl/fast_scan/fast_scan.cpp +73 -6
  139. data/vendor/faiss/faiss/impl/fast_scan/fast_scan.h +43 -0
  140. data/vendor/faiss/faiss/impl/fast_scan/impl-avx2.cpp +15 -4
  141. data/vendor/faiss/faiss/impl/fast_scan/impl-avx512.cpp +115 -4
  142. data/vendor/faiss/faiss/impl/fast_scan/impl-neon.cpp +10 -85
  143. data/vendor/faiss/faiss/impl/fast_scan/impl-riscv.cpp +0 -4
  144. data/vendor/faiss/faiss/impl/fast_scan/kernels_neon.h +155 -0
  145. data/vendor/faiss/faiss/impl/fast_scan/kernels_simd256.h +106 -1
  146. data/vendor/faiss/faiss/impl/fast_scan/kernels_simd512.h +3 -6
  147. data/vendor/faiss/faiss/impl/fast_scan/rabitq_result_handler.h +0 -1
  148. data/vendor/faiss/faiss/impl/fast_scan/simd_result_handlers.h +105 -78
  149. data/vendor/faiss/faiss/impl/hnsw/LockVector.h +1 -2
  150. data/vendor/faiss/faiss/impl/hnsw/avx2.cpp +0 -4
  151. data/vendor/faiss/faiss/impl/hnsw/avx512.cpp +0 -4
  152. data/vendor/faiss/faiss/impl/index_read.cpp +318 -9
  153. data/vendor/faiss/faiss/impl/index_write.cpp +124 -5
  154. data/vendor/faiss/faiss/impl/io.cpp +1 -0
  155. data/vendor/faiss/faiss/impl/io_macros.h +2 -2
  156. data/vendor/faiss/faiss/impl/mapped_io.cpp +3 -1
  157. data/vendor/faiss/faiss/impl/maybe_owned_vector.h +78 -41
  158. data/vendor/faiss/faiss/impl/nndescent/gram-avx2.cpp +121 -0
  159. data/vendor/faiss/faiss/impl/nndescent/gram-avx512.cpp +124 -0
  160. data/vendor/faiss/faiss/impl/nndescent/gram-neon.cpp +114 -0
  161. data/vendor/faiss/faiss/impl/nndescent/gram.h +66 -0
  162. data/vendor/faiss/faiss/impl/optimal_kmeans/BlockCombiner-avx512.cpp +431 -0
  163. data/vendor/faiss/faiss/impl/optimal_kmeans/BlockCombiner-inl.h +1157 -0
  164. data/vendor/faiss/faiss/impl/optimal_kmeans/OptimalKMeans.cpp +282 -0
  165. data/vendor/faiss/faiss/impl/optimal_kmeans/OptimalKMeans.h +226 -0
  166. data/vendor/faiss/faiss/impl/optimal_kmeans/OptimalKMeansCompressed.cpp +1567 -0
  167. data/vendor/faiss/faiss/impl/optimal_kmeans/OptimalKMeansCompressed.h +281 -0
  168. data/vendor/faiss/faiss/impl/pipnn/HashPrune.cpp +159 -0
  169. data/vendor/faiss/faiss/impl/pipnn/HashPrune.h +69 -0
  170. data/vendor/faiss/faiss/impl/pipnn/Partition.cpp +587 -0
  171. data/vendor/faiss/faiss/impl/pipnn/Partition.h +93 -0
  172. data/vendor/faiss/faiss/impl/pipnn/kernels.cpp +326 -0
  173. data/vendor/faiss/faiss/impl/pipnn/kernels.h +92 -0
  174. data/vendor/faiss/faiss/impl/platform_macros.h +91 -27
  175. data/vendor/faiss/faiss/impl/polysemous_training/avx512.cpp +0 -4
  176. data/vendor/faiss/faiss/impl/pq_code_distance/IVFPQScanner_impl.h +84 -4
  177. data/vendor/faiss/faiss/impl/pq_code_distance/IVFPQ_QueryTables.cpp +17 -17
  178. data/vendor/faiss/faiss/impl/pq_code_distance/PQDistanceComputer_impl.h +6 -0
  179. data/vendor/faiss/faiss/impl/pq_code_distance/avx2.cpp +0 -4
  180. data/vendor/faiss/faiss/impl/pq_code_distance/avx512.cpp +0 -4
  181. data/vendor/faiss/faiss/impl/pq_code_distance/neon.cpp +0 -4
  182. data/vendor/faiss/faiss/impl/pq_code_distance/pq_code_distance-avx2.h +4 -0
  183. data/vendor/faiss/faiss/impl/pq_code_distance/pq_code_distance-avx512.h +4 -1
  184. data/vendor/faiss/faiss/impl/pq_code_distance/pq_code_distance-generic.cpp +19 -0
  185. data/vendor/faiss/faiss/impl/pq_code_distance/pq_code_distance-generic.h +6 -6
  186. data/vendor/faiss/faiss/impl/pq_code_distance/pq_code_distance-inl.h +131 -6
  187. data/vendor/faiss/faiss/impl/pq_code_distance/pq_code_distance-sve.cpp +0 -4
  188. data/vendor/faiss/faiss/impl/pq_code_distance/pq_rvv_kernel.h +89 -0
  189. data/vendor/faiss/faiss/impl/pq_code_distance/pq_scan_impl.h +21 -10
  190. data/vendor/faiss/faiss/impl/pq_code_distance/rvv.cpp +45 -18
  191. data/vendor/faiss/faiss/impl/residual_quantizer_encode_steps.cpp +2 -1
  192. data/vendor/faiss/faiss/impl/result_handler/ResultHandler.cpp +68 -1
  193. data/vendor/faiss/faiss/impl/result_handler/avx2.cpp +70 -6
  194. data/vendor/faiss/faiss/impl/result_handler/avx512.cpp +2 -5
  195. data/vendor/faiss/faiss/impl/scalar_quantizer/EDENQuantizer-avx2.cpp +0 -4
  196. data/vendor/faiss/faiss/impl/scalar_quantizer/EDENQuantizer-avx512.cpp +0 -4
  197. data/vendor/faiss/faiss/impl/scalar_quantizer/EDENQuantizer.cpp +1 -1
  198. data/vendor/faiss/faiss/impl/scalar_quantizer/distance_computers.h +5 -1
  199. data/vendor/faiss/faiss/impl/scalar_quantizer/quantizers.h +28 -52
  200. data/vendor/faiss/faiss/impl/scalar_quantizer/scanners.h +85 -37
  201. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-avx2.cpp +262 -110
  202. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-avx512-impl.h +503 -122
  203. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-avx512-spr.cpp +10 -155
  204. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-avx512.cpp +7 -701
  205. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-dispatch.h +66 -57
  206. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-neon.cpp +133 -127
  207. data/vendor/faiss/faiss/impl/scalar_quantizer/sq-rvv.cpp +3185 -144
  208. data/vendor/faiss/faiss/impl/scalar_quantizer/sq8_coefficients.h +48 -0
  209. data/vendor/faiss/faiss/impl/scalar_quantizer/sq8_rvv_kernel.h +546 -0
  210. data/vendor/faiss/faiss/impl/scalar_quantizer/training.cpp +2 -2
  211. data/vendor/faiss/faiss/impl/simd_dispatch.h +7 -0
  212. data/vendor/faiss/faiss/impl/simdlib/simdlib_avx2.h +14 -0
  213. data/vendor/faiss/faiss/impl/simdlib/simdlib_avx512.h +20 -20
  214. data/vendor/faiss/faiss/impl/simdlib/simdlib_dispatch.h +7 -8
  215. data/vendor/faiss/faiss/impl/simdlib/simdlib_neon.h +4 -4
  216. data/vendor/faiss/faiss/impl/sq_fastscan_utils.h +232 -0
  217. data/vendor/faiss/faiss/impl/zerocopy_io.cpp +2 -1
  218. data/vendor/faiss/faiss/index_factory.cpp +106 -6
  219. data/vendor/faiss/faiss/invlists/DirectMap.cpp +1 -1
  220. data/vendor/faiss/faiss/invlists/DiskIOBackend.cpp +121 -0
  221. data/vendor/faiss/faiss/invlists/DiskIOBackend.h +71 -0
  222. data/vendor/faiss/faiss/invlists/InvertedLists.cpp +15 -10
  223. data/vendor/faiss/faiss/invlists/InvertedListsIOHook.cpp +26 -0
  224. data/vendor/faiss/faiss/invlists/InvertedListsIOHook.h +5 -0
  225. data/vendor/faiss/faiss/invlists/OnDiskInvertedLists.cpp +9 -24
  226. data/vendor/faiss/faiss/invlists/RaBitQSSDInvertedLists.cpp +751 -0
  227. data/vendor/faiss/faiss/invlists/RaBitQSSDInvertedLists.h +224 -0
  228. data/vendor/faiss/faiss/svs/IndexSVSFaissUtils.h +2 -7
  229. data/vendor/faiss/faiss/svs/IndexSVSFlat.cpp +1 -1
  230. data/vendor/faiss/faiss/svs/IndexSVSIVF.cpp +2 -2
  231. data/vendor/faiss/faiss/svs/IndexSVSVamana.cpp +4 -4
  232. data/vendor/faiss/faiss/svs/IndexSVSVamana.h +3 -2
  233. data/vendor/faiss/faiss/utils/AlignedTable.h +6 -1
  234. data/vendor/faiss/faiss/utils/Heap.cpp +4 -3
  235. data/vendor/faiss/faiss/utils/WorkerThread.h +0 -1
  236. data/vendor/faiss/faiss/utils/approx_topk_hamming/approx_topk_hamming.h +16 -5
  237. data/vendor/faiss/faiss/utils/bf16.h +36 -0
  238. data/vendor/faiss/faiss/utils/distances.cpp +466 -43
  239. data/vendor/faiss/faiss/utils/distances.h +179 -2
  240. data/vendor/faiss/faiss/utils/distances_dispatch.h +6 -4
  241. data/vendor/faiss/faiss/utils/distances_fused/avx512.cpp +2 -5
  242. data/vendor/faiss/faiss/utils/distances_fused/distances_fused.cpp +0 -14
  243. data/vendor/faiss/faiss/utils/distances_fused/rvv.cpp +25 -0
  244. data/vendor/faiss/faiss/utils/distances_fused/simdlib_based.cpp +0 -4
  245. data/vendor/faiss/faiss/utils/distances_fused/simdlib_based_neon.cpp +0 -4
  246. data/vendor/faiss/faiss/utils/distances_fused/simdlib_kernel-inl.h +2 -1
  247. data/vendor/faiss/faiss/utils/distances_simd.cpp +9 -0
  248. data/vendor/faiss/faiss/utils/extra_distances.h +2 -1
  249. data/vendor/faiss/faiss/utils/fp16-fp16c.h +4 -0
  250. data/vendor/faiss/faiss/utils/fp16-inl.h +26 -52
  251. data/vendor/faiss/faiss/utils/hamming-inl.h +3 -0
  252. data/vendor/faiss/faiss/utils/hamming_distance/hamming_avx2.cpp +0 -4
  253. data/vendor/faiss/faiss/utils/hamming_distance/hamming_avx512.cpp +0 -4
  254. data/vendor/faiss/faiss/utils/hamming_distance/hamming_avx512_vpopcnt.cpp +0 -4
  255. data/vendor/faiss/faiss/utils/hamming_distance/hamming_computer-avx512.h +33 -5
  256. data/vendor/faiss/faiss/utils/hamming_distance/hamming_computer-avx512_vpopcnt.h +15 -30
  257. data/vendor/faiss/faiss/utils/hamming_distance/hamming_computer-neon.h +0 -4
  258. data/vendor/faiss/faiss/utils/hamming_distance/hamming_impl.h +2 -1
  259. data/vendor/faiss/faiss/utils/hamming_distance/hamming_neon.cpp +0 -4
  260. data/vendor/faiss/faiss/utils/hamming_distance/hamming_rvv.cpp +0 -4
  261. data/vendor/faiss/faiss/utils/partitioning.cpp +2 -2
  262. data/vendor/faiss/faiss/utils/pq_code_distance.h +8 -4
  263. data/vendor/faiss/faiss/utils/prefetch.h +1 -26
  264. data/vendor/faiss/faiss/utils/quantize_lut.cpp +26 -27
  265. data/vendor/faiss/faiss/utils/quantize_lut.h +11 -0
  266. data/vendor/faiss/faiss/utils/rabitq_simd.h +171 -22
  267. data/vendor/faiss/faiss/utils/simd_impl/distances_aarch64.cpp +9 -4
  268. data/vendor/faiss/faiss/utils/simd_impl/distances_arm_sve.cpp +81 -9
  269. data/vendor/faiss/faiss/utils/simd_impl/distances_autovec-inl.h +7 -3
  270. data/vendor/faiss/faiss/utils/simd_impl/distances_avx2.cpp +108 -9
  271. data/vendor/faiss/faiss/utils/simd_impl/distances_avx512.cpp +111 -12
  272. data/vendor/faiss/faiss/utils/simd_impl/distances_rvv.cpp +353 -71
  273. data/vendor/faiss/faiss/utils/simd_impl/distances_rvv_kernel.h +68 -0
  274. data/vendor/faiss/faiss/utils/simd_impl/distances_simdlib256.h +3 -3
  275. data/vendor/faiss/faiss/utils/simd_impl/exhaustive_L2sqr_blas_cmax.h +106 -0
  276. data/vendor/faiss/faiss/utils/simd_impl/fp16_kernels.h +76 -0
  277. data/vendor/faiss/faiss/utils/simd_impl/fp16_kernels_avx2.cpp +52 -0
  278. data/vendor/faiss/faiss/utils/simd_impl/fp16_kernels_avx512.cpp +52 -0
  279. data/vendor/faiss/faiss/utils/simd_impl/fp16_kernels_neon.cpp +48 -0
  280. data/vendor/faiss/faiss/utils/simd_impl/masked_sum-avx2.h +44 -0
  281. data/vendor/faiss/faiss/utils/simd_impl/masked_sum-avx512.h +43 -0
  282. data/vendor/faiss/faiss/utils/simd_impl/masked_sum.h +38 -0
  283. data/vendor/faiss/faiss/utils/simd_impl/partitioning_avx2.cpp +0 -4
  284. data/vendor/faiss/faiss/utils/simd_impl/partitioning_neon.cpp +0 -4
  285. data/vendor/faiss/faiss/utils/simd_impl/partitioning_simdlib256.h +16 -15
  286. data/vendor/faiss/faiss/utils/simd_impl/rabitq_avx2.cpp +185 -51
  287. data/vendor/faiss/faiss/utils/simd_impl/rabitq_avx512.cpp +194 -66
  288. data/vendor/faiss/faiss/utils/simd_impl/rabitq_avx512_vpopcnt.cpp +51 -14
  289. data/vendor/faiss/faiss/utils/simd_impl/rabitq_neon.cpp +297 -10
  290. data/vendor/faiss/faiss/utils/simd_impl/rabitq_rvv.cpp +0 -4
  291. data/vendor/faiss/faiss/utils/simd_impl/super_kmeans_kernels_avx2.cpp +0 -4
  292. data/vendor/faiss/faiss/utils/simd_impl/super_kmeans_kernels_avx512.cpp +0 -4
  293. data/vendor/faiss/faiss/utils/simd_impl/super_kmeans_kernels_sve.cpp +0 -4
  294. data/vendor/faiss/faiss/utils/simd_levels.cpp +22 -6
  295. data/vendor/faiss/faiss/utils/simd_levels.h +74 -1
  296. data/vendor/faiss/faiss/utils/sorting.cpp +6 -5
  297. data/vendor/faiss/faiss/utils/transpose/transpose-avx2-inl.h +0 -4
  298. data/vendor/faiss/faiss/utils/transpose/transpose-avx512-inl.h +0 -4
  299. data/vendor/faiss/faiss/utils/utils.cpp +84 -0
  300. data/vendor/faiss/faiss/utils/utils.h +24 -0
  301. metadata +52 -1
@@ -7,11 +7,93 @@
7
7
 
8
8
  #pragma once
9
9
 
10
+ #include <algorithm>
11
+ #include <cstddef>
12
+ #include <cstdint>
13
+ #include <memory>
14
+
10
15
  #include <faiss/impl/ResultHandler.h>
16
+ #include <faiss/utils/distances.h>
11
17
  #include <faiss/utils/simd_levels.h>
18
+ #include <faiss/utils/utils.h>
12
19
 
13
20
  namespace faiss {
14
21
 
22
+ /** fp32 query tiles for the BLAS exhaustive-search kernels.
23
+ *
24
+ * A kernel calls prepare_norms() once, then tile(i0, i1, x_norms) for each
25
+ * query tile; the returned rows stay valid until the next tile() call.
26
+ */
27
+ struct Fp32QueryTiles {
28
+ const float* x;
29
+ size_t d;
30
+
31
+ /// squared L2 norms of all nx queries
32
+ void prepare_norms(size_t nx, float* x_norms) const {
33
+ fvec_norms_L2sqr(x_norms, x, d, nx);
34
+ }
35
+
36
+ const float* tile(size_t i0, size_t /*i1*/, float* /*x_norms*/) const {
37
+ return x + i0 * d;
38
+ }
39
+ };
40
+
41
+ /** Packed IEEE binary16 query tiles for the BLAS exhaustive-search kernels.
42
+ *
43
+ * Queries are widened in chunks of whole tiles (at most chunk_bytes of fp32,
44
+ * at least one tile) into a buffer reused across chunks: the fp32 copy stays
45
+ * bounded and each widened tile serves all database tiles. Norms are computed
46
+ * from the widened rows, so results match the fp32 kernels on the widened
47
+ * queries.
48
+ */
49
+ struct Fp16QueryTiles {
50
+ static constexpr size_t chunk_bytes = size_t(16) << 20;
51
+
52
+ const uint16_t* x;
53
+ size_t d;
54
+ size_t nx;
55
+ std::unique_ptr<float[]> buffer;
56
+ size_t chunk_rows = 0;
57
+ size_t chunk_begin = 0;
58
+ size_t chunk_end = 0;
59
+
60
+ Fp16QueryTiles(const uint16_t* x_in, size_t d_in, size_t nx_in)
61
+ : x(x_in), d(d_in), nx(nx_in) {}
62
+
63
+ void prepare_norms(size_t /*nx*/, float* /*x_norms*/) const {}
64
+
65
+ /** widened rows [i0, i1), and their norms if x_norms is not null
66
+ *
67
+ * Tiles are requested in order, all of the same size except the last.
68
+ */
69
+ const float* tile(size_t i0, size_t i1, float* x_norms) {
70
+ if (i1 > chunk_end) {
71
+ if (!buffer) {
72
+ const size_t tile_rows = i1 - i0;
73
+ chunk_rows =
74
+ tile_rows *
75
+ std::max<size_t>(
76
+ 1,
77
+ chunk_bytes / (tile_rows * d * sizeof(float)));
78
+ chunk_rows = std::min(chunk_rows, nx - i0);
79
+ buffer.reset(new float[chunk_rows * d]);
80
+ }
81
+ chunk_begin = i0;
82
+ chunk_end = std::min(nx, i0 + chunk_rows);
83
+ const int64_t n = static_cast<int64_t>(chunk_end - chunk_begin);
84
+ #pragma omp parallel for if (n * static_cast<int64_t>(d) > (1 << 16))
85
+ for (int64_t i = 0; i < n; i++) {
86
+ float* row = buffer.get() + i * d;
87
+ fp16_to_fp32(d, x + (chunk_begin + i) * d, row);
88
+ if (x_norms) {
89
+ x_norms[chunk_begin + i] = fvec_norm_L2sqr(row, d);
90
+ }
91
+ }
92
+ }
93
+ return buffer.get() + (i0 - chunk_begin) * d;
94
+ }
95
+ };
96
+
15
97
  /// BLAS-accelerated exhaustive L2 search for the k=1 (top-1) case.
16
98
  /// Specializations live in the per-SIMD translation units under simd_impl/.
17
99
  template <SIMDLevel>
@@ -24,4 +106,28 @@ void exhaustive_L2sqr_blas_cmax(
24
106
  Top1BlockResultHandler<CMax<float, int64_t>>& res,
25
107
  const float* y_norms);
26
108
 
109
+ /// Per-call block sizes; the original overload retains its global defaults.
110
+ template <SIMDLevel>
111
+ void exhaustive_L2sqr_blas_cmax(
112
+ const float* x,
113
+ const float* y,
114
+ size_t d,
115
+ size_t nx,
116
+ size_t ny,
117
+ Top1BlockResultHandler<CMax<float, int64_t>>& res,
118
+ const float* y_norms,
119
+ size_t query_block_size,
120
+ size_t database_block_size);
121
+
122
+ /// Same as exhaustive_L2sqr_blas_cmax for packed IEEE binary16 queries.
123
+ template <SIMDLevel>
124
+ void exhaustive_L2sqr_blas_cmax_fp16(
125
+ const uint16_t* x,
126
+ const float* y,
127
+ size_t d,
128
+ size_t nx,
129
+ size_t ny,
130
+ Top1BlockResultHandler<CMax<float, int64_t>>& res,
131
+ const float* y_norms);
132
+
27
133
  } // namespace faiss
@@ -0,0 +1,76 @@
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
+ #include <cstddef>
11
+ #include <cstdint>
12
+
13
+ #include <faiss/utils/fp16.h>
14
+ #include <faiss/utils/simd_levels.h>
15
+
16
+ namespace faiss {
17
+ namespace detail {
18
+
19
+ // c[j] += fp32(x[j]) * w for j < d
20
+ template <SIMDLevel Level>
21
+ inline void fp16_madd(size_t d, const uint16_t* x, float w, float* c) {
22
+ for (size_t j = 0; j < d; ++j) {
23
+ c[j] += decode_fp16(x[j]) * w;
24
+ }
25
+ }
26
+
27
+ template <SIMDLevel Level>
28
+ inline void fp16_to_fp32_kernel(size_t n, const uint16_t* x, float* out) {
29
+ for (size_t j = 0; j < n; ++j) {
30
+ out[j] = decode_fp16(x[j]);
31
+ }
32
+ }
33
+
34
+ #ifdef COMPILE_SIMD_AVX2
35
+ template <>
36
+ void fp16_madd<SIMDLevel::AVX2>(size_t d, const uint16_t* x, float w, float* c);
37
+
38
+ template <>
39
+ void fp16_to_fp32_kernel<SIMDLevel::AVX2>(
40
+ size_t n,
41
+ const uint16_t* x,
42
+ float* out);
43
+ #endif
44
+
45
+ #ifdef COMPILE_SIMD_AVX512
46
+ template <>
47
+ void fp16_madd<SIMDLevel::AVX512>(
48
+ size_t d,
49
+ const uint16_t* x,
50
+ float w,
51
+ float* c);
52
+
53
+ template <>
54
+ void fp16_to_fp32_kernel<SIMDLevel::AVX512>(
55
+ size_t n,
56
+ const uint16_t* x,
57
+ float* out);
58
+ #endif
59
+
60
+ #ifdef COMPILE_SIMD_ARM_NEON
61
+ template <>
62
+ void fp16_madd<SIMDLevel::ARM_NEON>(
63
+ size_t d,
64
+ const uint16_t* x,
65
+ float w,
66
+ float* c);
67
+
68
+ template <>
69
+ void fp16_to_fp32_kernel<SIMDLevel::ARM_NEON>(
70
+ size_t n,
71
+ const uint16_t* x,
72
+ float* out);
73
+ #endif
74
+
75
+ } // namespace detail
76
+ } // namespace faiss
@@ -0,0 +1,52 @@
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
+ #include <faiss/utils/simd_impl/fp16_kernels.h>
9
+
10
+ #include <immintrin.h>
11
+
12
+ namespace faiss {
13
+ namespace detail {
14
+
15
+ template <>
16
+ void fp16_madd<SIMDLevel::AVX2>(
17
+ size_t d,
18
+ const uint16_t* x,
19
+ float w,
20
+ float* c) {
21
+ const __m256 wv = _mm256_set1_ps(w);
22
+ size_t j = 0;
23
+ for (; j + 8 <= d; j += 8) {
24
+ const __m256 xv = _mm256_cvtph_ps(
25
+ _mm_loadu_si128(reinterpret_cast<const __m128i*>(x + j)));
26
+ _mm256_storeu_ps(
27
+ c + j,
28
+ _mm256_add_ps(_mm256_loadu_ps(c + j), _mm256_mul_ps(xv, wv)));
29
+ }
30
+ for (; j < d; ++j) {
31
+ c[j] += decode_fp16(x[j]) * w;
32
+ }
33
+ }
34
+
35
+ template <>
36
+ void fp16_to_fp32_kernel<SIMDLevel::AVX2>(
37
+ size_t n,
38
+ const uint16_t* x,
39
+ float* out) {
40
+ size_t j = 0;
41
+ for (; j + 8 <= n; j += 8) {
42
+ const __m128i h =
43
+ _mm_loadu_si128(reinterpret_cast<const __m128i*>(x + j));
44
+ _mm256_storeu_ps(out + j, _mm256_cvtph_ps(h));
45
+ }
46
+ for (; j < n; ++j) {
47
+ out[j] = decode_fp16(x[j]);
48
+ }
49
+ }
50
+
51
+ } // namespace detail
52
+ } // namespace faiss
@@ -0,0 +1,52 @@
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
+ #include <faiss/utils/simd_impl/fp16_kernels.h>
9
+
10
+ #include <immintrin.h>
11
+
12
+ namespace faiss {
13
+ namespace detail {
14
+
15
+ template <>
16
+ void fp16_madd<SIMDLevel::AVX512>(
17
+ size_t d,
18
+ const uint16_t* x,
19
+ float w,
20
+ float* c) {
21
+ const __m512 wv = _mm512_set1_ps(w);
22
+ size_t j = 0;
23
+ for (; j + 16 <= d; j += 16) {
24
+ const __m512 xv = _mm512_cvtph_ps(
25
+ _mm256_loadu_si256(reinterpret_cast<const __m256i*>(x + j)));
26
+ _mm512_storeu_ps(
27
+ c + j,
28
+ _mm512_add_ps(_mm512_loadu_ps(c + j), _mm512_mul_ps(xv, wv)));
29
+ }
30
+ for (; j < d; ++j) {
31
+ c[j] += decode_fp16(x[j]) * w;
32
+ }
33
+ }
34
+
35
+ template <>
36
+ void fp16_to_fp32_kernel<SIMDLevel::AVX512>(
37
+ size_t n,
38
+ const uint16_t* x,
39
+ float* out) {
40
+ size_t j = 0;
41
+ for (; j + 16 <= n; j += 16) {
42
+ const __m256i h =
43
+ _mm256_loadu_si256(reinterpret_cast<const __m256i*>(x + j));
44
+ _mm512_storeu_ps(out + j, _mm512_cvtph_ps(h));
45
+ }
46
+ for (; j < n; ++j) {
47
+ out[j] = decode_fp16(x[j]);
48
+ }
49
+ }
50
+
51
+ } // namespace detail
52
+ } // namespace faiss
@@ -0,0 +1,48 @@
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
+ #include <faiss/utils/simd_impl/fp16_kernels.h>
9
+
10
+ #include <arm_neon.h>
11
+
12
+ namespace faiss {
13
+ namespace detail {
14
+
15
+ template <>
16
+ void fp16_madd<SIMDLevel::ARM_NEON>(
17
+ size_t d,
18
+ const uint16_t* x,
19
+ float w,
20
+ float* c) {
21
+ const float32x4_t wv = vdupq_n_f32(w);
22
+ size_t j = 0;
23
+ for (; j + 4 <= d; j += 4) {
24
+ const float32x4_t xv =
25
+ vcvt_f32_f16(vreinterpret_f16_u16(vld1_u16(x + j)));
26
+ vst1q_f32(c + j, vaddq_f32(vld1q_f32(c + j), vmulq_f32(xv, wv)));
27
+ }
28
+ for (; j < d; ++j) {
29
+ c[j] += decode_fp16(x[j]) * w;
30
+ }
31
+ }
32
+
33
+ template <>
34
+ void fp16_to_fp32_kernel<SIMDLevel::ARM_NEON>(
35
+ size_t n,
36
+ const uint16_t* x,
37
+ float* out) {
38
+ size_t j = 0;
39
+ for (; j + 4 <= n; j += 4) {
40
+ vst1q_f32(out + j, vcvt_f32_f16(vreinterpret_f16_u16(vld1_u16(x + j))));
41
+ }
42
+ for (; j < n; ++j) {
43
+ out[j] = decode_fp16(x[j]);
44
+ }
45
+ }
46
+
47
+ } // namespace detail
48
+ } // namespace faiss
@@ -0,0 +1,44 @@
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
+ #include <immintrin.h>
11
+
12
+ #include <faiss/utils/simd_impl/masked_sum.h>
13
+
14
+ namespace faiss {
15
+ namespace {
16
+
17
+ template <>
18
+ inline float masked_sum<SIMDLevel::AVX2>(
19
+ const float* x,
20
+ const uint8_t* bits,
21
+ size_t d) {
22
+ const __m256i bit_masks = _mm256_set_epi32(128, 64, 32, 16, 8, 4, 2, 1);
23
+ __m256 acc = _mm256_setzero_ps();
24
+ const size_t full_bytes = d / 8;
25
+ for (size_t byte_idx = 0; byte_idx < full_bytes; byte_idx++) {
26
+ const __m256i byte_broadcast = _mm256_set1_epi32(bits[byte_idx]);
27
+ const __m256i masked = _mm256_and_si256(byte_broadcast, bit_masks);
28
+ const __m256 mask =
29
+ _mm256_castsi256_ps(_mm256_cmpeq_epi32(masked, bit_masks));
30
+ const __m256 vals = _mm256_loadu_ps(x + byte_idx * 8);
31
+ acc = _mm256_add_ps(acc, _mm256_and_ps(mask, vals));
32
+ }
33
+ __m128 sum128 = _mm_add_ps(
34
+ _mm256_castps256_ps128(acc), _mm256_extractf128_ps(acc, 1));
35
+ __m128 shuf = _mm_movehdup_ps(sum128);
36
+ __m128 sums = _mm_add_ps(sum128, shuf);
37
+ shuf = _mm_movehl_ps(shuf, sums);
38
+ sums = _mm_add_ss(sums, shuf);
39
+ return _mm_cvtss_f32(sums) +
40
+ masked_sum_scalar(x + full_bytes * 8, bits + full_bytes, d % 8);
41
+ }
42
+
43
+ } // namespace
44
+ } // namespace faiss
@@ -0,0 +1,43 @@
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
+ #include <cstring>
11
+
12
+ #include <immintrin.h>
13
+
14
+ #include <faiss/utils/simd_impl/masked_sum.h>
15
+
16
+ namespace faiss {
17
+ namespace {
18
+
19
+ template <>
20
+ inline float masked_sum<SIMDLevel::AVX512>(
21
+ const float* x,
22
+ const uint8_t* bits,
23
+ size_t d) {
24
+ __m512 acc = _mm512_setzero_ps();
25
+ size_t i = 0;
26
+ for (; i + 16 <= d; i += 16) {
27
+ uint16_t mask16;
28
+ memcpy(&mask16, bits + i / 8, sizeof(mask16));
29
+ acc = _mm512_mask_add_ps(acc, mask16, acc, _mm512_loadu_ps(x + i));
30
+ }
31
+ if (i < d) {
32
+ uint32_t mask = bits[i / 8];
33
+ if (d - i > 8) {
34
+ mask |= uint32_t(bits[i / 8 + 1]) << 8;
35
+ }
36
+ const __mmask16 k = mask & ((1u << (d - i)) - 1);
37
+ acc = _mm512_add_ps(acc, _mm512_maskz_loadu_ps(k, x + i));
38
+ }
39
+ return _mm512_reduce_add_ps(acc);
40
+ }
41
+
42
+ } // namespace
43
+ } // namespace faiss
@@ -0,0 +1,38 @@
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
+ #include <cstddef>
11
+ #include <cstdint>
12
+
13
+ #include <faiss/utils/simd_levels.h>
14
+
15
+ namespace faiss {
16
+
17
+ // Internal linkage: each file compiles these with its own flags.
18
+ // masked_sum-avx2.h and masked_sum-avx512.h specialize masked_sum.
19
+ namespace {
20
+
21
+ inline float masked_sum_scalar(const float* x, const uint8_t* bits, size_t d) {
22
+ float sum = 0;
23
+ for (size_t j = 0; j < d; j++) {
24
+ if ((bits[j / 8] >> (j % 8)) & 1) {
25
+ sum += x[j];
26
+ }
27
+ }
28
+ return sum;
29
+ }
30
+
31
+ template <SIMDLevel SL>
32
+ inline float masked_sum(const float* x, const uint8_t* bits, size_t d) {
33
+ return masked_sum_scalar(x, bits, d);
34
+ }
35
+
36
+ } // namespace
37
+
38
+ } // namespace faiss
@@ -5,10 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #ifdef COMPILE_SIMD_AVX2
9
-
10
8
  #define THE_SIMD_LEVEL SIMDLevel::AVX2
11
9
  // NOLINTNEXTLINE(facebook-hte-InlineHeader)
12
10
  #include <faiss/utils/simd_impl/partitioning_simdlib256.h>
13
-
14
- #endif // COMPILE_SIMD_AVX2
@@ -5,10 +5,6 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- #ifdef COMPILE_SIMD_ARM_NEON
9
-
10
8
  #define THE_SIMD_LEVEL SIMDLevel::ARM_NEON
11
9
  // NOLINTNEXTLINE(facebook-hte-InlineHeader)
12
10
  #include <faiss/utils/simd_impl/partitioning_simdlib256.h>
13
-
14
- #endif // COMPILE_SIMD_ARM_NEON
@@ -66,6 +66,21 @@ using simd8float32 = simd8float32_tpl<THE_SL_256>;
66
66
  * SIMD routines when vals is an aligned array of uint16_t
67
67
  ******************************************************************/
68
68
 
69
+ // Forward declarations of histogram functions defined below, outside
70
+ // simd_partitioning
71
+ void local_simd_histogram_8(
72
+ const uint16_t* data,
73
+ int n,
74
+ uint16_t min,
75
+ int shift,
76
+ int* hist);
77
+ void local_simd_histogram_16(
78
+ const uint16_t* data,
79
+ int n,
80
+ uint16_t min,
81
+ int shift,
82
+ int* hist);
83
+
69
84
  namespace simd_partitioning {
70
85
 
71
86
  void find_minimax(
@@ -338,7 +353,7 @@ uint16_t simd_partition_fuzzy_with_bounds(
338
353
  IFV printf(
339
354
  " override: thresh=%d n_eq_1=%" PRId64 "\n", thresh, n_eq_1);
340
355
  } else {
341
- assert(n_eq_1 <= n_eq);
356
+ assert(static_cast<size_t>(n_eq_1) <= n_eq);
342
357
  }
343
358
 
344
359
  size_t wp = simd_compress_array<C>(vals, ids, n, thresh, n_eq_1);
@@ -357,20 +372,6 @@ uint16_t simd_partition_fuzzy_with_bounds(
357
372
  return thresh;
358
373
  }
359
374
 
360
- // Forward declarations of histogram functions defined below
361
- void local_simd_histogram_8(
362
- const uint16_t* data,
363
- int n,
364
- uint16_t min,
365
- int shift,
366
- int* hist);
367
- void local_simd_histogram_16(
368
- const uint16_t* data,
369
- int n,
370
- uint16_t min,
371
- int shift,
372
- int* hist);
373
-
374
375
  template <class C>
375
376
  uint16_t simd_partition_fuzzy_with_bounds_histogram(
376
377
  uint16_t* vals,