ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
Abi.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*------------------------------ File Abi.h --------------------------------*/
3/*--------------------------------------------------------------------------*/
44/*--------------------------------------------------------------------------*/
45/*----------------------------- DEFINITIONS --------------------------------*/
46/*--------------------------------------------------------------------------*/
47
48#ifndef __ADS_Abi
49 #define __ADS_Abi
50/* self-identification: #endif constant */
51
52// ADS_SIMD, 1 when the vector branches are compiled, and with them the
53// dispatch of the kernels, before hwy/highway.h, which it includes
54#include "ADS/Simd.h"
55
60#ifndef ADS_FLAT_SIMD
61 #define ADS_FLAT_SIMD ADS_SIMD
62#endif
63#if ADS_FLAT_SIMD && ! ADS_SIMD
64 #error "ADS_FLAT_SIMD = 1 needs ADS_WITH_HIGHWAY and no ADS_SIMD_SCALAR"
65#endif
66
67// the compare-and-swap of 16 bytes of Boost.Atomic, with ADS_WITH_BOOST,
68// where Boost finds it free of locks (e.g., cmpxchg16b on x86-64 with
69// -mcx16, the pairs of AArch64), unless turned off
70#ifndef ADS_FLAT_CAS16
71 #if defined( ADS_WITH_BOOST )
72 #include <boost/atomic/capabilities.hpp>
73 #endif
74 #if defined( BOOST_ATOMIC_INT128_LOCK_FREE ) && \
75 ( BOOST_ATOMIC_INT128_LOCK_FREE == 2 )
76 #define ADS_FLAT_CAS16 1
77 #else
78 #define ADS_FLAT_CAS16 0
79 #endif
80#endif
81
82// the pairs of boost::unordered_flat_map in FlatHashTable, only when asked
83// (the code of ADS is on a par with them), and then with ADS_WITH_BOOST
84#ifndef ADS_FLATHASH_BOOST
85 #define ADS_FLATHASH_BOOST 0
86#endif
87
88// the set of vector instructions of the kernels inlined by Highway, its
89// namespace (e.g., N_SSE2, N_AVX2), which the flags of the compiler choose
90// [see SimdInline.h], none without the vector branches
91#if ADS_SIMD
92 #define ADS_ABI_VECTOR HWY_NAMESPACE
93#else
94 #define ADS_ABI_VECTOR none
95#endif
96
97#define ADS_ABI_PASTE( S, C, B, V ) abi_s##S##c##C##b##B##_##V
98#define ADS_ABI_SPELL( S, C, B, V ) ADS_ABI_PASTE( S, C, B, V )
99
101#define ADS_ABI_NAME \
102 ADS_ABI_SPELL( ADS_FLAT_SIMD, ADS_FLAT_CAS16, ADS_FLATHASH_BOOST, \
103 ADS_ABI_VECTOR )
104
106#define ADS_ABI_BEGIN \
107 inline namespace ADS_ABI_NAME \
108 {
109
111#define ADS_ABI_END }
112
113/*--------------------------------------------------------------------------*/
114
115#endif /* Abi.h included */
116
117/*--------------------------------------------------------------------------*/
118/*--------------------------- End File Abi.h -------------------------------*/
119/*--------------------------------------------------------------------------*/
The vector kernels of ADS on Google Highway, with ADS_WITH_HIGHWAY: the loops over arrays that a stru...