HIP: Heterogenous-computing Interface for Portability
hip_runtime_api.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved.
3 
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21 */
22 
23 //#pragma once
24 #ifndef HIP_INCLUDE_HIP_HCC_DETAIL_HIP_RUNTIME_API_H
25 #define HIP_INCLUDE_HIP_HCC_DETAIL_HIP_RUNTIME_API_H
26 
31 #include <stdint.h>
32 #include <stddef.h>
33 
34 #ifndef GENERIC_GRID_LAUNCH
35 #define GENERIC_GRID_LAUNCH 1
36 #endif
37 
39 #include <hip/hip_runtime_api.h>
40 #include <hip/hcc_detail/driver_types.h>
43 
44 #if defined(_MSC_VER)
45 #define DEPRECATED(msg) __declspec(deprecated(msg))
46 #else // !defined(_MSC_VER)
47 #define DEPRECATED(msg) __attribute__ ((deprecated(msg)))
48 #endif // !defined(_MSC_VER)
49 
50 #define DEPRECATED_MSG "This API is marked as deprecated and may not be supported in future releases.For more details please refer https://github.com/ROCm-Developer-Tools/HIP/tree/master/docs/markdown/hip_deprecated_api_list"
51 
52 #if defined(__HCC__) && (__hcc_workweek__ < 16155)
53 #error("This version of HIP requires a newer version of HCC.");
54 #endif
55 
56 #define HIP_LAUNCH_PARAM_BUFFER_POINTER ((void*)0x01)
57 #define HIP_LAUNCH_PARAM_BUFFER_SIZE ((void*)0x02)
58 #define HIP_LAUNCH_PARAM_END ((void*)0x03)
59 
60 #ifdef __cplusplus
61  #define __dparm(x) \
62  = x
63 #else
64  #define __dparm(x)
65 #endif
66 
67 // Structure definitions:
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 //---
73 // API-visible structures
74 typedef struct ihipCtx_t* hipCtx_t;
75 
76 // Note many APIs also use integer deviceIds as an alternative to the device pointer:
77 typedef int hipDevice_t;
78 
79 typedef struct ihipStream_t* hipStream_t;
80 
81 // TODO: IPC implementation
82 
83 #define hipIpcMemLazyEnablePeerAccess 0
84 
85 #define HIP_IPC_HANDLE_SIZE 64
86 
87 typedef struct hipIpcMemHandle_st {
88  char reserved[HIP_IPC_HANDLE_SIZE];
90 
91 // TODO: IPC event handle currently unsupported
92 struct ihipIpcEventHandle_t;
93 typedef struct ihipIpcEventHandle_t* hipIpcEventHandle_t;
94 
95 
96 // END TODO
97 
98 typedef struct ihipModule_t* hipModule_t;
99 
100 typedef struct ihipModuleSymbol_t* hipFunction_t;
101 
102 typedef struct hipFuncAttributes {
103  int binaryVersion;
104  int cacheModeCA;
105  size_t constSizeBytes;
106  size_t localSizeBytes;
107  int maxDynamicSharedSizeBytes;
108  int maxThreadsPerBlock;
109  int numRegs;
110  int preferredShmemCarveout;
111  int ptxVersion;
112  size_t sharedSizeBytes;
114 
115 typedef struct ihipEvent_t* hipEvent_t;
116 
117 enum hipLimit_t {
118  hipLimitMallocHeapSize = 0x02,
119 };
120 
125 #define hipStreamDefault \
127  0x00
128 #define hipStreamNonBlocking 0x01
129 
130 
132 #define hipEventDefault 0x0
133 #define hipEventBlockingSync \
134  0x1
135 #define hipEventDisableTiming \
136  0x2
137 #define hipEventInterprocess 0x4
138 #define hipEventReleaseToDevice \
139  0x40000000
140 #define hipEventReleaseToSystem \
143  0x80000000
144 
147 
149 #define hipHostMallocDefault 0x0
150 #define hipHostMallocPortable 0x1
151 #define hipHostMallocMapped \
152  0x2
153 #define hipHostMallocWriteCombined 0x4
155 #define hipHostMallocCoherent \
156  0x40000000
157 #define hipHostMallocNonCoherent \
159  0x80000000
160 
162 
164 #define hipHostRegisterDefault 0x0
165 #define hipHostRegisterPortable 0x1
166 #define hipHostRegisterMapped \
167  0x2
168 #define hipHostRegisterIoMemory 0x4
170 
171 
172 #define hipDeviceScheduleAuto 0x0
173 #define hipDeviceScheduleSpin \
174  0x1
175 #define hipDeviceScheduleYield \
177  0x2
178 #define hipDeviceScheduleBlockingSync 0x4
180 #define hipDeviceScheduleMask 0x7
181 
182 #define hipDeviceMapHost 0x8
183 #define hipDeviceLmemResizeToMax 0x16
184 
185 #define hipArrayDefault 0x00
186 #define hipArrayLayered 0x01
187 #define hipArraySurfaceLoadStore 0x02
188 #define hipArrayCubemap 0x04
189 #define hipArrayTextureGather 0x08
190 
191 /*
192  * @brief hipJitOption
193  * @enum
194  * @ingroup Enumerations
195  */
196 typedef enum hipJitOption {
197  hipJitOptionMaxRegisters = 0,
198  hipJitOptionThreadsPerBlock,
199  hipJitOptionWallTime,
200  hipJitOptionInfoLogBuffer,
201  hipJitOptionInfoLogBufferSizeBytes,
202  hipJitOptionErrorLogBuffer,
203  hipJitOptionErrorLogBufferSizeBytes,
204  hipJitOptionOptimizationLevel,
205  hipJitOptionTargetFromContext,
206  hipJitOptionTarget,
207  hipJitOptionFallbackStrategy,
208  hipJitOptionGenerateDebugInfo,
209  hipJitOptionLogVerbose,
210  hipJitOptionGenerateLineInfo,
211  hipJitOptionCacheMode,
212  hipJitOptionSm3xOpt,
213  hipJitOptionFastCompile,
214  hipJitOptionNumOptions
215 } hipJitOption;
216 
217 
221 typedef enum hipFuncCache_t {
227 
228 
232 typedef enum hipSharedMemConfig {
239 
240 
245 typedef struct dim3 {
246  uint32_t x;
247  uint32_t y;
248  uint32_t z;
249 #ifdef __cplusplus
250  dim3(uint32_t _x = 1, uint32_t _y = 1, uint32_t _z = 1) : x(_x), y(_y), z(_z){};
251 #endif
252 } dim3;
253 
254 
255 // Doxygen end group GlobalDefs
259 //-------------------------------------------------------------------------------------------------
260 
261 
262 // The handle allows the async commands to use the stream even if the parent hipStream_t goes
263 // out-of-scope.
264 // typedef class ihipStream_t * hipStream_t;
265 
266 
267 /*
268  * Opaque structure allows the true event (pointed at by the handle) to remain "live" even if the
269  * surrounding hipEvent_t goes out-of-scope. This is handy for cases where the hipEvent_t goes
270  * out-of-scope but the true event is being written by some async queue or device */
271 // typedef struct hipEvent_t {
272 // struct ihipEvent_t *_handle;
273 //} hipEvent_t;
274 
275 
301 hipError_t hipDeviceSynchronize(void);
302 
303 
315 hipError_t hipDeviceReset(void);
316 
317 
349 hipError_t hipSetDevice(int deviceId);
350 
351 
365 hipError_t hipGetDevice(int* deviceId);
366 
367 
380 hipError_t hipGetDeviceCount(int* count);
381 
391 hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t attr, int deviceId);
392 
406 hipError_t hipGetDeviceProperties(hipDeviceProp_t* prop, int deviceId);
407 
408 
419 hipError_t hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig);
420 
421 
432 hipError_t hipDeviceGetCacheConfig(hipFuncCache_t* cacheConfig);
433 
444 hipError_t hipDeviceGetLimit(size_t* pValue, enum hipLimit_t limit);
445 
446 
457 hipError_t hipFuncSetCacheConfig(const void* func, hipFuncCache_t config);
458 
470 hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig* pConfig);
471 
472 
484 hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config);
485 
510 hipError_t hipSetDeviceFlags(unsigned flags);
511 
520 hipError_t hipChooseDevice(int* device, const hipDeviceProp_t* prop);
521 
522 // end doxygen Device
545 hipError_t hipGetLastError(void);
546 
547 
558 hipError_t hipPeekAtLastError(void);
559 
560 
569 const char* hipGetErrorName(hipError_t hip_error);
570 
571 
582 const char* hipGetErrorString(hipError_t hipError);
583 
584 // end doxygen Error
617 hipError_t hipStreamCreate(hipStream_t* stream);
618 
619 
637 hipError_t hipStreamCreateWithFlags(hipStream_t* stream, unsigned int flags);
638 
639 
658 hipError_t hipStreamCreateWithPriority(hipStream_t* stream, unsigned int flags, int priority);
659 
660 
675 hipError_t hipDeviceGetStreamPriorityRange(int* leastPriority, int* greatestPriority);
676 
677 
696 hipError_t hipStreamDestroy(hipStream_t stream);
697 
698 
714 hipError_t hipStreamQuery(hipStream_t stream);
715 
716 
736 hipError_t hipStreamSynchronize(hipStream_t stream);
737 
738 
758 hipError_t hipStreamWaitEvent(hipStream_t stream, hipEvent_t event, unsigned int flags);
759 
760 
774 hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int* flags);
775 
776 
790 hipError_t hipStreamGetPriority(hipStream_t stream, int* priority);
791 
792 
796 typedef void (*hipStreamCallback_t)(hipStream_t stream, hipError_t status, void* userData);
797 
813 hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback, void* userData,
814  unsigned int flags);
815 
816 
817 // end doxygen Stream
854 hipError_t hipEventCreateWithFlags(hipEvent_t* event, unsigned flags);
855 
856 
868 hipError_t hipEventCreate(hipEvent_t* event);
869 
870 
898 #ifdef __cplusplus
899 hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream = NULL);
900 #else
901 hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream);
902 #endif
903 
920 hipError_t hipEventDestroy(hipEvent_t event);
921 
922 
940 hipError_t hipEventSynchronize(hipEvent_t event);
941 
942 
971 hipError_t hipEventElapsedTime(float* ms, hipEvent_t start, hipEvent_t stop);
972 
973 
989 hipError_t hipEventQuery(hipEvent_t event);
990 
991 
992 // end doxygen Events
1023 hipError_t hipPointerGetAttributes(hipPointerAttribute_t* attributes, const void* ptr);
1024 
1038 hipError_t hipMalloc(void** ptr, size_t size);
1039 
1052 DEPRECATED("use hipHostMalloc instead")
1053 hipError_t hipMallocHost(void** ptr, size_t size);
1054 
1068 hipError_t hipHostMalloc(void** ptr, size_t size, unsigned int flags);
1069 
1083 DEPRECATED("use hipHostMalloc instead")
1084 hipError_t hipHostAlloc(void** ptr, size_t size, unsigned int flags);
1085 
1097 hipError_t hipHostGetDevicePointer(void** devPtr, void* hstPtr, unsigned int flags);
1098 
1108 hipError_t hipHostGetFlags(unsigned int* flagsPtr, void* hostPtr);
1109 
1146 hipError_t hipHostRegister(void* hostPtr, size_t sizeBytes, unsigned int flags);
1147 
1156 hipError_t hipHostUnregister(void* hostPtr);
1157 
1177 hipError_t hipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t height);
1178 
1192 hipError_t hipFree(void* ptr);
1193 
1204 DEPRECATED("use hipHostFree instead")
1205 hipError_t hipFreeHost(void* ptr);
1206 
1220 hipError_t hipHostFree(void* ptr);
1221 
1249 hipError_t hipMemcpy(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind);
1250 
1268 hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void* src, size_t sizeBytes);
1269 
1287 hipError_t hipMemcpyDtoH(void* dst, hipDeviceptr_t src, size_t sizeBytes);
1288 
1306 hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes);
1307 
1325 hipError_t hipMemcpyHtoDAsync(hipDeviceptr_t dst, void* src, size_t sizeBytes, hipStream_t stream);
1326 
1344 hipError_t hipMemcpyDtoHAsync(void* dst, hipDeviceptr_t src, size_t sizeBytes, hipStream_t stream);
1345 
1363 hipError_t hipMemcpyDtoDAsync(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes,
1364  hipStream_t stream);
1365 
1366 
1390 hipError_t hipMemcpyToSymbol(const void* symbolName, const void* src, size_t sizeBytes,
1391  size_t offset __dparm(0), hipMemcpyKind kind __dparm(hipMemcpyHostToDevice));
1392 
1393 
1404 hipError_t hipGetSymbolAddress(void** devPtr, const void* symbolName);
1405 
1406 
1417 hipError_t hipGetSymbolSize(size_t* size, const void* symbolName);
1418 
1419 
1445 hipError_t hipMemcpyToSymbolAsync(const void* symbolName, const void* src, size_t sizeBytes,
1446  size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0));
1447 
1448 hipError_t hipMemcpyFromSymbol(void* dst, const void* symbolName, size_t sizeBytes,
1449  size_t offset __dparm(0), hipMemcpyKind kind __dparm( hipMemcpyDeviceToHost ));
1450 
1451 hipError_t hipMemcpyFromSymbolAsync(void* dst, const void* symbolName, size_t sizeBytes,
1452  size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0));
1453 
1482 hipError_t hipMemcpyAsync(void* dst, const void* src, size_t sizeBytes, hipMemcpyKind kind,
1483  hipStream_t stream __dparm(0));
1484 
1494 hipError_t hipMemset(void* dst, int value, size_t sizeBytes);
1495 
1505 hipError_t hipMemsetD8(hipDeviceptr_t dest, unsigned char value, size_t sizeBytes);
1506 
1522 hipError_t hipMemsetAsync(void* dst, int value, size_t sizeBytes, hipStream_t stream __dparm(0));
1523 
1535 hipError_t hipMemset2D(void* dst, size_t pitch, int value, size_t width, size_t height);
1536 
1549 hipError_t hipMemset2DAsync(void* dst, size_t pitch, int value, size_t width, size_t height,hipStream_t stream __dparm(0));
1550 
1559 hipError_t hipMemset3D(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent );
1560 
1570 hipError_t hipMemset3DAsync(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent ,hipStream_t stream __dparm(0));
1571 
1581 hipError_t hipMemGetInfo(size_t* free, size_t* total);
1582 
1583 
1584 hipError_t hipMemPtrGetInfo(void* ptr, size_t* size);
1585 
1586 
1599 hipError_t hipMallocArray(hipArray** array, const hipChannelFormatDesc* desc, size_t width,
1600  size_t height __dparm(0), unsigned int flags __dparm(hipArrayDefault));
1601 hipError_t hipArrayCreate(hipArray** pHandle, const HIP_ARRAY_DESCRIPTOR* pAllocateArray);
1602 
1603 hipError_t hipArray3DCreate(hipArray** array, const HIP_ARRAY_DESCRIPTOR* pAllocateArray);
1604 
1605 hipError_t hipMalloc3D(hipPitchedPtr* pitchedDevPtr, hipExtent extent);
1606 
1615 hipError_t hipFreeArray(hipArray* array);
1616 
1629 hipError_t hipMalloc3DArray(hipArray** array, const struct hipChannelFormatDesc* desc,
1630  struct hipExtent extent, unsigned int flags);
1647 hipError_t hipMemcpy2D(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
1648  size_t height, hipMemcpyKind kind);
1649 hipError_t hipMemcpyParam2D(const hip_Memcpy2D* pCopy);
1650 
1668 hipError_t hipMemcpy2DAsync(void* dst, size_t dpitch, const void* src, size_t spitch, size_t width,
1669  size_t height, hipMemcpyKind kind, hipStream_t stream __dparm(0));
1670 
1687 hipError_t hipMemcpy2DToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src,
1688  size_t spitch, size_t width, size_t height, hipMemcpyKind kind);
1689 
1706 hipError_t hipMemcpyToArray(hipArray* dst, size_t wOffset, size_t hOffset, const void* src,
1707  size_t count, hipMemcpyKind kind);
1708 
1724 hipError_t hipMemcpyFromArray(void* dst, hipArray_const_t srcArray, size_t wOffset, size_t hOffset,
1725  size_t count, hipMemcpyKind kind);
1726 
1740 hipError_t hipMemcpyAtoH(void* dst, hipArray* srcArray, size_t srcOffset, size_t count);
1741 
1755 hipError_t hipMemcpyHtoA(hipArray* dstArray, size_t dstOffset, const void* srcHost, size_t count);
1756 
1767 hipError_t hipMemcpy3D(const struct hipMemcpy3DParms* p);
1768 
1769 // doxygen end Memory
1801 hipError_t hipDeviceCanAccessPeer(int* canAccessPeer, int deviceId, int peerDeviceId);
1802 
1803 
1820 hipError_t hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags);
1821 
1822 
1834 hipError_t hipDeviceDisablePeerAccess(int peerDeviceId);
1835 
1848 hipError_t hipMemGetAddressRange(hipDeviceptr_t* pbase, size_t* psize, hipDeviceptr_t dptr);
1849 
1850 #ifndef USE_PEER_NON_UNIFIED
1851 #define USE_PEER_NON_UNIFIED 1
1852 #endif
1853 
1854 #if USE_PEER_NON_UNIFIED == 1
1855 
1866 hipError_t hipMemcpyPeer(void* dst, int dstDeviceId, const void* src, int srcDeviceId,
1867  size_t sizeBytes);
1868 
1881 hipError_t hipMemcpyPeerAsync(void* dst, int dstDeviceId, const void* src, int srcDevice,
1882  size_t sizeBytes, hipStream_t stream __dparm(0));
1883 #endif
1884 
1885 
1886 // doxygen end PeerToPeer
1905 // TODO-ctx - more description on error codes.
1906 hipError_t hipInit(unsigned int flags);
1907 
1908 
1928 DEPRECATED(DEPRECATED_MSG)
1929 hipError_t hipCtxCreate(hipCtx_t* ctx, unsigned int flags, hipDevice_t device);
1930 
1941 DEPRECATED(DEPRECATED_MSG)
1942 hipError_t hipCtxDestroy(hipCtx_t ctx);
1943 
1954 DEPRECATED(DEPRECATED_MSG)
1955 hipError_t hipCtxPopCurrent(hipCtx_t* ctx);
1956 
1967 DEPRECATED(DEPRECATED_MSG)
1968 hipError_t hipCtxPushCurrent(hipCtx_t ctx);
1969 
1980 DEPRECATED(DEPRECATED_MSG)
1981 hipError_t hipCtxSetCurrent(hipCtx_t ctx);
1982 
1993 DEPRECATED(DEPRECATED_MSG)
1994 hipError_t hipCtxGetCurrent(hipCtx_t* ctx);
1995 
2007 DEPRECATED(DEPRECATED_MSG)
2008 hipError_t hipCtxGetDevice(hipDevice_t* device);
2009 
2027 DEPRECATED(DEPRECATED_MSG)
2028 hipError_t hipCtxGetApiVersion(hipCtx_t ctx, int* apiVersion);
2029 
2043 DEPRECATED(DEPRECATED_MSG)
2044 hipError_t hipCtxGetCacheConfig(hipFuncCache_t* cacheConfig);
2045 
2059 DEPRECATED(DEPRECATED_MSG)
2060 hipError_t hipCtxSetCacheConfig(hipFuncCache_t cacheConfig);
2061 
2075 DEPRECATED(DEPRECATED_MSG)
2076 hipError_t hipCtxSetSharedMemConfig(hipSharedMemConfig config);
2077 
2091 DEPRECATED(DEPRECATED_MSG)
2092 hipError_t hipCtxGetSharedMemConfig(hipSharedMemConfig* pConfig);
2093 
2105 DEPRECATED(DEPRECATED_MSG)
2106 hipError_t hipCtxSynchronize(void);
2107 
2118 DEPRECATED(DEPRECATED_MSG)
2119 hipError_t hipCtxGetFlags(unsigned int* flags);
2120 
2140 DEPRECATED(DEPRECATED_MSG)
2141 hipError_t hipCtxEnablePeerAccess(hipCtx_t peerCtx, unsigned int flags);
2142 
2159 DEPRECATED(DEPRECATED_MSG)
2160 hipError_t hipCtxDisablePeerAccess(hipCtx_t peerCtx);
2161 
2174 hipError_t hipDevicePrimaryCtxGetState(hipDevice_t dev, unsigned int* flags, int* active);
2175 
2188 hipError_t hipDevicePrimaryCtxRelease(hipDevice_t dev);
2189 
2201 hipError_t hipDevicePrimaryCtxRetain(hipCtx_t* pctx, hipDevice_t dev);
2202 
2213 hipError_t hipDevicePrimaryCtxReset(hipDevice_t dev);
2214 
2226 hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags);
2227 
2228 // doxygen end Context Management
2240 hipError_t hipDeviceGet(hipDevice_t* device, int ordinal);
2241 
2250 hipError_t hipDeviceComputeCapability(int* major, int* minor, hipDevice_t device);
2251 
2260 hipError_t hipDeviceGetName(char* name, int len, hipDevice_t device);
2261 
2270 hipError_t hipDeviceGetPCIBusId(char* pciBusId, int len, int device);
2271 
2272 
2280 hipError_t hipDeviceGetByPCIBusId(int* device, const char* pciBusId);
2281 
2282 
2290 hipError_t hipDeviceTotalMem(size_t* bytes, hipDevice_t device);
2291 
2307 hipError_t hipDriverGetVersion(int* driverVersion);
2308 
2321 hipError_t hipRuntimeGetVersion(int* runtimeVersion);
2322 
2334 hipError_t hipModuleLoad(hipModule_t* module, const char* fname);
2335 
2346 hipError_t hipModuleUnload(hipModule_t module);
2347 
2358 hipError_t hipModuleGetFunction(hipFunction_t* function, hipModule_t module, const char* kname);
2359 
2369 hipError_t hipFuncGetAttributes(hipFuncAttributes* attr, const void* func);
2370 
2382 hipError_t hipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t hmod,
2383  const char* name);
2384 
2385 hipError_t ihipModuleGetGlobal(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t hmod,
2386  const char* name);
2387 
2388 hipError_t hipModuleGetTexRef(textureReference** texRef, hipModule_t hmod, const char* name);
2398 hipError_t hipModuleLoadData(hipModule_t* module, const void* image);
2399 
2412 hipError_t hipModuleLoadDataEx(hipModule_t* module, const void* image, unsigned int numOptions,
2413  hipJitOption* options, void** optionValues);
2414 
2439 hipError_t hipModuleLaunchKernel(hipFunction_t f, unsigned int gridDimX, unsigned int gridDimY,
2440  unsigned int gridDimZ, unsigned int blockDimX,
2441  unsigned int blockDimY, unsigned int blockDimZ,
2442  unsigned int sharedMemBytes, hipStream_t stream,
2443  void** kernelParams, void** extra);
2444 
2445 // doxygen end Version Management
2463 // TODO - expand descriptions:
2469 hipError_t hipProfilerStart();
2470 
2471 
2477 hipError_t hipProfilerStop();
2478 
2479 
2484 // TODO: implement IPC apis
2485 
2511 hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr);
2512 
2549 hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned int flags);
2550 
2569 hipError_t hipIpcCloseMemHandle(void* devPtr);
2570 
2571 
2572 // hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t* handle, void* devPtr);
2573 // hipError_t hipIpcCloseMemHandle(void *devPtr);
2574 // // hipError_t hipIpcOpenEventHandle(hipEvent_t* event, hipIpcEventHandle_t handle);
2575 // hipError_t hipIpcOpenMemHandle(void** devPtr, hipIpcMemHandle_t handle, unsigned int flags);
2576 
2577 
2598 hipError_t hipConfigureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem __dparm(0), hipStream_t stream __dparm(0));
2599 
2600 
2611 hipError_t hipSetupArgument(const void* arg, size_t size, size_t offset);
2612 
2613 
2622 hipError_t hipLaunchByPtr(const void* func);
2623 
2624 
2625 
2631 #ifdef __cplusplus
2632 } /* extern "c" */
2633 #endif
2634 
2635 #include <hip/hcc_detail/hip_prof_api.h>
2636 
2637 #ifdef __cplusplus
2638 extern "C" {
2639 #endif
2640 
2643 hipError_t hipRegisterApiCallback(uint32_t id, void* fun, void* arg);
2644 hipError_t hipRemoveApiCallback(uint32_t id);
2645 hipError_t hipRegisterActivityCallback(uint32_t id, void* fun, void* arg);
2646 hipError_t hipRemoveActivityCallback(uint32_t id);
2647 static inline const char* hipApiName(const uint32_t& id) { return hip_api_name(id); }
2648 const char* hipKernelNameRef(hipFunction_t f);
2649 #ifdef __cplusplus
2650 } /* extern "C" */
2651 #endif
2652 
2653 #ifdef __cplusplus
2654 
2655 hipError_t hipBindTexture(size_t* offset, textureReference* tex, const void* devPtr,
2656  const hipChannelFormatDesc* desc, size_t size = UINT_MAX);
2657 
2658 hipError_t ihipBindTextureImpl(int dim, enum hipTextureReadMode readMode, size_t* offset,
2659  const void* devPtr, const struct hipChannelFormatDesc* desc,
2660  size_t size, textureReference* tex);
2661 
2662 /*
2663  * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture
2664  *reference tex.
2665  *
2666  * @p desc describes how the memory is interpreted when fetching values from the texture. The @p
2667  *offset parameter is an optional byte offset as with the low-level hipBindTexture() function. Any
2668  *memory previously bound to tex is unbound.
2669  *
2670  * @param[in] offset - Offset in bytes
2671  * @param[out] tex - texture to bind
2672  * @param[in] devPtr - Memory area on device
2673  * @param[in] desc - Channel format
2674  * @param[in] size - Size of the memory area pointed to by devPtr
2675  * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
2676  **/
2677 template <class T, int dim, enum hipTextureReadMode readMode>
2678 hipError_t hipBindTexture(size_t* offset, struct texture<T, dim, readMode>& tex, const void* devPtr,
2679  const struct hipChannelFormatDesc& desc, size_t size = UINT_MAX) {
2680  return ihipBindTextureImpl(dim, readMode, offset, devPtr, &desc, size, &tex);
2681 }
2682 
2683 /*
2684  * @brief hipBindTexture Binds size bytes of the memory area pointed to by @p devPtr to the texture
2685  *reference tex.
2686  *
2687  * @p desc describes how the memory is interpreted when fetching values from the texture. The @p
2688  *offset parameter is an optional byte offset as with the low-level hipBindTexture() function. Any
2689  *memory previously bound to tex is unbound.
2690  *
2691  * @param[in] offset - Offset in bytes
2692  * @param[in] tex - texture to bind
2693  * @param[in] devPtr - Memory area on device
2694  * @param[in] size - Size of the memory area pointed to by devPtr
2695  * @return #hipSuccess, #hipErrorInvalidValue, #hipErrorMemoryFree, #hipErrorUnknown
2696  **/
2697 template <class T, int dim, enum hipTextureReadMode readMode>
2698 hipError_t hipBindTexture(size_t* offset, struct texture<T, dim, readMode>& tex, const void* devPtr,
2699  size_t size = UINT_MAX) {
2700  return ihipBindTextureImpl(dim, readMode, offset, devPtr, &(tex.channelDesc), size, &tex);
2701 }
2702 
2703 // C API
2704 hipError_t hipBindTexture2D(size_t* offset, textureReference* tex, const void* devPtr,
2705  const hipChannelFormatDesc* desc, size_t width, size_t height,
2706  size_t pitch);
2707 
2708 hipError_t ihipBindTexture2DImpl(int dim, enum hipTextureReadMode readMode, size_t* offset,
2709  const void* devPtr, const struct hipChannelFormatDesc* desc,
2710  size_t width, size_t height, textureReference* tex);
2711 
2712 template <class T, int dim, enum hipTextureReadMode readMode>
2713 hipError_t hipBindTexture2D(size_t* offset, struct texture<T, dim, readMode>& tex,
2714  const void* devPtr, size_t width, size_t height, size_t pitch) {
2715  return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, &(tex.channelDesc), width, height,
2716  &tex);
2717 }
2718 
2719 template <class T, int dim, enum hipTextureReadMode readMode>
2720 hipError_t hipBindTexture2D(size_t* offset, struct texture<T, dim, readMode>& tex,
2721  const void* devPtr, const struct hipChannelFormatDesc& desc,
2722  size_t width, size_t height, size_t pitch) {
2723  return ihipBindTexture2DImpl(dim, readMode, offset, devPtr, &desc, width, height, &tex);
2724 }
2725 
2726 // C API
2727 hipError_t hipBindTextureToArray(textureReference* tex, hipArray_const_t array,
2728  const hipChannelFormatDesc* desc);
2729 
2730 hipError_t ihipBindTextureToArrayImpl(int dim, enum hipTextureReadMode readMode,
2731  hipArray_const_t array,
2732  const struct hipChannelFormatDesc& desc,
2733  textureReference* tex);
2734 
2735 template <class T, int dim, enum hipTextureReadMode readMode>
2736 hipError_t hipBindTextureToArray(struct texture<T, dim, readMode>& tex, hipArray_const_t array) {
2737  return ihipBindTextureToArrayImpl(dim, readMode, array, tex.channelDesc, &tex);
2738 }
2739 
2740 template <class T, int dim, enum hipTextureReadMode readMode>
2741 hipError_t hipBindTextureToArray(struct texture<T, dim, readMode>& tex, hipArray_const_t array,
2742  const struct hipChannelFormatDesc& desc) {
2743  return ihipBindTextureToArrayImpl(dim, readMode, array, desc, &tex);
2744 }
2745 
2746 template <class T, int dim, enum hipTextureReadMode readMode>
2747 inline static hipError_t hipBindTextureToArray(struct texture<T, dim, readMode> *tex,
2748  hipArray_const_t array,
2749  const struct hipChannelFormatDesc* desc) {
2750  return ihipBindTextureToArrayImpl(dim, readMode, array, *desc, tex);
2751 }
2752 
2753 // C API
2754 hipError_t hipBindTextureToMipmappedArray(const textureReference* tex,
2755  hipMipmappedArray_const_t mipmappedArray,
2756  const hipChannelFormatDesc* desc);
2757 
2758 template <class T, int dim, enum hipTextureReadMode readMode>
2759 hipError_t hipBindTextureToMipmappedArray(const texture<T, dim, readMode>& tex,
2760  hipMipmappedArray_const_t mipmappedArray) {
2761  return hipSuccess;
2762 }
2763 
2764 template <class T, int dim, enum hipTextureReadMode readMode>
2765 hipError_t hipBindTextureToMipmappedArray(const texture<T, dim, readMode>& tex,
2766  hipMipmappedArray_const_t mipmappedArray,
2767  const hipChannelFormatDesc& desc) {
2768  return hipSuccess;
2769 }
2770 
2771 /*
2772  * @brief Unbinds the textuer bound to @p tex
2773  *
2774  * @param[in] tex - texture to unbind
2775  *
2776  * @return #hipSuccess
2777  **/
2778 hipError_t hipUnbindTexture(const textureReference* tex);
2779 
2780 extern hipError_t ihipUnbindTextureImpl(const hipTextureObject_t& textureObject);
2781 
2782 template <class T, int dim, enum hipTextureReadMode readMode>
2783 hipError_t hipUnbindTexture(struct texture<T, dim, readMode>& tex) {
2784  return ihipUnbindTextureImpl(tex.textureObject);
2785 }
2786 
2787 hipError_t hipGetChannelDesc(hipChannelFormatDesc* desc, hipArray_const_t array);
2788 hipError_t hipGetTextureAlignmentOffset(size_t* offset, const textureReference* texref);
2789 hipError_t hipGetTextureReference(const textureReference** texref, const void* symbol);
2790 
2791 hipError_t hipCreateTextureObject(hipTextureObject_t* pTexObject, const hipResourceDesc* pResDesc,
2792  const hipTextureDesc* pTexDesc,
2793  const hipResourceViewDesc* pResViewDesc);
2794 
2795 hipError_t hipDestroyTextureObject(hipTextureObject_t textureObject);
2796 
2797 hipError_t hipGetTextureObjectResourceDesc(hipResourceDesc* pResDesc,
2798  hipTextureObject_t textureObject);
2799 hipError_t hipGetTextureObjectResourceViewDesc(hipResourceViewDesc* pResViewDesc,
2800  hipTextureObject_t textureObject);
2801 hipError_t hipGetTextureObjectTextureDesc(hipTextureDesc* pTexDesc,
2802  hipTextureObject_t textureObject);
2803 hipError_t hipTexRefSetArray(textureReference* tex, hipArray_const_t array, unsigned int flags);
2804 
2805 hipError_t hipTexRefSetAddressMode(textureReference* tex, int dim, hipTextureAddressMode am);
2806 
2807 hipError_t hipTexRefSetFilterMode(textureReference* tex, hipTextureFilterMode fm);
2808 
2809 hipError_t hipTexRefSetFlags(textureReference* tex, unsigned int flags);
2810 
2811 hipError_t hipTexRefSetFormat(textureReference* tex, hipArray_Format fmt, int NumPackedComponents);
2812 
2813 hipError_t hipTexRefSetAddress(size_t* offset, textureReference* tex, hipDeviceptr_t devPtr,
2814  size_t size);
2815 
2816 hipError_t hipTexRefSetAddress2D(textureReference* tex, const HIP_ARRAY_DESCRIPTOR* desc,
2817  hipDeviceptr_t devPtr, size_t pitch);
2818 
2819 hipError_t hipCreateSurfaceObject(hipSurfaceObject_t* pSurfObject, const hipResourceDesc* pResDesc);
2820 
2821 hipError_t hipDestroySurfaceObject(hipSurfaceObject_t surfaceObject);
2822 
2823 // doxygen end Texture
2829 #endif
2830 
2831 
2849 // end-group HCC_Specific
2855 // doxygen end HIP API
2860 #endif
hipError_t hipHostFree(void *ptr)
Free memory allocated by the hcc hip host memory allocation API This API performs an implicit hipDevi...
Definition: hip_memory.cpp:1917
prefer larger L1 cache and smaller shared memory
Definition: hip_runtime_api.h:224
hipError_t hipModuleGetFunction(hipFunction_t *function, hipModule_t module, const char *kname)
Function with kname will be extracted if present in module.
Definition: hip_module.cpp:483
hipError_t hipCtxDisablePeerAccess(hipCtx_t peerCtx)
Disable direct access from current context&#39;s virtual address space to memory allocations physically l...
Definition: hip_peer.cpp:218
hipError_t hipMemset3D(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent)
Fills synchronously the memory area pointed to by pitchedDevPtr with the constant value...
Definition: hip_memory.cpp:1790
hipError_t hipStreamGetPriority(hipStream_t stream, int *priority)
Query the priority of a stream.
Definition: hip_stream.cpp:231
hipError_t hipDeviceGetCacheConfig(hipFuncCache_t *cacheConfig)
Set Cache configuration for a specific function.
Definition: hip_device.cpp:84
hipError_t hipDriverGetVersion(int *driverVersion)
Returns the approximate HIP driver version.
Definition: hip_context.cpp:88
hipError_t hipPeekAtLastError(void)
Return last error returned by any HIP runtime API call.
Definition: hip_error.cpp:41
hipError_t hipDevicePrimaryCtxSetFlags(hipDevice_t dev, unsigned int flags)
Set flags for the primary context.
Definition: hip_context.cpp:324
hipError_t hipDevicePrimaryCtxRetain(hipCtx_t *pctx, hipDevice_t dev)
Retain the primary context on the GPU.
Definition: hip_context.cpp:299
struct dim3 dim3
hipError_t hipDeviceComputeCapability(int *major, int *minor, hipDevice_t device)
Returns the compute capability of the device.
Definition: hip_device.cpp:369
hipError_t hipDeviceGetByPCIBusId(int *device, const char *pciBusId)
Returns a handle to a compute device.
Definition: hip_device.cpp:427
hipError_t hipMemGetAddressRange(hipDeviceptr_t *pbase, size_t *psize, hipDeviceptr_t dptr)
Get information on memory allocations.
Definition: hip_memory.cpp:1980
TODO-doc.
hipError_t hipFreeHost(void *ptr)
Free memory allocated by the hcc hip host memory allocation API. [Deprecated].
Definition: hip_memory.cpp:1950
hipError_t hipMemcpyToArray(hipArray *dst, size_t wOffset, size_t hOffset, const void *src, size_t count, hipMemcpyKind kind)
Copies data between host and device.
Definition: hip_memory.cpp:1309
unsigned long long hipSurfaceObject_t
Definition: hip_surface_types.h:36
hipError_t hipModuleLoadDataEx(hipModule_t *module, const void *image, unsigned int numOptions, hipJitOption *options, void **optionValues)
builds module from code object which resides in host memory. Image is pointer to that location...
Definition: hip_module.cpp:617
Definition: driver_types.h:232
hipError_t hipMallocPitch(void **ptr, size_t *pitch, size_t width, size_t height)
Definition: hip_memory.cpp:400
hipError_t hipMemcpy2DAsync(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind, hipStream_t stream __dparm(0))
Copies data between host and device.
hipError_t hipMemcpy2D(void *dst, size_t dpitch, const void *src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind)
Copies data between host and device.
Definition: hip_memory.cpp:1650
hipError_t hipStreamAddCallback(hipStream_t stream, hipStreamCallback_t callback, void *userData, unsigned int flags)
Adds a callback to be called on the host after all currently enqueued items in the stream have comple...
Definition: hip_stream.cpp:251
hipError_t hipMemcpyFromArray(void *dst, hipArray_const_t srcArray, size_t wOffset, size_t hOffset, size_t count, hipMemcpyKind kind)
Copies data between host and device.
Definition: hip_memory.cpp:1328
uint32_t x
x
Definition: hip_runtime_api.h:246
hipError_t hipMemcpyAtoH(void *dst, hipArray *srcArray, size_t srcOffset, size_t count)
Copies data between host and device.
Definition: hip_memory.cpp:1365
hipError_t hipDeviceEnablePeerAccess(int peerDeviceId, unsigned int flags)
Enable direct access from current device&#39;s virtual address space to memory allocations physically loc...
Definition: hip_peer.cpp:191
hipError_t hipCtxPopCurrent(hipCtx_t *ctx)
Pop the current/default context and return the popped context.
Definition: hip_context.cpp:136
const char * hipGetErrorString(hipError_t hipError)
Return handy text string message to explain the error which occurred.
Definition: hip_error.cpp:54
hipError_t hipDeviceGetSharedMemConfig(hipSharedMemConfig *pConfig)
Returns bank width of shared memory for current device.
Definition: hip_device.cpp:125
Definition: hip_runtime_api.h:137
hipError_t hipDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority)
Returns numerical values that correspond to the least and greatest stream priority.
Definition: hip_stream.cpp:115
prefer equal size L1 cache and shared memory
Definition: hip_runtime_api.h:225
hipError_t hipHostGetDevicePointer(void **devPtr, void *hstPtr, unsigned int flags)
Get Device pointer from Host Pointer allocated through hipHostMalloc.
hipError_t hipFreeArray(hipArray *array)
Frees an array on the device.
Definition: hip_memory.cpp:1952
hipError_t hipStreamCreateWithPriority(hipStream_t *stream, unsigned int flags, int priority)
Create an asynchronous stream with the specified priority.
Definition: hip_stream.cpp:106
hipError_t hipMemsetAsync(void *dst, int value, size_t sizeBytes, hipStream_t stream __dparm(0))
Fills the first sizeBytes bytes of the memory area pointed to by dev with the constant byte value val...
hipError_t hipEventSynchronize(hipEvent_t event)
Wait for an event to complete.
Definition: hip_event.cpp:167
Definition: driver_types.h:173
hipError_t hipMemcpyHtoD(hipDeviceptr_t dst, void *src, size_t sizeBytes)
Copy data from Host to Device.
Definition: hip_memory.cpp:1154
hipError_t hipModuleUnload(hipModule_t module)
Frees the module.
Definition: hip_module.cpp:115
Definition: hip_module.cpp:90
hipError_t hipSetDeviceFlags(unsigned flags)
The current device behavior is changed according the flags passed.
hipError_t hipEventQuery(hipEvent_t event)
Query event status.
Definition: hip_event.cpp:257
hipError_t hipDeviceDisablePeerAccess(int peerDeviceId)
Disable direct access from current device&#39;s virtual address space to memory allocations physically lo...
Definition: hip_peer.cpp:184
hipError_t hipCtxGetSharedMemConfig(hipSharedMemConfig *pConfig)
Get Shared memory bank configuration.
Definition: hip_context.cpp:244
hipError_t hipCtxCreate(hipCtx_t *ctx, unsigned int flags, hipDevice_t device)
Create a context and set it as current/ default context.
Definition: hip_context.cpp:55
#define hipArrayDefault
Default HIP array allocation flag.
Definition: hip_runtime_api.h:185
hipError_t hipMallocArray(hipArray **array, const hipChannelFormatDesc *desc, size_t width, size_t height __dparm(0), unsigned int flags __dparm(hipArrayDefault))
Allocate an array on the device.
hipError_t hipCtxSetSharedMemConfig(hipSharedMemConfig config)
Set Shared memory bank configuration.
Definition: hip_context.cpp:236
hipError_t hipCtxSetCurrent(hipCtx_t ctx)
Set the passed context as current/default.
Definition: hip_context.cpp:181
hipError_t hipIpcGetMemHandle(hipIpcMemHandle_t *handle, void *devPtr)
Gets an interprocess memory handle for an existing device memory allocation.
Definition: hip_memory.cpp:2001
Definition: hip_runtime_api.h:102
hipError_t hipMemset2DAsync(void *dst, size_t pitch, int value, size_t width, size_t height, hipStream_t stream __dparm(0))
Fills asynchronously the memory area pointed to by dst with the constant value.
Definition: driver_types.h:107
hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory.
Definition: hip_memory.cpp:268
Definition: hip_hcc_internal.h:886
Definition: texture_types.h:73
hipError_t hipDeviceGetLimit(size_t *pValue, enum hipLimit_t limit)
Get Resource limits of current device.
Definition: hip_device.cpp:96
hipError_t hipModuleLoadData(hipModule_t *module, const void *image)
builds module from code object which resides in host memory. Image is pointer to that location...
Definition: hip_module.cpp:598
Definition: driver_types.h:70
hipDeviceAttribute_t
Definition: hip_runtime_api.h:259
hipError_t hipEventDestroy(hipEvent_t event)
Destroy the specified event.
Definition: hip_event.cpp:155
hipError_t hipStreamCreateWithFlags(hipStream_t *stream, unsigned int flags)
Create an asynchronous stream.
Definition: hip_stream.cpp:92
hipError_t hipConfigureCall(dim3 gridDim, dim3 blockDim, size_t sharedMem __dparm(0), hipStream_t stream __dparm(0))
Configure a kernel launch.
hipError_t hipChooseDevice(int *device, const hipDeviceProp_t *prop)
Device which matches hipDeviceProp_t is returned.
Definition: hip_device.cpp:453
hipError_t hipCtxSetCacheConfig(hipFuncCache_t cacheConfig)
Set L1/Shared cache partition.
Definition: hip_context.cpp:228
hipError_t hipModuleLaunchKernel(hipFunction_t f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, hipStream_t stream, void **kernelParams, void **extra)
launches kernel f with launch parameters and shared memory on stream with arguments passed to kernelp...
Definition: hip_runtime_api.h:245
uint32_t y
y
Definition: hip_runtime_api.h:247
void(* hipStreamCallback_t)(hipStream_t stream, hipError_t status, void *userData)
Definition: hip_runtime_api.h:796
hipError_t hipModuleLoad(hipModule_t *module, const char *fname)
Loads code object from file into a hipModule_t.
Definition: hip_module.cpp:603
hipError_t hipDevicePrimaryCtxReset(hipDevice_t dev)
Resets the primary context on the GPU.
Definition: hip_context.cpp:311
hipError_t hipEventCreateWithFlags(hipEvent_t *event, unsigned flags)
Create an event with the specified flags.
Definition: hip_event.cpp:97
hipError_t hipHostAlloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory [Deprecated].
Definition: hip_memory.cpp:339
hipError_t hipMallocHost(void **ptr, size_t size)
Allocate pinned host memory [Deprecated].
Definition: hip_memory.cpp:335
hipError_t hipEventElapsedTime(float *ms, hipEvent_t start, hipEvent_t stop)
Return the elapsed time between two events.
Definition: hip_event.cpp:200
hipError_t hipDeviceSetCacheConfig(hipFuncCache_t cacheConfig)
Set L1/Shared cache partition.
Definition: hip_device.cpp:76
hipError_t hipDeviceCanAccessPeer(int *canAccessPeer, int deviceId, int peerDeviceId)
Determine if a device can access a peer&#39;s memory.
Definition: hip_peer.cpp:177
hipError_t hipGetDeviceCount(int *count)
Return number of compute-capable devices.
Definition: hip_device.cpp:71
hipError_t hipMemset(void *dst, int value, size_t sizeBytes)
Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant byte value va...
Definition: hip_memory.cpp:1722
Definition: driver_types.h:245
hipError_t hipGetSymbolSize(size_t *size, const void *symbolName)
Copies the size of symbol symbolName to size.
Definition: hip_memory.cpp:1118
hipError_t hipStreamDestroy(hipStream_t stream)
Destroys the specified stream.
Definition: hip_stream.cpp:188
hipError_t hipHostGetFlags(unsigned int *flagsPtr, void *hostPtr)
Return flags associated with host pointer.
Definition: hip_memory.cpp:848
hipError_t hipStreamSynchronize(hipStream_t stream)
Wait for all commands in stream to complete.
Definition: hip_stream.cpp:177
hipError_t hipIpcOpenMemHandle(void **devPtr, hipIpcMemHandle_t handle, unsigned int flags)
Opens an interprocess memory handle exported from another process and returns a device pointer usable...
Definition: hip_memory.cpp:2037
hipError_t hipCtxGetCacheConfig(hipFuncCache_t *cacheConfig)
Set Cache configuration for a specific function.
Definition: hip_context.cpp:220
hipError_t hipMemcpyToSymbol(const void *symbolName, const void *src, size_t sizeBytes, size_t offset __dparm(0), hipMemcpyKind kind __dparm(hipMemcpyHostToDevice))
Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset...
hipError_t hipMemcpyDtoD(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes)
Copy data from Device to Device.
Definition: hip_memory.cpp:1192
hipError_t hipMemset3DAsync(hipPitchedPtr pitchedDevPtr, int value, hipExtent extent, hipStream_t stream __dparm(0))
Fills asynchronously the memory area pointed to by pitchedDevPtr with the constant value...
Definition: hip_runtime_api.h:234
no preference for shared memory or L1 (default)
Definition: hip_runtime_api.h:222
hipError_t hipCtxSynchronize(void)
Blocks until the default context has completed all preceding requested tasks.
Definition: hip_context.cpp:252
hipError_t hipCtxGetCurrent(hipCtx_t *ctx)
Get the handle of the current/ default context.
Definition: hip_context.cpp:170
hipError_t hipGetSymbolAddress(void **devPtr, const void *symbolName)
Copies the memory address of symbol symbolName to devPtr.
Definition: hip_memory.cpp:1110
hipError_t hipMalloc3DArray(hipArray **array, const struct hipChannelFormatDesc *desc, struct hipExtent extent, unsigned int flags)
Allocate an array on the device.
Definition: hip_memory.cpp:760
hipError_t hipMemcpyDtoHAsync(void *dst, hipDeviceptr_t src, size_t sizeBytes, hipStream_t stream)
Copy data from Device to Host asynchronously.
Definition: hip_memory.cpp:1250
hipError_t hipDeviceSynchronize(void)
Waits on all active streams on current device.
Definition: hip_device.cpp:144
hipError_t hipCtxPushCurrent(hipCtx_t ctx)
Push the context to be set as current/ default context.
Definition: hip_context.cpp:157
hipError_t hipMemcpyDtoH(void *dst, hipDeviceptr_t src, size_t sizeBytes)
Copy data from Device to Host.
Definition: hip_memory.cpp:1173
Defines the different newt vector types for HIP runtime.
hipError_t hipMemcpyAsync(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind, hipStream_t stream __dparm(0))
Copy data from src to dst asynchronously.
hipError_t hipDeviceGetName(char *name, int len, hipDevice_t device)
Returns an identifer string for the device.
Definition: hip_device.cpp:381
hipError_t hipGetDeviceProperties(hipDeviceProp_t *prop, int deviceId)
Returns device properties.
Definition: hip_device.cpp:316
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:876
Definition: driver_types.h:61
hipError_t hipMalloc(void **ptr, size_t size)
Allocate memory on the default accelerator.
Definition: hip_memory.cpp:239
const char * hipGetErrorName(hipError_t hip_error)
Return name of the specified error code in text form.
Definition: hip_error.cpp:48
hipError_t hipMemset2D(void *dst, size_t pitch, int value, size_t width, size_t height)
Fills the memory area pointed to by dst with the constant value.
Definition: hip_memory.cpp:1738
Definition: driver_types.h:225
hipFuncCache_t
Definition: hip_runtime_api.h:221
hipError_t hipGetLastError(void)
Return last error returned by any HIP runtime API call and resets the stored error code to #hipSucces...
Definition: hip_error.cpp:32
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:123
hipError_t hipStreamGetFlags(hipStream_t stream, unsigned int *flags)
Return flags associated with this stream.
Definition: hip_stream.cpp:216
Defines surface types for HIP runtime.
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:1826
hipError_t hipCtxGetDevice(hipDevice_t *device)
Get the handle of the device associated with current/default context.
Definition: hip_context.cpp:194
hipError_t hipDevicePrimaryCtxRelease(hipDevice_t dev)
Release the primary context on the GPU.
Definition: hip_context.cpp:288
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:1885
uint32_t z
z
Definition: hip_runtime_api.h:248
hipError_t hipCtxGetApiVersion(hipCtx_t ctx, int *apiVersion)
Returns the approximate HIP api version.
Definition: hip_context.cpp:210
hipError_t hipDeviceReset(void)
The state of current device is discarded and updated to a fresh state.
Definition: hip_device.cpp:149
hipError_t hipInit(unsigned int flags)
Explicitly initializes the HIP runtime.
Definition: hip_context.cpp:42
hipError_t hipMemcpy3D(const struct hipMemcpy3DParms *p)
Copies data between host and device.
Definition: hip_memory.cpp:1384
hipError_t hipRuntimeGetVersion(int *runtimeVersion)
Returns the approximate HIP Runtime version.
Definition: hip_context.cpp:100
hipError_t hipFuncGetAttributes(hipFuncAttributes *attr, const void *func)
Definition: hip_module.cpp:538
hipError_t hipMemcpyHtoA(hipArray *dstArray, size_t dstOffset, const void *srcHost, size_t count)
Copies data between host and device.
Definition: hip_memory.cpp:1347
hipError_t hipSetupArgument(const void *arg, size_t size, size_t offset)
Set a kernel argument.
Definition: hip_clang.cpp:179
hipError_t hipMemcpyDtoDAsync(hipDeviceptr_t dst, hipDeviceptr_t src, size_t sizeBytes, hipStream_t stream)
Copy data from Device to Device asynchronously.
Definition: hip_memory.cpp:1242
Definition: hip_runtime_api.h:83
hipError_t hipSetDevice(int deviceId)
Set default device to be used for subsequent hip API calls from this thread.
Definition: hip_device.cpp:133
hipError_t hipDeviceGet(hipDevice_t *device, int ordinal)
Returns a handle to a compute device.
Definition: hip_context.cpp:73
hipError_t hipDeviceTotalMem(size_t *bytes, hipDevice_t device)
Returns the total amount of memory on the device.
Definition: hip_device.cpp:415
hipError_t hipFuncSetCacheConfig(const void *func, hipFuncCache_t config)
Set Cache configuration for a specific function.
Definition: hip_device.cpp:109
The compiler selects a device-specific value for the banking.
Definition: hip_runtime_api.h:233
hipError_t hipMemcpyPeerAsync(void *dst, int dstDeviceId, const void *src, int srcDevice, size_t sizeBytes, hipStream_t stream __dparm(0))
Copies memory from one device to memory on another device.
hipError_t hipCtxGetFlags(unsigned int *flags)
Return flags used for creating default context.
Definition: hip_context.cpp:257
hipError_t hipCtxDestroy(hipCtx_t ctx)
Destroy a HIP context.
Definition: hip_context.cpp:112
hipError_t hipRegisterApiCallback(uint32_t id, void *fun, void *arg)
Definition: hip_intercept.cpp:33
hipSharedMemConfig
Definition: hip_runtime_api.h:232
Definition: driver_types.h:38
Definition: hip_hcc_internal.h:706
hipError_t hipDeviceGetAttribute(int *pi, hipDeviceAttribute_t attr, int deviceId)
Query for a specific device attribute.
Definition: hip_device.cpp:289
hipError_t hipMemcpyHtoDAsync(hipDeviceptr_t dst, void *src, size_t sizeBytes, hipStream_t stream)
Copy data from Host to Device asynchronously.
Definition: hip_memory.cpp:1235
hipError_t hipHostUnregister(void *hostPtr)
Un-register host pointer.
Definition: hip_memory.cpp:941
Definition: hip_hcc_internal.h:525
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:198
hipError_t hipStreamCreate(hipStream_t *stream)
Create an asynchronous stream.
Definition: hip_stream.cpp:99
hipError_t hipMemcpy(void *dst, const void *src, size_t sizeBytes, hipMemcpyKind kind)
Copy data from src to dst.
Definition: hip_memory.cpp:1127
hipError_t hipEventCreate(hipEvent_t *event)
Definition: hip_event.cpp:103
Definition: driver_types.h:82
Definition: hip_runtime_api.h:87
hipError_t hipDevicePrimaryCtxGetState(hipDevice_t dev, unsigned int *flags, int *active)
Get the state of the primary context.
Definition: hip_context.cpp:266
hipError_t hipCtxEnablePeerAccess(hipCtx_t peerCtx, unsigned int flags)
Enables direct access to memory allocations in a peer context.
Definition: hip_peer.cpp:212
Definition: driver_types.h:201
hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config)
The bank width of shared memory on current device is set.
Definition: hip_device.cpp:117
hipError_t hipGetDevice(int *deviceId)
Return the default device id for the calling host thread.
Definition: hip_device.cpp:32
hipError_t hipEventRecord(hipEvent_t event, hipStream_t stream)
Record an event in the specified stream.
Definition: hip_event.cpp:110
hipError_t hipModuleGetGlobal(hipDeviceptr_t *dptr, size_t *bytes, hipModule_t hmod, const char *name)
returns device memory pointer and size of the kernel present in the module with symbol name ...
Definition: hip_module.cpp:488
Definition: hip_hcc_internal.h:373
hipError_t hipDeviceGetPCIBusId(char *pciBusId, int len, int device)
Returns a PCI Bus Id string for the device, overloaded to take int device ID.
Definition: hip_device.cpp:395
prefer larger shared memory and smaller L1 cache
Definition: hip_runtime_api.h:223
hipError_t hipMemcpy2DToArray(hipArray *dst, size_t wOffset, size_t hOffset, const void *src, size_t spitch, size_t width, size_t height, hipMemcpyKind kind)
Copies data between host and device.
Definition: hip_memory.cpp:1257
hipError_t hipStreamQuery(hipStream_t stream)
Return #hipSuccess if all of the operations in the specified stream have completed, or #hipErrorNotReady if not.
Definition: hip_stream.cpp:154
Definition: hip_runtime_api.h:236
hipError_t hipIpcCloseMemHandle(void *devPtr)
Close memory mapped with hipIpcOpenMemHandle.
Definition: hip_memory.cpp:2067
hipError_t hipMemsetD8(hipDeviceptr_t dest, unsigned char value, size_t sizeBytes)
Fills the first sizeBytes bytes of the memory area pointed to by dest with the constant byte value va...
Definition: hip_memory.cpp:1774
hipError_t hipPointerGetAttributes(hipPointerAttribute_t *attributes, const void *ptr)
Return attributes for the specified pointer.
Definition: hip_memory.cpp:161
hipError_t hipMemcpyToSymbolAsync(const void *symbolName, const void *src, size_t sizeBytes, size_t offset, hipMemcpyKind kind, hipStream_t stream __dparm(0))
Copies sizeBytes bytes from the memory area pointed to by src to the memory area pointed to by offset...
hipError_t hipProfilerStop()
Stop recording of profiling information. When using this API, start the profiler with profiling disab...
Definition: hip_hcc.cpp:2416
hipError_t hipProfilerStart()
Start recording of profiling information When using this API, start the profiler with profiling disab...
Definition: hip_hcc.cpp:2406
hipError_t hipLaunchByPtr(const void *func)
Launch a kernel.
Definition: hip_clang.cpp:197
Definition: texture_types.h:93