6 #ifdef __INTEL_COMPILER
7 # error LLAMA has stopped supporting the Intel Classic Compiler after Intel announced its planned deprecation and \
8 replacement by the Intel LLVM-based compiler. Please migrate to the Intel LLVM-based compiler.
11 #if defined(__INTEL_LLVM_COMPILER)
14 # define LLAMA_INDEPENDENT_DATA \
15 _Pragma("ivdep") _Pragma("clang loop vectorize(assume_safety) interleave(assume_safety)")
16 #elif defined(__clang__)
17 # define LLAMA_INDEPENDENT_DATA _Pragma("clang loop vectorize(assume_safety) interleave(assume_safety)")
18 #elif defined(__NVCOMPILER)
19 # define LLAMA_INDEPENDENT_DATA _Pragma("ivdep")
20 #elif defined(__GNUC__)
21 # define LLAMA_INDEPENDENT_DATA _Pragma("GCC ivdep")
22 #elif defined(_MSC_VER)
23 # define LLAMA_INDEPENDENT_DATA __pragma(loop(ivdep))
33 # define LLAMA_INDEPENDENT_DATA
36 #ifndef LLAMA_FORCE_INLINE
37 # if defined(__NVCC__) || defined(__HIP__)
38 # define LLAMA_FORCE_INLINE __forceinline__
39 # elif defined(__GNUC__) || defined(__clang__)
40 # define LLAMA_FORCE_INLINE inline __attribute__((always_inline))
41 # elif defined(_MSC_VER) || defined(__INTEL_LLVM_COMPILER)
42 # define LLAMA_FORCE_INLINE __forceinline
45 # define LLAMA_FORCE_INLINE inline
46 # warning LLAMA_FORCE_INLINE is only defined to "inline" for this compiler
51 # define LLAMA_PRAGMA(tokens) _Pragma(#tokens)
55 # if defined(__HIP__) || defined(__NVCC__) || defined(__NVCOMPILER) || defined(__clang__) \
56 || defined(__INTEL_LLVM_COMPILER)
57 # define LLAMA_UNROLL(...) LLAMA_PRAGMA(unroll __VA_ARGS__)
58 # elif defined(__GNUG__)
59 # define LLAMA_UNROLL(...) LLAMA_PRAGMA(GCC unroll __VA_ARGS__)
60 # elif defined(_MSC_VER)
62 # define LLAMA_UNROLL(...)
66 # define LLAMA_UNROLL(...)
67 # warning LLAMA_UNROLL is not implemented for your compiler
72 # if defined(__HIP__) || defined(__NVCC__) || (defined(__clang__) && defined(__CUDA__))
73 # define LLAMA_ACC __device__
74 # elif defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) || defined(__INTEL_LLVM_COMPILER)
78 # warning LLAMA_HOST_ACC is only defined empty for this compiler
82 #ifndef LLAMA_HOST_ACC
83 # if defined(__HIP__) || defined(__NVCC__) || (defined(__clang__) && defined(__CUDA__))
84 # define LLAMA_HOST_ACC __host__ __device__
85 # elif defined(__GNUC__) || defined(__clang__) || defined(_MSC_VER) || defined(__INTEL_LLVM_COMPILER)
86 # define LLAMA_HOST_ACC
91 # define LLAMA_HOST_ACC
92 # warning LLAMA_HOST_ACC is only defined empty for this compiler
96 #define LLAMA_FN_HOST_ACC_INLINE LLAMA_FORCE_INLINE LLAMA_HOST_ACC
98 #ifndef LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS
99 # if defined(__clang__) || defined(__INTEL_LLVM_COMPILER)
100 # define LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(...) __attribute__((always_inline)) __VA_ARGS__
101 # elif defined(__GNUC__) || (defined(__NVCC__) && !defined(_MSC_VER))
102 # define LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(...) __VA_ARGS__ __attribute__((always_inline))
103 # elif defined(_MSC_VER)
104 # define LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(...) \
107 # define LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(...) __VA_ARGS__
108 # warning LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS not defined for this compiler
111 #ifndef LLAMA_LAMBDA_INLINE
113 # define LLAMA_LAMBDA_INLINE LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS()
116 #ifndef LLAMA_SUPPRESS_HOST_DEVICE_WARNING
117 # if defined(__NVCC__) && !defined(__clang__)
118 # define LLAMA_SUPPRESS_HOST_DEVICE_WARNING _Pragma("nv_exec_check_disable")
122 # define LLAMA_SUPPRESS_HOST_DEVICE_WARNING
126 #ifndef LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING
128 # ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
129 # define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING \
130 _Pragma("nv_diag_suppress 20011") _Pragma("nv_diag_suppress 20014")
132 # define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING \
133 _Pragma("diag_suppress 20011") _Pragma("diag_suppress 20014")
141 # define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING
144 #ifndef LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING
146 # ifdef __NVCC_DIAG_PRAGMA_SUPPORT__
147 # define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING \
148 _Pragma("nv_diag_default 20011") _Pragma("nv_diag_default 20014")
150 # define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING _Pragma("diag_default 20011") _Pragma("diag_default 20014")
153 # define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING
158 #define LLAMA_COPY(x) decltype(x)(x)
161 #if defined(_MSC_VER)
162 # define LLAMA_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
164 # define LLAMA_DECLSPEC_EMPTY_BASES
168 #if __has_cpp_attribute(likely)
169 # define LLAMA_LIKELY likely
171 # define LLAMA_LIKELY
175 #if __has_cpp_attribute(unlikely)
176 # define LLAMA_UNLIKELY unlikely
178 # define LLAMA_UNLIKELY
183 #if defined(__cpp_consteval) && !defined(__NVCOMPILER)
184 # define LLAMA_CONSTEVAL consteval
186 # define LLAMA_CONSTEVAL constexpr
192 # define LLAMA_EXPORT
199 #define CAN_USE_RANGES 0
200 #if __has_include(<version>)
202 # if defined(__cpp_concepts) && defined(__cpp_lib_ranges) && (!defined(__clang__) || __clang_major__ >= 16) \
203 && !defined(__INTEL_LLVM_COMPILER) && (!defined(_MSC_VER) || _MSC_VER > 1932) && !defined(__NVCOMPILER)
204 # undef CAN_USE_RANGES
205 # define CAN_USE_RANGES 1