|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
GPU portability layer: host/device decoration macros and backend detection. More...

Go to the source code of this file.
Namespaces | |
| namespace | EBGeometry |
| Namespace containing all of EBGeometry's functionality. | |
Functions | |
| template<class F , class... Args> | |
| EBGEOMETRY_EXEC_CHECK_DISABLE decltype(auto) | EBGeometry::CallableDetail::call (F &&a_f, Args &&... a_args) |
| Call a caller-supplied callable from host-device code. | |
GPU portability layer: host/device decoration macros and backend detection.
This header is the single home for the thin backend-abstraction macros used by the EBGeometry GPU port. It performs no allocation and pulls in no backend runtime headers; it only detects which offload compiler (if any) is translating the current translation unit and expands the decoration macros accordingly. On an ordinary host C++17 compiler every decoration macro expands to nothing, so annotated code is byte-for-byte identical to unannotated code.
It also defines the inlining and launch macros: EBGEOMETRY_DEVICE_NOINLINE (out of line in a device pass), EBGEOMETRY_HOST_ALWAYS_INLINE and EBGEOMETRY_HOST_NOINLINE (GCC/Clang attributes in a host pass, so these two are not empty on a host compiler), and EBGEOMETRY_GRID_CONSTANT (a kernel parameter read in place, CUDA only).
__CUDACC__): decorations expand to __host__ / __device__ / __global__.__HIPCC__): same expansions as CUDA (HIP uses the identical attributes).Any other compiler, including a SYCL or OpenACC compiler, sees host code: the macros expand to nothing, and nothing in EBGeometry is callable inside a SYCL kernel or an OpenACC compute region.
|
inline |
Call a caller-supplied callable from host-device code.
Forwards to a_f(a_args...). Every library host-device template that calls a callable its caller passed calls it through here, so that a host callable (a lambda) used from host code does not make nvcc warn (see EBGEOMETRY_EXEC_CHECK_DISABLE). It adds nothing to the generated code: the compilers inline it. It is not forced inline on the host: EBGEOMETRY_HOST_ALWAYS_INLINE here changed GCC's inlining of the double tape's primitive dispatch (Performance/Tape and ClosestPrimitive, nm -C -S), while plain inline left every function as it was.
| F | Callable. |
| Args | Arguments. |
| [in] | a_f | The callable. |
| [in] | a_args | The arguments. |