30 #ifndef HIP_INCLUDE_HIP_HIP_RUNTIME_API_H 31 #define HIP_INCLUDE_HIP_HIP_RUNTIME_API_H 35 #include <hip/hip_common.h> 39 HIP_ERROR_INVALID_VALUE,
40 HIP_ERROR_NOT_INITIALIZED,
41 HIP_ERROR_LAUNCH_OUT_OF_RESOURCES
126 typedef enum hipMemoryType {
140 enum hipMemoryType memoryType;
145 unsigned allocationFlags;
159 #if __cplusplus >= 201703L 160 #define __HIP_NODISCARD [[nodiscard]] 162 #define __HIP_NODISCARD 173 typedef enum __HIP_NODISCARD hipError_t {
175 hipErrorOutOfMemory = 2,
176 hipErrorNotInitialized = 3,
177 hipErrorDeinitialized = 4,
178 hipErrorProfilerDisabled = 5,
179 hipErrorProfilerNotInitialized = 6,
180 hipErrorProfilerAlreadyStarted = 7,
181 hipErrorProfilerAlreadyStopped = 8,
182 hipErrorInsufficientDriver = 35,
183 hipErrorInvalidImage = 200,
184 hipErrorInvalidContext = 201,
185 hipErrorContextAlreadyCurrent = 202,
186 hipErrorMapFailed = 205,
187 hipErrorUnmapFailed = 206,
188 hipErrorArrayIsMapped = 207,
189 hipErrorAlreadyMapped = 208,
190 hipErrorNoBinaryForGpu = 209,
191 hipErrorAlreadyAcquired = 210,
192 hipErrorNotMapped = 211,
193 hipErrorNotMappedAsArray = 212,
194 hipErrorNotMappedAsPointer = 213,
195 hipErrorECCNotCorrectable = 214,
196 hipErrorUnsupportedLimit = 215,
197 hipErrorContextAlreadyInUse = 216,
198 hipErrorPeerAccessUnsupported = 217,
199 hipErrorInvalidKernelFile = 218,
200 hipErrorInvalidGraphicsContext = 219,
201 hipErrorInvalidSource = 300,
202 hipErrorFileNotFound = 301,
203 hipErrorSharedObjectSymbolNotFound = 302,
204 hipErrorSharedObjectInitFailed = 303,
205 hipErrorOperatingSystem = 304,
206 hipErrorSetOnActiveProcess = 305,
207 hipErrorInvalidHandle = 400,
208 hipErrorNotFound = 500,
209 hipErrorIllegalAddress = 700,
210 hipErrorInvalidSymbol = 701,
212 hipErrorMissingConfiguration = 1001,
213 hipErrorMemoryAllocation = 1002,
214 hipErrorInitializationError = 1003,
215 hipErrorLaunchFailure =
217 hipErrorPriorLaunchFailure = 1005,
218 hipErrorLaunchTimeOut = 1006,
219 hipErrorLaunchOutOfResources = 1007,
220 hipErrorInvalidDeviceFunction = 1008,
221 hipErrorInvalidConfiguration = 1009,
222 hipErrorInvalidDevice = 1010,
223 hipErrorInvalidValue = 1011,
224 hipErrorInvalidDevicePointer = 1017,
226 hipErrorInvalidMemcpyDirection = 1021,
227 hipErrorUnknown = 1030,
228 hipErrorInvalidResourceHandle = 1033,
229 hipErrorNotReady = 1034,
230 hipErrorNoDevice = 1038,
234 hipErrorPeerAccessAlreadyEnabled =
237 hipErrorPeerAccessNotEnabled =
239 hipErrorRuntimeMemory = 1052,
240 hipErrorRuntimeOther = 1053,
242 hipErrorHostMemoryAlreadyRegistered =
245 hipErrorHostMemoryNotRegistered =
247 hipErrorMapBufferObjectFailed =
254 #undef __HIP_NODISCARD 300 enum hipComputeMode {
301 hipComputeModeDefault = 0,
302 hipComputeModeExclusive = 1,
303 hipComputeModeProhibited = 2,
304 hipComputeModeExclusiveProcess = 3
311 #if defined(__HIP_PLATFORM_HCC__) && !defined(__HIP_PLATFORM_NVCC__) 313 #elif defined(__HIP_PLATFORM_NVCC__) && !defined(__HIP_PLATFORM_HCC__) 314 #include "hip/nvcc_detail/hip_runtime_api.h" 316 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__"); 331 #if defined(__cplusplus) && !defined(__HIP_DISABLE_CPP_FUNCTIONS__) 333 static inline hipError_t
hipMalloc(T** devPtr,
size_t size) {
347 unsigned int flags = hipMemAttachGlobal) {
size_t totalConstMem
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:95
Definition: hip_runtime_api.h:292
Maximum x-dimension of a block.
Definition: hip_runtime_api.h:263
unsigned hasGlobalInt64Atomics
64-bit integer atomics for global memory.
Definition: hip_runtime_api.h:53
Maximum x-dimension of a grid.
Definition: hip_runtime_api.h:266
unsigned hasSurfaceFuncs
Surface functions.
Definition: hip_runtime_api.h:70
Global memory bus width in bits.
Definition: hip_runtime_api.h:279
int minor
Definition: hip_runtime_api.h:99
unsigned hasDynamicParallelism
Dynamic parallelism.
Definition: hip_runtime_api.h:72
unsigned hasThreadFenceSystem
__threadfence_system.
Definition: hip_runtime_api.h:66
int canMapHostMemory
Check whether HIP can map host memory.
Definition: hip_runtime_api.h:115
Definition: hip_runtime_api.h:273
int regsPerBlock
Registers per block.
Definition: hip_runtime_api.h:87
Definition: hip_runtime_api.h:282
#define hipHostMallocDefault
Flags that can be used with hipHostMalloc.
Definition: hip_runtime_api.h:168
iGPU
Definition: hip_runtime_api.h:295
int isMultiGpuBoard
1 if device is on a multi-GPU board, 0 if not.
Definition: hip_runtime_api.h:114
Peak clock frequency in kilohertz.
Definition: hip_runtime_api.h:277
Definition: hip_runtime_api.h:139
int clockRate
Max clock frequency of the multiProcessors in khz.
Definition: hip_runtime_api.h:92
Maximum z-dimension of a grid.
Definition: hip_runtime_api.h:268
Minor compute capability version number.
Definition: hip_runtime_api.h:287
Definition: hip_runtime_api.h:269
int pciBusID
PCI Bus ID.
Definition: hip_runtime_api.h:111
Maximum y-dimension of a grid.
Definition: hip_runtime_api.h:267
unsigned hasSharedInt64Atomics
64-bit integer atomics for shared memory.
Definition: hip_runtime_api.h:54
Multiple GPU devices.
Definition: hip_runtime_api.h:294
int maxThreadsPerBlock
Max work items per work group or workgroup max size.
Definition: hip_runtime_api.h:89
Maximum y-dimension of a block.
Definition: hip_runtime_api.h:264
hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory.
Definition: hip_memory.cpp:372
size_t sharedMemPerBlock
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:86
unsigned hasDoubles
Double-precision floating point.
Definition: hip_runtime_api.h:57
Support cooperative launch on multiple devices.
Definition: hip_runtime_api.h:297
int maxThreadsPerMultiProcessor
Maximum resident threads per multi-processor.
Definition: hip_runtime_api.h:104
int l2CacheSize
L2 cache size.
Definition: hip_runtime_api.h:103
hipDeviceAttribute_t
Definition: hip_runtime_api.h:261
unsigned hasSyncThreadsExt
__syncthreads_count, syncthreads_and, syncthreads_or.
Definition: hip_runtime_api.h:67
Major compute capability version number.
Definition: hip_runtime_api.h:286
Maximum number of threads per block.
Definition: hip_runtime_api.h:262
int gcnArch
AMD GCN Arch Value. Eg: 803, 701.
Definition: hip_runtime_api.h:116
hipDeviceArch_t arch
Architectural feature flags. New for HIP.
Definition: hip_runtime_api.h:108
int maxGridSize[3]
Max grid dimensions (XYZ).
Definition: hip_runtime_api.h:91
int computeMode
Compute mode.
Definition: hip_runtime_api.h:105
Maximum z-dimension of a block.
Definition: hip_runtime_api.h:265
PCI Bus ID.
Definition: hip_runtime_api.h:290
unsigned hasSharedInt32Atomics
32-bit integer atomics for shared memory.
Definition: hip_runtime_api.h:48
Warp size in threads.
Definition: hip_runtime_api.h:272
int major
Definition: hip_runtime_api.h:96
unsigned hasFunnelShift
Funnel two words into one with shift&mask caps.
Definition: hip_runtime_api.h:63
Peak memory clock frequency in kilohertz.
Definition: hip_runtime_api.h:278
Definition: hip_runtime_api.h:284
hipError_t hipMallocManaged(void **devPtr, size_t size, unsigned int flags __dparm(0))
Allocates memory that will be automatically managed by the Unified Memory system. ...
int clockInstructionRate
Definition: hip_runtime_api.h:106
int cooperativeMultiDeviceLaunch
HIP device supports cooperative launch on multiple devices.
Definition: hip_runtime_api.h:119
unsigned hasGlobalInt32Atomics
32-bit integer atomics for global memory.
Definition: hip_runtime_api.h:46
Constant memory size in bytes.
Definition: hip_runtime_api.h:271
unsigned hasWarpVote
Warp vote instructions (__any, __all).
Definition: hip_runtime_api.h:60
int warpSize
Warp size.
Definition: hip_runtime_api.h:88
int concurrentKernels
Device can possibly execute multiple kernels concurrently.
Definition: hip_runtime_api.h:109
size_t totalGlobalMem
Size of global memory region (in bytes).
Definition: hip_runtime_api.h:85
hipError_t hipMalloc(void **ptr, size_t size)
Allocate memory on the default accelerator.
Definition: hip_memory.cpp:239
Compute mode that device is currently in.
Definition: hip_runtime_api.h:281
PCI Device ID.
Definition: hip_runtime_api.h:291
int maxThreadsDim[3]
Max number of threads in each dimension (XYZ) of a block.
Definition: hip_runtime_api.h:90
Number of multiprocessors on the device.
Definition: hip_runtime_api.h:280
int integrated
APU vs dGPU.
Definition: hip_runtime_api.h:117
int memoryBusWidth
Global memory bus width in bits.
Definition: hip_runtime_api.h:94
unsigned hasWarpShuffle
Warp shuffle operations. (__shfl_*).
Definition: hip_runtime_api.h:62
unsigned hasGlobalFloatAtomicExch
32-bit float atomic exch for global memory.
Definition: hip_runtime_api.h:47
unsigned hasFloatAtomicAdd
32-bit float atomic add in global and shared memory.
Definition: hip_runtime_api.h:50
Definition: hip_runtime_api.h:83
size_t maxSharedMemoryPerMultiProcessor
Maximum Shared Memory Per Multiprocessor.
Definition: hip_runtime_api.h:113
int cooperativeLaunch
HIP device supports cooperative launch.
Definition: hip_runtime_api.h:118
Support cooperative launch.
Definition: hip_runtime_api.h:296
int pciDeviceID
PCI Device ID.
Definition: hip_runtime_api.h:112
int pciDomainID
PCI Domain ID.
Definition: hip_runtime_api.h:110
char name[256]
Device name.
Definition: hip_runtime_api.h:84
unsigned hasWarpBallot
Warp ballot instructions (__ballot).
Definition: hip_runtime_api.h:61
unsigned has3dGrid
Grid and group dims are 3D (rather than 2D).
Definition: hip_runtime_api.h:71
Definition: hip_runtime_api.h:44
Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
int memoryClockRate
Max global memory clock frequency in khz.
Definition: hip_runtime_api.h:93
Definition: hip_runtime_api.h:288
int multiProcessorCount
Number of multi-processors (compute units).
Definition: hip_runtime_api.h:102
unsigned hasSharedFloatAtomicExch
32-bit float atomic exch for shared memory.
Definition: hip_runtime_api.h:49