6 #include <initializer_list> 8 typedef int am_status_t;
11 #define AM_ERROR_MISC -1 13 // Flags for am_alloc API: 14 #define amHostPinned 0x1 15 #define amHostNonCoherent 0x1 16 #define amHostCoherent 0x2 38 _hostPointer(nullptr),
39 _devicePointer(nullptr),
40 _unalignedDevicePointer(nullptr),
42 _isInDeviceMem(false),
46 _appAllocationFlags(0),
49 AmPointerInfo(
void *hostPointer,
void *devicePointer,
void* unalignedDevicePointer, std::size_t sizeBytes,
hc::accelerator &acc,
bool isInDeviceMem=
false,
bool isAmManaged=
false) :
121 am_status_t
am_free(
void* ptr);
130 am_status_t am_copy(
void* dst,
const void* src, std::size_t size) __attribute__ (( deprecated (
"use accelerator_view::copy instead (and note src/dst order reversal)" ))) ;
170 am_status_t am_memtracker_update(
const void* ptr,
int appId,
unsigned allocationFlags,
void *appPtr=
nullptr);
183 am_status_t am_memtracker_remove(
void* ptr);
199 void am_memtracker_print(
void * targetAddress=
nullptr);
207 void am_memtracker_sizeinfo(
const hc::accelerator &acc, std::size_t *deviceMemSize, std::size_t *hostMemSize, std::size_t *userMemSize);
210 void am_memtracker_update_peers(
const hc::accelerator &acc,
int peerCnt, hsa_agent_s *agents);
224 am_status_t am_map_to_peers(
void* ptr, std::size_t num_peer,
const hc::accelerator* peers);
Heterogeneous C++ (HC) API.
auto_voidp am_alloc(std::size_t size, hc::accelerator &acc, unsigned flags)
Allocate a block of size bytes of memory on the specified acc.
std::size_t _sizeBytes
Size of allocation.
Definition: hc_am.hpp:26
void * _devicePointer
Device pointer.
Definition: hc_am.hpp:24
unsigned _appAllocationFlags
App-specific allocation flags. (Used by HIP to store allocation flags)
Definition: hc_am.hpp:33
hc::accelerator _acc
Accelerator where allocation is physically located.
Definition: hc_am.hpp:27
Definition: hc_defines.h:76
bool _isInDeviceMem
Memory is physically resident on a device (if false, memory is located on host)
Definition: hc_am.hpp:28
void * _appPtr
App-specific pointer to additional information.
Definition: hc_am.hpp:34
int _appId
App-specific storage. (Used by HIP to store deviceID)
Definition: hc_am.hpp:32
am_status_t am_free(void *ptr)
Free a block of memory previously allocated with am_alloc.
Heterogeneous C++ (HC) namespace.
Definition: grid_launch.h:10
bool _isAmManaged
Memory was allocated by AM and should be freed when am_reset is called.
Definition: hc_am.hpp:29
uint64_t _allocSeqNum
Sequence number of allocation.
Definition: hc_am.hpp:30
void * _unalignedDevicePointer
Unaligned device pointer.
Definition: hc_am.hpp:25
auto_voidp am_aligned_alloc(std::size_t size, hc::accelerator &acc, unsigned flags, std::size_t alignment=0)
Allocate a block of size bytes of memory on the specified acc.
void * _hostPointer
Host pointer. If host access is not allowed, NULL.
Definition: hc_am.hpp:23
Represents a physical accelerated computing device.
Definition: hc.hpp:700