Gromacs
2026.0-dev-20250612-fdec757
|
Shared device methods for SYCL and HIP targets.
This file contains the following shared methods: *
TODO add more shared methods to this file
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 | __attribute__ ((always_inline)) IndexType calculateOffset(IndexType index) |
Helper method to calculate offsets to memory locations on AMD hardware. More... | |
Variables | |
static 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.
IndexType idx |