23 #ifndef HIP_RUNTIME_API_H
24 #define HIP_RUNTIME_API_H
33 #include <hip/hcc_detail/host_defines.h>
34 #include <hip/hip_runtime_api.h>
37 #if defined (__HCC__) && (__hcc_workweek__ < 16155)
38 #error("This version of HIP requires a newer version of HCC.");
56 #define hipStreamDefault 0x00
58 #define hipStreamNonBlocking 0x01
62 #define hipEventDefault 0x0
63 #define hipEventBlockingSync 0x1
64 #define hipEventDisableTiming 0x2
65 #define hipEventInterprocess 0x4
69 #define hipHostMallocDefault 0x0
70 #define hipHostMallocPortable 0x1
71 #define hipHostMallocMapped 0x2
72 #define hipHostMallocWriteCombined 0x4
75 #define hipHostRegisterDefault 0x0
76 #define hipHostRegisterPortable 0x1
77 #define hipHostRegisterMapped 0x2
78 #define hipHostRegisterIoMemory 0x4
81 #define hipDeviceScheduleAuto 0x0
82 #define hipDeviceScheduleSpin 0x1
83 #define hipDeviceScheduleYield 0x2
84 #define hipDeviceBlockingSync 0x4
85 #define hipDeviceMapHost 0x8
86 #define hipDeviceLmemResizeToMax 0x16
119 dim3(uint32_t _x=1, uint32_t _y=1, uint32_t _z=1) :
x(_x),
y(_y),
z(_z) {};
702 hipError_t hipHostAlloc(
void** ptr,
size_t size,
unsigned int flags) __attribute__((deprecated(
"use hipHostMalloc instead"))) ;;
hipError_t hipHostFree(void *ptr)
Free memory allocated by the hcc hip host memory allocation API.
Definition: hip_memory.cpp:488
hipError_t hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream)
Copy data from src to dst asynchronously.
Definition: hip_memory.cpp:343
hipError_t hipPeekAtLastError(void)
Return last error returned by any HIP runtime API call.
hipError_t hipGetDeviceProperties(hipDeviceProp_t *prop, int device)
Returns device properties.
Definition: hip_device.cpp:267
hipError_t hipMemcpyToSymbol(const char *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind)
Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset...
Definition: hip_memory.cpp:291
hipError_t hipFuncSetCacheConfig(hipFuncCache config)
Set Cache configuration for a specific function.
Definition: hip_device.cpp:90
no preference for shared memory or L1 (default)
Definition: hip_runtime_api.h:92
uint32_t x
x
Definition: hip_runtime_api.h:115
Host-to-Device Copy.
Definition: hip_runtime_api.h:131
hipError_t hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags)
Enable direct access from current device's virtual address space to memory allocations physically loc...
Definition: hip_peer.cpp:101
hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig)
Get Shared memory bank configuration.
Definition: hip_device.cpp:120
hipError_t hipSetDevice(int device)
Set default device to be used for subsequent hip API calls from this thread.
Definition: hip_device.cpp:133
Definition: hip_runtime_api.h:117
Device-to-Host Copy.
Definition: hip_runtime_api.h:132
hipError_t hipHostGetDevicePointer(void **devPtr, void *hstPtr, unsigned int flags)
Get Device pointer from Host Pointer allocated through hipHostAlloc.
hipError_t hipEventSynchronize(hipEvent_t event)
: Wait for an event to complete.
Definition: hip_event.cpp:121
hipError_t hipSetDeviceFlags(unsigned flags)
Set Device flags.
hipFuncCache
Definition: hip_runtime_api.h:91
hipError_t hipEventQuery(hipEvent_t event)
Query event status.
Definition: hip_event.cpp:199
hipError_t hipDeviceGetCacheConfig(hipFuncCache *cacheConfig)
Set Cache configuration for a specific function.
Definition: hip_device.cpp:76
hipError_t hipDeviceDisablePeerAccess(int peerDeviceId)
Disable direct access from current device's virtual address space to memory allocations physically lo...
Definition: hip_peer.cpp:61
hipError_t hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int device)
Query device attribute.
Definition: hip_device.cpp:191
hipError_t hipMallocHost(void **ptr, size_t size) __attribute__((deprecated("use hipHostMalloc instead")))
Allocate pinned host memory.
Definition: hip_memory.cpp:203
hipError_t hipGetDevice(int *device)
Return the default device id for the calling host thread.
Definition: hip_device.cpp:31
hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory.
Definition: hip_memory.cpp:152
hipDeviceAttribute_t
Definition: hip_runtime_api.h:170
hipError_t hipEventDestroy(hipEvent_t event)
Destroy the specified event.
Definition: hip_event.cpp:106
hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags)
Create an asynchronous stream.
Definition: hip_stream.cpp:54
Definition: hip_runtime_api.h:114
uint32_t y
y
Definition: hip_runtime_api.h:116
prefer equal size L1 cache and shared memory
Definition: hip_runtime_api.h:95
hipError_t hipEventCreateWithFlags(hipEvent_t *event, unsigned flags)
Create an event with the specified flags.
Definition: hip_event.cpp:53
hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop)
Return the elapsed time between two events.
Definition: hip_event.cpp:154
hipError_t hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId)
Determine if a device can access a peer's memory.
Definition: hip_peer.cpp:30
hipError_t hipGetDeviceCount(int *count)
Return number of compute-capable devices.
Definition: hip_device.cpp:44
hipError_t hipMemset(void *dst, int value, size_t sizeBytes)
Copy data from src to dst asynchronously.
Definition: hip_memory.cpp:422
hipError_t hipStreamDestroy(hipStream_t stream)
Destroys the specified stream.
Definition: hip_stream.cpp:117
hipError_t hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr)
Get flags associated with host pointer.
Definition: hip_memory.cpp:210
hipError_t hipStreamSynchronize(hipStream_t stream)
Wait for all commands in stream to complete.
Definition: hip_stream.cpp:94
Shared mem is banked at 4-bytes intervals and performs best when adjacent threads access data 4 bytes...
Definition: hip_runtime_api.h:104
hipError_t
Definition: hip_runtime_api.h:142
hipMemcpyKind
Definition: hip_runtime_api.h:129
prefer larger L1 cache and smaller shared memory
Definition: hip_runtime_api.h:94
hipError_t hipDriverGetVersion(int *driverVersion)
Returns the approximate HIP driver version.
Definition: hip_peer.cpp:156
hipError_t hipDeviceSynchronize(void)
Blocks until the default device has completed all preceding requested tasks.
Definition: hip_device.cpp:149
Definition: hip_runtime_api.h:47
hipError_t hipHostRegister(void *hostPtr, size_t sizeBytes, unsigned int flags)
Register host memory so it can be accessed from the current device.
Definition: hip_memory.cpp:236
hipError_t hipDeviceSetCacheConfig(hipFuncCache cacheConfig)
Set L1/Shared cache partition.
Definition: hip_device.cpp:62
hipError_t hipMalloc(void **ptr, size_t size)
Allocate memory on the default accelerator.
Definition: hip_memory.cpp:117
const char * hipGetErrorName(hipError_t hip_error)
Return name of the specified error code in text form.
Definition: hip_error.cpp:53
hipError_t hipGetLastError(void)
Return last error returned by any HIP runtime API call and resets the stored error code to hipSuccess...
Definition: hip_error.cpp:31
hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags)
Make the specified compute stream wait for an event.
Definition: hip_stream.cpp:75
hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags)
Return flags associated with this stream.
Definition: hip_stream.cpp:146
hipError_t hipMemGetInfo(size_t *free, size_t *total)
Query memory info. Return snapshot of free memory, and total allocatable memory on the device...
Definition: hip_memory.cpp:435
hipError_t hipFree(void *ptr)
Free memory allocated by the hcc hip memory allocation API. This API performs an implicit hipDeviceSy...
Definition: hip_memory.cpp:463
uint32_t z
z
Definition: hip_runtime_api.h:117
hipError_t hipDeviceReset(void)
Destroy all resources and reset all state on the default device in the current process.
Definition: hip_device.cpp:163
Definition: hip_runtime_api.h:74
hipError_t hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream)
Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value val...
Definition: hip_memory.cpp:372
The compiler selects a device-specific value for the banking.
Definition: hip_runtime_api.h:103
Device-to-Device Copy.
Definition: hip_runtime_api.h:133
Definition: hip_hcc.h:483
hipError_t hipMemcpyPeerAsync(void *dst, int dstDevice, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream)
Copies memory from one device to memory on another device.
Definition: hip_peer.cpp:144
Runtime will automatically determine copy-kind based on virtual addresses.
Definition: hip_runtime_api.h:134
hipSharedMemConfig
Definition: hip_runtime_api.h:102
hipError_t hipHostUnregister(void *hostPtr)
Un-register host pointer.
Definition: hip_memory.cpp:272
Definition: hip_hcc.h:399
hipError_t hipMemcpyPeer(void *dst, int dstDeviceId, const void *src, int srcDeviceId, size_t sizeBytes)
Copies memory from one device to memory on another device.
Definition: hip_peer.cpp:131
hipError_t hipStreamCreate(hipStream_t *stream)
Create an asynchronous stream.
Definition: hip_stream.cpp:63
hipError_t hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)
Copy data from src to dst.
Definition: hip_memory.cpp:312
hipError_t hipEventCreate(hipEvent_t *event)
Definition: hip_event.cpp:61
hipError_t hipFreeHost(void *ptr) __attribute__((deprecated("use hipHostFree instead")))
Free memory allocated by the hcc hip host memory allocation API.
Definition: hip_memory.cpp:513
hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config)
Set Shared memory bank configuration.
Definition: hip_device.cpp:105
hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream)
Record an event in the specified stream.
Definition: hip_event.cpp:70
prefer larger shared memory and smaller L1 cache
Definition: hip_runtime_api.h:93
Host-to-Host Copy.
Definition: hip_runtime_api.h:130
hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, void *ptr)
Return attributes for the specified pointer.
Definition: hip_memory.cpp:37
Shared mem is banked at 8-byte intervals and performs best when adjacent threads access data 4 bytes ...
Definition: hip_runtime_api.h:105
const char * hipGetErrorString(hipError_t hip_error)
Return handy text string message to explain the error which occurred.
Definition: hip_error.cpp:66