File simdlib_neon.h
-
namespace faiss
Implementation of k-means clustering with many variants.
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
IDSelector is intended to define a subset of vectors to handle (for removal or as subset to search)
PQ4 SIMD packing and accumulation functions
The basic kernel accumulates nq query vectors with bbs = nb * 2 * 16 vectors and produces an output matrix for that. It is interesting for nq * nb <= 4, otherwise register spilling becomes too large.
The implementation of these functions is spread over 3 cpp files to reduce parallel compile times. Templates are instantiated explicitly.
This file contains callbacks for kernels that compute distances.
Throughout the library, vectors are provided as float * pointers. Most algorithms can be optimized when several vectors are processed (added/searched) together in a batch. In this case, they are passed in as a matrix. When n vectors of size d are provided as float * x, component j of vector i is
x[ i * d + j ]
where 0 <= i < n and 0 <= j < d. In other words, matrices are always compact. When specifying the size of the matrix, we call it an n*d matrix, which implies a row-major storage.
I/O functions can read/write to a filename, a file handle or to an object that abstracts the medium.
The read functions return objects that should be deallocated with delete. All references within these objectes are owned by the object.
Definition of inverted lists + a few common classes that implement the interface.
Since IVF (inverted file) indexes are of so much use for large-scale use cases, we group a few functions related to them in this small library. Most functions work both on IndexIVFs and IndexIVFs embedded within an IndexPreTransform.
In this file are the implementations of extra metrics beyond L2 and inner product
Implements a few neural net layers, mainly to support QINCo
Defines a few objects that apply transformations to a set of vectors Often these are pre-processing steps.
-
struct simd16uint16 : public faiss::simd256bit, public faiss::simd256bit, public faiss::simd256bit
- #include <simdlib_avx2.h>
-
struct simd32uint8 : public faiss::simd256bit, public faiss::simd256bit, public faiss::simd256bit
-
struct simd8uint32 : public faiss::simd256bit, public faiss::simd256bit, public faiss::simd256bit
- #include <simdlib_avx2.h>
-
struct simd8float32 : public faiss::simd256bit, public faiss::simd256bit, public faiss::simd256bit
-
namespace detail
-
namespace simdlib
Typedefs
Functions
-
static inline uint8x16x2_t reinterpret_u8(const uint8x16x2_t &v)
-
static inline uint8x16x2_t reinterpret_u8(const uint16x8x2_t &v)
-
static inline uint8x16x2_t reinterpret_u8(const uint32x4x2_t &v)
-
static inline uint8x16x2_t reinterpret_u8(const float32x4x2_t &v)
-
static inline uint16x8x2_t reinterpret_u16(const uint8x16x2_t &v)
-
static inline uint16x8x2_t reinterpret_u16(const uint16x8x2_t &v)
-
static inline uint16x8x2_t reinterpret_u16(const uint32x4x2_t &v)
-
static inline uint16x8x2_t reinterpret_u16(const float32x4x2_t &v)
-
static inline uint32x4x2_t reinterpret_u32(const uint8x16x2_t &v)
-
static inline uint32x4x2_t reinterpret_u32(const uint16x8x2_t &v)
-
static inline uint32x4x2_t reinterpret_u32(const uint32x4x2_t &v)
-
static inline uint32x4x2_t reinterpret_u32(const float32x4x2_t &v)
-
static inline float32x4x2_t reinterpret_f32(const uint8x16x2_t &v)
-
static inline float32x4x2_t reinterpret_f32(const uint16x8x2_t &v)
-
static inline float32x4x2_t reinterpret_f32(const uint32x4x2_t &v)
-
static inline float32x4x2_t reinterpret_f32(const float32x4x2_t &v)
-
static inline void bin(const char (&bytes)[32], char bits[257])
-
template<typename T, size_t N, typename S>
static inline std::string elements_to_string(const char *fmt, const S &simd)
-
template<typename T>
static inline unary_func_impl<remove_cv_ref_t<T>, remove_cv_ref_t<T>> unary_func(const T &a)
-
template<typename T, typename U>
static inline unary_func_impl<remove_cv_ref_t<T>, remove_cv_ref_t<U>> unary_func(const U &a)
-
template<typename T>
static inline binary_func_impl<remove_cv_ref_t<T>, remove_cv_ref_t<T>> binary_func(const T &a, const T &b)
-
template<typename T, typename U>
static inline binary_func_impl<remove_cv_ref_t<T>, remove_cv_ref_t<U>> binary_func(const U &a, const U &b)
-
static inline uint16_t vmovmask_u8(const uint8x16_t &v)
-
template<uint16x8_t (*F)(uint16x8_t, uint16x8_t)>
static inline uint32_t cmp_xe32(const uint16x8x2_t &d0, const uint16x8x2_t &d1, const uint16x8x2_t &thr)
-
template<typename T, typename U = decltype(reinterpret_u8(std::declval<T>().data))>
struct is_simd256bit : public std::is_same<decltype(reinterpret_u8(std::declval<T>().data)), uint8x16x2_t>
-
template<typename D, typename T>
struct set1_impl Public Functions
-
template<remove_cv_ref_t<decltype(std::declval<D>().val[0])> (*F)(T)>
inline void call()
-
template<remove_cv_ref_t<decltype(std::declval<D>().val[0])> (*F)(T)>
-
template<typename T, typename U>
struct unary_func_impl Public Types
-
using Telem = remove_cv_ref_t<decltype(std::declval<T>().val[0])>
-
using Uelem = remove_cv_ref_t<decltype(std::declval<U>().val[0])>
-
using Telem = remove_cv_ref_t<decltype(std::declval<T>().val[0])>
-
template<typename T, typename U>
struct binary_func_impl Public Types
-
using Telem = remove_cv_ref_t<decltype(std::declval<T>().val[0])>
-
using Uelem = remove_cv_ref_t<decltype(std::declval<U>().val[0])>
-
using Telem = remove_cv_ref_t<decltype(std::declval<T>().val[0])>
-
static inline uint8x16x2_t reinterpret_u8(const uint8x16x2_t &v)
-
namespace simdlib
-
struct simd16uint16 : public faiss::simd256bit, public faiss::simd256bit, public faiss::simd256bit