Celeritas 0.7+b3eeee4
Loading...
Searching...
No Matches
Classes | Functions
Ldg.hh File Reference
#include <type_traits>
#include "corecel/Macros.hh"

Classes

struct  celeritas::LdgMember< Class, T >
 Storable projector that loads a struct member via ldg . More...
 

Functions

template<class T >
constexpr std::enable_if_t< std::is_arithmetic_v< T >, Tceleritas::ldg (T const *ptr) noexcept
 Wrap the low-level CUDA/HIP "load read-only global memory" function.
 
template<class T >
constexpr std::enable_if_t< std::is_enum_v< T >, Tceleritas::ldg (T const *ptr) noexcept
 Get a pointer to the underlying integer for an enum type.
 
template<class Class , class T >
constexpr T celeritas::ldg (Class const &obj, T Class::*mp) noexcept
 Load a struct member via ldg using a pointer-to-member.
 
template<class Class , class T >
 celeritas::LdgMember (T Class::*) -> LdgMember< Class, T >
 Deduction guide: LdgMember{&Foo::bar} deduces LdgMember<Foo,Bar>
 

Function Documentation

◆ ldg() [1/2]

template<class Class , class T >
constexpr T celeritas::ldg ( Class const obj,
T Class::*  mp 
)
inlineconstexprnoexcept

Load a struct member via ldg using a pointer-to-member.

Convenience overload for when the member is known at the call site.

BIHNodeId parent = ldg(node, &BIHLeafNode::parent);

◆ ldg() [2/2]

template<class T >
constexpr std::enable_if_t< std::is_arithmetic_v< T >, T > celeritas::ldg ( T const ptr)
inlineconstexprnoexcept

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

On CUDA the load is cached in L1/texture memory, improving performance when data is repeatedly read by many threads in a kernel.

Warning
The target must be global memory (or else the kernel may crash) and read-only (or else the result may be wrong) for the lifetime of the kernel. This is generally true for Params data but not State data.