Commit d1c432f
Convert rabitq_simd.h to runtime SIMD dispatch (facebookresearch#4912)
Summary:
Pull Request resolved: facebookresearch#4912
Convert RaBitQ SIMD primitives from compile-time #ifdef cascades to the
DD template specialization pattern.
- Replace inline SIMD functions in rabitq_simd.h with template<SIMDLevel>
declarations and NONE (scalar) specializations
- Create rabitq_avx2.cpp with AVX2+SSE4.1 specializations for
bitwise_and_dot_product, bitwise_xor_dot_product, popcount, and
compute_inner_product (including BMI2 bitplane kernel)
- Create rabitq_avx512.cpp with AVX512 specializations (falls back to
AVX2 bitplane kernel for compute_inner_product with ex_bits >= 2)
- Add AVX512_SPR forwarding to AVX512 for all four functions
- Create rabitq_neon.cpp forwarding ARM_NEON/ARM_SVE to NONE
- Wrap calls in RaBitQuantizer.cpp and RaBitQUtils.cpp with
with_simd_level dispatch
- Add -mbmi2 to AVX2 and AVX512 SIMD flags (required by _pext_u64 in
bitplane kernel; BMI2 is present on all Haswell+ CPUs)
- Register new SIMD files in xplat.bzl and CMakeLists.txt
Reviewed By: mdouze
Differential Revision: D96298743
fbshipit-source-id: 1941bf099664ba2d3d1c1245d5c06d17756149551 parent 6bca961 commit d1c432f
File tree
8 files changed
+1275
-821
lines changed- faiss
- impl
- utils
- simd_impl
8 files changed
+1275
-821
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| 26 | + | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
306 | 307 | | |
307 | 308 | | |
308 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
| |||
315 | 319 | | |
316 | 320 | | |
317 | 321 | | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
330 | 334 | | |
331 | 335 | | |
332 | 336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| |||
337 | 340 | | |
338 | 341 | | |
339 | 342 | | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
340 | 370 | | |
341 | 371 | | |
342 | 372 | | |
| |||
0 commit comments