Low-Level Abstraction of Memory Access
macros.hpp File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LLAMA_INDEPENDENT_DATA
 
#define LLAMA_FORCE_INLINE   inline
 Forces the compiler to inline a function annotated with this macro. More...
 
#define LLAMA_PRAGMA(tokens)   _Pragma(#tokens)
 
#define LLAMA_UNROLL(...)
 
#define LLAMA_ACC
 
#define LLAMA_HOST_ACC
 
#define LLAMA_FN_HOST_ACC_INLINE   LLAMA_FORCE_INLINE LLAMA_HOST_ACC
 
#define LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(...)   __VA_ARGS__
 
#define LLAMA_LAMBDA_INLINE   LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS()
 Gives strong indication to the compiler to inline the attributed lambda. More...
 
#define LLAMA_SUPPRESS_HOST_DEVICE_WARNING
 
#define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING
 
#define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING
 
#define LLAMA_COPY(x)   decltype(x)(x)
 Forces a copy of a value. This is useful to prevent ODR usage of constants when compiling for GPU targets. More...
 
#define LLAMA_DECLSPEC_EMPTY_BASES
 
#define LLAMA_LIKELY
 Expands to likely if [[likely]] supported by the compiler. Use as [[LLAMA_LIKELY]]. More...
 
#define LLAMA_UNLIKELY
 Expands to unlikely if [[unlikely]] supported by the compiler. Use as [[LLAMA_UNLIKELY]]. More...
 
#define LLAMA_CONSTEVAL   constexpr
 Expands to consteval if the compilers supports the keyword, otherwise to constexpr. More...
 
#define LLAMA_EXPORT
 
#define CAN_USE_RANGES   0
 

Macro Definition Documentation

◆ CAN_USE_RANGES

#define CAN_USE_RANGES   0

Definition at line 199 of file macros.hpp.

◆ LLAMA_ACC

#define LLAMA_ACC

Definition at line 77 of file macros.hpp.

◆ LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING

#define LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING

Suppresses the nvcc warnings: 'calling a host function from a host device function is not allowed' and 'calling a host function("...") from a host device function("...") is not allowed' This macro can be applied before the concerned code block, which then needs to be ended with LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING.

Definition at line 141 of file macros.hpp.

◆ LLAMA_CONSTEVAL

#define LLAMA_CONSTEVAL   constexpr

Expands to consteval if the compilers supports the keyword, otherwise to constexpr.

Definition at line 186 of file macros.hpp.

◆ LLAMA_COPY

#define LLAMA_COPY (   x)    decltype(x)(x)

Forces a copy of a value. This is useful to prevent ODR usage of constants when compiling for GPU targets.

Definition at line 158 of file macros.hpp.

◆ LLAMA_DECLSPEC_EMPTY_BASES

#define LLAMA_DECLSPEC_EMPTY_BASES

Definition at line 164 of file macros.hpp.

◆ LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING

#define LLAMA_END_SUPPRESS_HOST_DEVICE_WARNING

Definition at line 153 of file macros.hpp.

◆ LLAMA_EXPORT

#define LLAMA_EXPORT

Annotation of all LLAMA public APIs. Expands to nothing by default. Can be defined to 'export' when building LLAMA as a C++20 module.

Definition at line 192 of file macros.hpp.

◆ LLAMA_FN_HOST_ACC_INLINE

#define LLAMA_FN_HOST_ACC_INLINE   LLAMA_FORCE_INLINE LLAMA_HOST_ACC

Definition at line 96 of file macros.hpp.

◆ LLAMA_FORCE_INLINE

#define LLAMA_FORCE_INLINE   inline

Forces the compiler to inline a function annotated with this macro.

Definition at line 45 of file macros.hpp.

◆ LLAMA_HOST_ACC

#define LLAMA_HOST_ACC

Some offloading parallelization language extensions such a CUDA, OpenACC or OpenMP 4.5 need to specify whether a class, struct, function or method "resides" on the host, the accelerator (the offloading device) or both. LLAMA supports this with marking every function needed on an accelerator with LLAMA_HOST_ACC.

Definition at line 91 of file macros.hpp.

◆ LLAMA_INDEPENDENT_DATA

#define LLAMA_INDEPENDENT_DATA

May be put in front of a loop statement. Indicates that all (!) data access inside the loop is indepent, so the loop can be safely vectorized. Example:

for(int i = 0; i < N; ++i)
// because of LLAMA_INDEPENDENT_DATA the compiler knows that a and b
// do not overlap and the operation can safely be vectorized
a[i] += b[i];
#define LLAMA_INDEPENDENT_DATA
Definition: macros.hpp:33

Definition at line 33 of file macros.hpp.

◆ LLAMA_LAMBDA_INLINE

#define LLAMA_LAMBDA_INLINE   LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS()

Gives strong indication to the compiler to inline the attributed lambda.

Definition at line 113 of file macros.hpp.

◆ LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS

#define LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS (   ...)    __VA_ARGS__

Definition at line 107 of file macros.hpp.

◆ LLAMA_LIKELY

#define LLAMA_LIKELY

Expands to likely if [[likely]] supported by the compiler. Use as [[LLAMA_LIKELY]].

Definition at line 171 of file macros.hpp.

◆ LLAMA_PRAGMA

#define LLAMA_PRAGMA (   tokens)    _Pragma(#tokens)

Definition at line 51 of file macros.hpp.

◆ LLAMA_SUPPRESS_HOST_DEVICE_WARNING

#define LLAMA_SUPPRESS_HOST_DEVICE_WARNING

Suppresses the nvcc warning: 'calling a host function from host device function.' This macro can be applied to function declarations

Definition at line 122 of file macros.hpp.

◆ LLAMA_UNLIKELY

#define LLAMA_UNLIKELY

Expands to unlikely if [[unlikely]] supported by the compiler. Use as [[LLAMA_UNLIKELY]].

Definition at line 178 of file macros.hpp.

◆ LLAMA_UNROLL

#define LLAMA_UNROLL (   ...)

Requests the compiler to unroll the loop following this directive. An optional unrolling count may be provided as argument, which must be a constant expression.

Definition at line 66 of file macros.hpp.