All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Files | Functions | Variables
Utilities

Files

file  aligned.hpp
 
file  prefetch.hpp
 

Functions

constexpr bool rmm::is_pow2 (std::size_t value) noexcept
 Returns whether or not value is a power of 2. More...
 
constexpr bool rmm::is_supported_alignment (std::size_t alignment) noexcept
 Returns whether or not alignment is a valid memory alignment. More...
 
constexpr std::size_t rmm::align_up (std::size_t value, std::size_t alignment) noexcept
 Align up to nearest multiple of specified power of 2. More...
 
constexpr std::size_t rmm::align_down (std::size_t value, std::size_t alignment) noexcept
 Align down to the nearest multiple of specified power of 2. More...
 
constexpr bool rmm::is_aligned (std::size_t value, std::size_t alignment) noexcept
 Checks whether a value is aligned to a multiple of a specified power of 2. More...
 
bool rmm::is_pointer_aligned (void *ptr, std::size_t alignment=CUDA_ALLOCATION_ALIGNMENT) noexcept
 Checks whether the provided pointer is aligned to a specified alignment. More...
 
void rmm::prefetch (void const *ptr, std::size_t size, rmm::cuda_device_id device, rmm::cuda_stream_view stream)
 Prefetch memory to the specified device on the specified stream. More...
 
template<typename T >
void rmm::prefetch (cuda::std::span< T const > data, rmm::cuda_device_id device, rmm::cuda_stream_view stream)
 Prefetch a span of memory to the specified device on the specified stream. More...
 

Variables

static constexpr std::size_t rmm::RMM_DEFAULT_HOST_ALIGNMENT {alignof(std::max_align_t)}
 Default alignment used for host memory allocated by RMM.
 
static constexpr std::size_t rmm::CUDA_ALLOCATION_ALIGNMENT {256}
 Default alignment used for CUDA memory allocation.
 

Detailed Description

Function Documentation

◆ align_down()

constexpr std::size_t rmm::align_down ( std::size_t  value,
std::size_t  alignment 
)
constexprnoexcept

Align down to the nearest multiple of specified power of 2.

Parameters
[in]valuevalue to align
[in]alignmentamount, in bytes, must be a power of 2
Returns
the aligned value

◆ align_up()

constexpr std::size_t rmm::align_up ( std::size_t  value,
std::size_t  alignment 
)
constexprnoexcept

Align up to nearest multiple of specified power of 2.

Parameters
[in]valuevalue to align
[in]alignmentamount, in bytes, must be a power of 2
Returns
the aligned value

◆ is_aligned()

constexpr bool rmm::is_aligned ( std::size_t  value,
std::size_t  alignment 
)
constexprnoexcept

Checks whether a value is aligned to a multiple of a specified power of 2.

Parameters
[in]valuevalue to check for alignment
[in]alignmentamount, in bytes, must be a power of 2
Returns
true if aligned

◆ is_pointer_aligned()

bool rmm::is_pointer_aligned ( void *  ptr,
std::size_t  alignment = CUDA_ALLOCATION_ALIGNMENT 
)
inlinenoexcept

Checks whether the provided pointer is aligned to a specified alignment.

Parameters
[in]ptrpointer to check for alignment
[in]alignmentrequired alignment in bytes, must be a power of 2
Returns
true if the pointer is aligned

◆ is_pow2()

constexpr bool rmm::is_pow2 ( std::size_t  value)
constexprnoexcept

Returns whether or not value is a power of 2.

Parameters
[in]valuevalue to check.
Returns
True if the input is a power of two with non-negative integer exponent, false otherwise.

◆ is_supported_alignment()

constexpr bool rmm::is_supported_alignment ( std::size_t  alignment)
constexprnoexcept

Returns whether or not alignment is a valid memory alignment.

Parameters
[in]alignmentto check
Returns
True if the alignment is valid, false otherwise.

◆ prefetch() [1/2]

template<typename T >
void rmm::prefetch ( cuda::std::span< T const >  data,
rmm::cuda_device_id  device,
rmm::cuda_stream_view  stream 
)

Prefetch a span of memory to the specified device on the specified stream.

This function is a no-op if the buffer is not backed by CUDA managed memory.

Exceptions
rmm::cuda_errorif the prefetch fails.
Parameters
dataThe span to prefetch
deviceThe device to prefetch to
streamThe stream to use for the prefetch

◆ prefetch() [2/2]

void rmm::prefetch ( void const *  ptr,
std::size_t  size,
rmm::cuda_device_id  device,
rmm::cuda_stream_view  stream 
)

Prefetch memory to the specified device on the specified stream.

This function is a no-op if the pointer is not to CUDA managed memory.

Exceptions
rmm::cuda_errorif the prefetch fails.
Parameters
ptrThe pointer to the memory to prefetch
sizeThe number of bytes to prefetch
deviceThe device to prefetch to
streamThe stream to use for the prefetch