File simdlib_neon.h

namespace faiss

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.

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. 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)

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. 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.

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. 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.

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. 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.

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. Definition of inverted lists + a few common classes that implement the interface.

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. 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.

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. In this file are the implementations of extra metrics beyond L2 and inner product

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. 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
#include <simdlib_avx2.h>
struct simd32uint8 : public faiss::simd256bit, public faiss::simd256bit
struct simd8uint32 : public faiss::simd256bit, public faiss::simd256bit
#include <simdlib_avx2.h>
struct simd8float32 : public faiss::simd256bit, public faiss::simd256bit
namespace detail
namespace simdlib

Typedefs

template<typename T>
using remove_cv_ref_t = typename std::remove_reference<typename std::remove_cv<T>::type>::type

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 ::uint16x8_t vdupq_n_u16(std::uint16_t v)
static inline ::uint8x16_t vdupq_n_u8(std::uint8_t v)
static inline void bin(const char (&bytes)[32], char bits[257])
template<typename T, size_t N, typename S>
static inline void bin(const S &simd, char bits[257])
template<typename S>
static inline std::string bin(const S &simd)
template<typename D, typename T>
static inline set1_impl<remove_cv_ref_t<D>, T> set1(D &d, T t)
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<std::uint8_t Shift>
static inline uint16x8_t vshlq(uint16x8_t vec)
template<std::uint8_t Shift>
static inline uint16x8_t vshrq(uint16x8_t vec)
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()

Public Members

D &d
T 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])>

Public Functions

template<Telem (*F)(Uelem)>
inline T call()

Public Members

const U &a
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])>

Public Functions

template<Telem (*F)(Uelem, Uelem)>
inline T call()

Public Members

const U &a
const U &b