Skip to content

Struct TempLat::device_kokkos::KokkosNDLambdaWrapperInnerLoop

template <size_t NDim, typename FUN>

ClassList > TempLat > device_kokkos > KokkosNDLambdaWrapperInnerLoop

The CPU dispatch: a functor which wraps a lambda and walks the contiguous last dimension itself. More...

  • #include <kokkos_internal.h>

Public Attributes

Type Name
FUN fun
Idx innerStart
Idx innerStop

Public Functions

Type Name
KokkosNDLambdaWrapperInnerLoop (const FUN & _fun, Idx _innerStart, Idx _innerStop)
DEVICE_INLINE_FUNCTION void operator() (const Args &... args) const

Detailed Description

Kokkos' MDRange tiles all NDim dimensions, and its innermost tile loop is one the vectorizer gives up on it has runtime bounds and no independence guarantee, so GCC emits scalar code for every lattice kernel. Handing the last (unit-stride) dimension back to a plain loop that carries TEMPLAT_ASSUME_INDEPENDENT is what lets it vectorize: measured on the SU(2) kick, 125 -> 46 ns/site, and 8 -> 8064 packed FP instructions. See benchmarks/PERFORMANCE.md.

The functor is copied once, here at construction; the inner loop must not copy it again. The expression trees it holds are NOT cheap to copy (their leaves carry a shared_ptr to the memory manager, so a copy means atomic refcount traffic), and copying one per row costs more than vectorising it saves.

Template parameters:

  • NDim Dimension of the lattice; the wrapped functor still takes all NDim indices.
  • FUN The lambda to which we forward the indices

Public Attributes Documentation

variable fun

FUN TempLat::device_kokkos::KokkosNDLambdaWrapperInnerLoop< NDim, FUN >::fun;

variable innerStart

Idx TempLat::device_kokkos::KokkosNDLambdaWrapperInnerLoop< NDim, FUN >::innerStart;

variable innerStop

Idx TempLat::device_kokkos::KokkosNDLambdaWrapperInnerLoop< NDim, FUN >::innerStop;

Public Functions Documentation

function KokkosNDLambdaWrapperInnerLoop

inline TempLat::device_kokkos::KokkosNDLambdaWrapperInnerLoop::KokkosNDLambdaWrapperInnerLoop (
    const FUN & _fun,
    Idx _innerStart,
    Idx _innerStop
) 

function operator()

template<typename... Args>
inline DEVICE_INLINE_FUNCTION void TempLat::device_kokkos::KokkosNDLambdaWrapperInnerLoop::operator() (
    const Args &... args
) const


The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/parallel/devices/kokkos/kokkos_internal.h