Celeritas 0.7.0-dev.169+develop.bdc0041f6
Loading...
Searching...
No Matches
Classes | Typedefs | Functions | Variables
LdgIterator.hh File Reference
#include <cstddef>
#include <iterator>
#include <type_traits>
#include "corecel/Macros.hh"
#include "corecel/cont/Span.hh"
#include "LdgTraits.hh"
This graph shows which files directly or indirectly include this file:

Classes

class  celeritas::LdgIterator< T >
 Iterator for read-only device data in global memory. More...
 
struct  celeritas::LdgValue< T >
 Wrapper struct for specializing on types supported by LdgIterator. More...
 

Typedefs

template<class T , std::size_t Extent = dynamic_extent>
using celeritas::LdgSpan = Span< LdgValue< T >, Extent >
 Alias for a Span iterating over const values read using __ldg.
 

Functions

template<class T >
CELER_CONSTEXPR_FUNCTION T celeritas::ldg (T const *ptr)
 Wrap the low-level CUDA/HIP "load read-only global memory" function.
 
template<class T >
 celeritas::LdgIterator (T *) -> LdgIterator< std::add_const_t< T > >
 
template<class T , std::size_t N>
CELER_CONSTEXPR_FUNCTION auto celeritas::make_array (LdgSpan< T, N > const &s)
 Construct an array from a fixed-size span, removing LdgValue marker.
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator== (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator!= (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator== (LdgIterator< T > const &it, std::nullptr_t) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator!= (LdgIterator< T > const &it, std::nullptr_t) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator== (std::nullptr_t, LdgIterator< T > const &it) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator!= (std::nullptr_t, LdgIterator< T > const &it) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator< (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator> (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator<= (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator>= (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION LdgIterator< Tceleritas::operator+ (LdgIterator< T > const &it, typename LdgIterator< T >::difference_type const n) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION LdgIterator< Tceleritas::operator+ (typename LdgIterator< T >::difference_type const n, LdgIterator< T > const &it) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION LdgIterator< Tceleritas::operator- (LdgIterator< T > const &it, typename LdgIterator< T >::difference_type const n) noexcept
 
template<class T >
CELER_CONSTEXPR_FUNCTION auto celeritas::operator- (LdgIterator< T > const &lhs, LdgIterator< T > const &rhs) noexcept -> typename LdgIterator< T >::difference_type
 

Variables

template<class T >
constexpr bool celeritas::is_ldg_supported_v = !std::is_void_v<typename LdgTraits<T>::underlying_type>
 Whether a type is supported by __ldg.
 

Function Documentation

◆ ldg()

template<class T >
CELER_CONSTEXPR_FUNCTION T celeritas::ldg ( T const ptr)

Wrap the low-level CUDA/HIP "load read-only global memory" function.

This low-level capability allows improved caching because we're promising that the data is not mem. For CUDA the load is cached in L1/texture memory, theoretically improving performance if repeatedly accessed.

Warning
The target address must be read-only for the lifetime of the kernel. This is generally true for Params data but not State data.

◆ make_array()

template<class T , std::size_t N>
CELER_CONSTEXPR_FUNCTION auto celeritas::make_array ( LdgSpan< T, N > const s)

Construct an array from a fixed-size span, removing LdgValue marker.

Note:

make_array(Span<T,N> const&)

is not reused because:

  1. Using this overload reads input data using __ldg
  2. return make_array<T, N>(s)
    results in segfault (gcc 11.3). This might be a compiler bug because temporary lifetime should be extended until the end of the expression and we return a copy...

◆ operator!=() [1/3]

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator!= ( LdgIterator< T > const it,
std::nullptr_t   
)
noexcept

RandomAccessIterator requirements

◆ operator!=() [2/3]

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator!= ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
)
noexcept

RandomAccessIterator requirements

◆ operator!=() [3/3]

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator!= ( std::nullptr_t  ,
LdgIterator< T > const it 
)
noexcept

RandomAccessIterator requirements

◆ operator+() [1/2]

template<class T >
CELER_CONSTEXPR_FUNCTION LdgIterator< T > celeritas::operator+ ( LdgIterator< T > const it,
typename LdgIterator< T >::difference_type const  n 
)
noexcept

RandomAccessIterator requirements

◆ operator+() [2/2]

template<class T >
CELER_CONSTEXPR_FUNCTION LdgIterator< T > celeritas::operator+ ( typename LdgIterator< T >::difference_type const  n,
LdgIterator< T > const it 
)
noexcept

RandomAccessIterator requirements

◆ operator-() [1/2]

template<class T >
CELER_CONSTEXPR_FUNCTION LdgIterator< T > celeritas::operator- ( LdgIterator< T > const it,
typename LdgIterator< T >::difference_type const  n 
)
noexcept

RandomAccessIterator requirements

◆ operator-() [2/2]

template<class T >
CELER_CONSTEXPR_FUNCTION auto celeritas::operator- ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
) -> typename LdgIterator<T>::difference_type
noexcept

RandomAccessIterator requirements

◆ operator<()

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator< ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
)
noexcept

RandomAccessIterator requirements

◆ operator<=()

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator<= ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
)
noexcept

RandomAccessIterator requirements

◆ operator==() [1/3]

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator== ( LdgIterator< T > const it,
std::nullptr_t   
)
noexcept

RandomAccessIterator requirements

◆ operator==() [2/3]

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator== ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
)
noexcept

RandomAccessIterator requirements

◆ operator==() [3/3]

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator== ( std::nullptr_t  ,
LdgIterator< T > const it 
)
noexcept

RandomAccessIterator requirements

◆ operator>()

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator> ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
)
noexcept

RandomAccessIterator requirements

◆ operator>=()

template<class T >
CELER_CONSTEXPR_FUNCTION bool celeritas::operator>= ( LdgIterator< T > const lhs,
LdgIterator< T > const rhs 
)
noexcept

RandomAccessIterator requirements