Gromacs
2025.1
|
#include "config.h"
#include <type_traits>
Shared device methods for SYCL and HIP targets.
This file contains the following shared methods: *
TODO add more shared methods to this file
Macros | |
#define | GMX_ALWAYS_INLINE_ATTRIBUTE __attribute__((always_inline)) |
#define | GMX_FUNC_ATTRIBUTE GMX_HOSTDEVICE_ATTRIBUTE GMX_ALWAYS_INLINE_ATTRIBUTE |
Typedefs | |
template<typename TPtr > | |
using | CharPtr = std::conditional_t< std::is_const_v< std::remove_pointer_t< TPtr >>, const char *, char * > |
Convert type of pointer to char while preserving const-ness. | |
Functions | |
template<typename ValueType , typename IndexType , std::enable_if_t< std::is_integral< IndexType >::value, bool > = true> | |
static GMX_DEVICE_ATTRIBUTE | __attribute__ ((always_inline)) IndexType calculateOffset(IndexType index) |
Helper method to calculate offsets to memory locations on AMD hardware. More... | |
Variables | |
static GMX_DEVICE_ATTRIBUTE IndexType | idx |
|
inlinestatic |
Helper method to calculate offsets to memory locations on AMD hardware.
Return address relative to buffer
and offset by idx
.
Uses builtin_assume to work around the compiler generating extra instructions for negative offsets.
This method helps hipcc (as late as of rocm 6.2.2, hipcc 6.2.41134-65d174c3e and likely later) to generate faster code for loads where 64-bit scalar + 32-bit vector registers are used instead of 64-bit vector versions, saving a few instructions for computing 64-bit vector addresses.
GMX_DEVICE_ATTRIBUTE IndexType idx |