|
HIP: Heterogenous-computing Interface for Portability
|
Go to the documentation of this file.
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
165 unsigned allocationFlags;
179 #if __cplusplus >= 201703L
180 #define __HIP_NODISCARD [[nodiscard]]
182 #define __HIP_NODISCARD
193 typedef enum __HIP_NODISCARD hipError_t {
196 hipErrorOutOfMemory = 2,
200 hipErrorNotInitialized = 3,
202 hipErrorInitializationError = 3,
203 hipErrorDeinitialized = 4,
204 hipErrorProfilerDisabled = 5,
205 hipErrorProfilerNotInitialized = 6,
206 hipErrorProfilerAlreadyStarted = 7,
207 hipErrorProfilerAlreadyStopped = 8,
208 hipErrorInvalidConfiguration = 9,
209 hipErrorInvalidSymbol = 13,
212 hipErrorInsufficientDriver = 35,
213 hipErrorMissingConfiguration = 52,
214 hipErrorPriorLaunchFailure = 53,
215 hipErrorInvalidDeviceFunction = 98,
218 hipErrorInvalidImage = 200,
220 hipErrorContextAlreadyCurrent = 202,
221 hipErrorMapFailed = 205,
224 hipErrorUnmapFailed = 206,
225 hipErrorArrayIsMapped = 207,
226 hipErrorAlreadyMapped = 208,
227 hipErrorNoBinaryForGpu = 209,
228 hipErrorAlreadyAcquired = 210,
229 hipErrorNotMapped = 211,
230 hipErrorNotMappedAsArray = 212,
231 hipErrorNotMappedAsPointer = 213,
232 hipErrorECCNotCorrectable = 214,
233 hipErrorUnsupportedLimit = 215,
234 hipErrorContextAlreadyInUse = 216,
235 hipErrorPeerAccessUnsupported = 217,
237 hipErrorInvalidGraphicsContext = 219,
238 hipErrorInvalidSource = 300,
239 hipErrorFileNotFound = 301,
240 hipErrorSharedObjectSymbolNotFound = 302,
241 hipErrorSharedObjectInitFailed = 303,
242 hipErrorOperatingSystem = 304,
243 hipErrorInvalidHandle = 400,
246 hipErrorNotFound = 500,
248 hipErrorIllegalAddress = 700,
253 hipErrorLaunchTimeOut = 702,
258 hipErrorSetOnActiveProcess = 708,
271 hipErrorUnknown = 999,
280 #undef __HIP_NODISCARD
351 enum hipComputeMode {
352 hipComputeModeDefault = 0,
353 hipComputeModeExclusive = 1,
354 hipComputeModeProhibited = 2,
355 hipComputeModeExclusiveProcess = 3
362 #if defined(__HIP_PLATFORM_HCC__) && !defined(__HIP_PLATFORM_NVCC__)
364 #elif defined(__HIP_PLATFORM_NVCC__) && !defined(__HIP_PLATFORM_HCC__)
365 #include "hip/nvcc_detail/hip_runtime_api.h"
367 #error("Must define exactly one of __HIP_PLATFORM_HCC__ or __HIP_PLATFORM_NVCC__");
382 #if defined(__cplusplus) && !defined(__HIP_DISABLE_CPP_FUNCTIONS__)
384 static inline hipError_t
hipMalloc(T** devPtr,
size_t size) {
398 unsigned int flags = hipMemAttachGlobal) {
Maximum pitch in bytes allowed by memory copies.
Definition: hip_runtime_api.h:334
int regsPerBlock
Registers per block.
Definition: hip_runtime_api.h:87
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.
Global memory bus width in bits.
Definition: hip_runtime_api.h:305
hipErrorInvalidMemcpyDirection
Invalid memory copy direction.
Definition: hip_runtime_api.h:211
unsigned hasGlobalInt64Atomics
64-bit integer atomics for global memory.
Definition: hip_runtime_api.h:53
int minor
Definition: hip_runtime_api.h:99
Maximum x-dimension of a block.
Definition: hip_runtime_api.h:289
hipErrorInvalidDevicePointer
Invalid Device Pointer.
Definition: hip_runtime_api.h:210
hipErrorMapBufferObjectFailed
Produced when the IPC memory attach failed from ROCr.
Definition: hip_runtime_api.h:223
size_t texturePitchAlignment
Pitch alignment requirement for texture references bound to pitched memory.
Definition: hip_runtime_api.h:127
Maximum x-dimension of a grid.
Definition: hip_runtime_api.h:292
unsigned hasThreadFenceSystem
__threadfence_system.
Definition: hip_runtime_api.h:66
int maxTexture3D[3]
Maximum dimensions (width, height, depth) of 3D images, in image elements.
Definition: hip_runtime_api.h:122
int cooperativeMultiDeviceUnmatchedBlockDim
Definition: hip_runtime_api.h:135
hipErrorHostMemoryNotRegistered
Produced when trying to unlock a non-page-locked memory.
Definition: hip_runtime_api.h:262
hipErrorRuntimeOther
Definition: hip_runtime_api.h:275
Peak clock frequency in kilohertz.
Definition: hip_runtime_api.h:303
Maximum z-dimension of a grid.
Definition: hip_runtime_api.h:294
Definition: hip_runtime_api.h:148
Definition: hip_runtime_api.h:299
hipErrorNoDevice
Call to hipGetDeviceCount returned 0 devices.
Definition: hip_runtime_api.h:216
int isLargeBar
1: if it is a large PCI bar device, else 0
Definition: hip_runtime_api.h:139
Minor compute capability version number.
Definition: hip_runtime_api.h:313
int l2CacheSize
L2 cache size.
Definition: hip_runtime_api.h:103
size_t textureAlignment
Alignment requirement for textures.
Definition: hip_runtime_api.h:126
hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory.
Definition: hip_memory.cpp:762
Run time limit for kernels executed on the device.
Definition: hip_runtime_api.h:337
Definition: hip_runtime_api.h:308
Definition: hip_runtime_api.h:343
Maximum dimension width of 3D images in image elements.
Definition: hip_runtime_api.h:327
unsigned hasSurfaceFuncs
Surface functions.
Definition: hip_runtime_api.h:70
iGPU
Definition: hip_runtime_api.h:321
int isMultiGpuBoard
1 if device is on a multi-GPU board, 0 if not.
Definition: hip_runtime_api.h:114
Maximum y-dimension of a grid.
Definition: hip_runtime_api.h:293
Memory is physically located on host.
Definition: hip_runtime_api.h:147
hipErrorInvalidContext
Produced when input context is invalid.
Definition: hip_runtime_api.h:219
unsigned hasSharedInt64Atomics
64-bit integer atomics for shared memory.
Definition: hip_runtime_api.h:54
int computeMode
Compute mode.
Definition: hip_runtime_api.h:105
Multiple GPU devices.
Definition: hip_runtime_api.h:320
int clockRate
Max clock frequency of the multiProcessors in khz.
Definition: hip_runtime_api.h:92
unsigned int * hdpRegFlushCntl
Addres of HDP_REG_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:124
hipErrorPeerAccessNotEnabled
Peer access was never enabled from the current device.
Definition: hip_runtime_api.h:256
unsigned hasDynamicParallelism
Dynamic parallelism.
Definition: hip_runtime_api.h:72
int canMapHostMemory
Check whether HIP can map host memory.
Definition: hip_runtime_api.h:115
size_t sharedMemPerBlock
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:86
Support cooperative launch on multiple devices.
Definition: hip_runtime_api.h:323
int maxThreadsPerMultiProcessor
Maximum resident threads per multi-processor.
Definition: hip_runtime_api.h:104
int major
Definition: hip_runtime_api.h:96
Definition: hip_runtime_api.h:295
hipSuccess
Successful completion.
Definition: hip_runtime_api.h:194
Maximum number of threads per block.
Definition: hip_runtime_api.h:288
int gcnArch
AMD GCN Arch Value. Eg: 803, 701.
Definition: hip_runtime_api.h:116
Definition: hip_runtime_api.h:44
int kernelExecTimeoutEnabled
Run time limit for kernels executed on the device.
Definition: hip_runtime_api.h:128
int maxTexture1D
Maximum number of elements in 1D images.
Definition: hip_runtime_api.h:120
Maximum z-dimension of a block.
Definition: hip_runtime_api.h:291
unsigned hasDoubles
Double-precision floating point.
Definition: hip_runtime_api.h:57
hipErrorInvalidKernelFile
In CUDA DRV, it is CUDA_ERROR_INVALID_PTX.
Definition: hip_runtime_api.h:236
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:290
Definition: hip_runtime_api.h:83
Definition: hip_runtime_api.h:345
Maximum dimension height of 2D images in image elements.
Definition: hip_runtime_api.h:326
unsigned hasSharedInt32Atomics
32-bit integer atomics for shared memory.
Definition: hip_runtime_api.h:48
hipErrorInvalidValue
Definition: hip_runtime_api.h:195
size_t memPitch
Maximum pitch in bytes allowed by memory copies.
Definition: hip_runtime_api.h:125
int pciBusID
PCI Bus ID.
Definition: hip_runtime_api.h:111
Major compute capability version number.
Definition: hip_runtime_api.h:312
Maximum dimensions depth of 3D images in image elements.
Definition: hip_runtime_api.h:329
hipErrorRuntimeMemory
Definition: hip_runtime_api.h:273
Definition: hip_runtime_api.h:310
hipDeviceArch_t arch
Architectural feature flags. New for HIP.
Definition: hip_runtime_api.h:108
Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
Address of the HDP_REG_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:332
PCI Bus ID.
Definition: hip_runtime_api.h:316
int tccDriver
1:If device is Tesla device using TCC driver, else 0
Definition: hip_runtime_api.h:130
hipError_t hipMalloc(void **ptr, size_t size)
Allocate memory on the default accelerator.
Definition: hip_memory.cpp:695
Not used currently.
Definition: hip_runtime_api.h:152
Pitch alignment requirement for 2D texture references bound to pitched memory;.
Definition: hip_runtime_api.h:336
Warp size in threads.
Definition: hip_runtime_api.h:298
unsigned hasGlobalInt32Atomics
32-bit integer atomics for global memory.
Definition: hip_runtime_api.h:46
unsigned hasSyncThreadsExt
__syncthreads_count, syncthreads_and, syncthreads_or.
Definition: hip_runtime_api.h:67
Definition: hip_runtime_api.h:150
hipErrorInvalidDevice
DeviceID must be in range 0...#compute-devices.
Definition: hip_runtime_api.h:217
unsigned hasFunnelShift
Funnel two words into one with shift&mask caps.
Definition: hip_runtime_api.h:63
Maximum dimensions height of 3D images in image elements.
Definition: hip_runtime_api.h:328
struct hipDeviceProp_t hipDeviceProp_t
Peak memory clock frequency in kilohertz.
Definition: hip_runtime_api.h:304
hipErrorNotReady
Definition: hip_runtime_api.h:247
int maxGridSize[3]
Max grid dimensions (XYZ).
Definition: hip_runtime_api.h:91
Compute mode that device is currently in.
Definition: hip_runtime_api.h:307
struct hipPointerAttribute_t hipPointerAttribute_t
PCI Device ID.
Definition: hip_runtime_api.h:317
size_t maxSharedMemoryPerMultiProcessor
Maximum Shared Memory Per Multiprocessor.
Definition: hip_runtime_api.h:113
int clockInstructionRate
Definition: hip_runtime_api.h:106
unsigned int * hdpMemFlushCntl
Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:123
Definition: hip_runtime_api.h:159
Constant memory size in bytes.
Definition: hip_runtime_api.h:297
unsigned hasWarpShuffle
Warp shuffle operations. (__shfl_*).
Definition: hip_runtime_api.h:62
int memoryBusWidth
Global memory bus width in bits.
Definition: hip_runtime_api.h:94
unsigned hasWarpVote
Warp vote instructions (__any, __all).
Definition: hip_runtime_api.h:60
char name[256]
Device name.
Definition: hip_runtime_api.h:84
unsigned hasGlobalFloatAtomicExch
32-bit float atomic exch for global memory.
Definition: hip_runtime_api.h:47
int concurrentKernels
Device can possibly execute multiple kernels concurrently.
Definition: hip_runtime_api.h:109
unsigned hasWarpBallot
Warp ballot instructions (__ballot).
Definition: hip_runtime_api.h:61
size_t totalGlobalMem
Size of global memory region (in bytes).
Definition: hip_runtime_api.h:85
Alignment requirement for textures.
Definition: hip_runtime_api.h:335
#define hipHostMallocDefault
Flags that can be used with hipHostMalloc.
Definition: hip_runtime_api.h:168
Device can map host memory into device address space.
Definition: hip_runtime_api.h:338
int maxThreadsDim[3]
Max number of threads in each dimension (XYZ) of a block.
Definition: hip_runtime_api.h:90
int cooperativeMultiDeviceLaunch
HIP device supports cooperative launch on multiple devices.
Definition: hip_runtime_api.h:119
unsigned has3dGrid
Grid and group dims are 3D (rather than 2D).
Definition: hip_runtime_api.h:71
Maximum number of elements in 1D images.
Definition: hip_runtime_api.h:324
Support cooperative launch.
Definition: hip_runtime_api.h:322
Number of multiprocessors on the device.
Definition: hip_runtime_api.h:306
int pciDeviceID
PCI Device ID.
Definition: hip_runtime_api.h:112
int memoryClockRate
Max global memory clock frequency in khz.
Definition: hip_runtime_api.h:93
hipErrorCooperativeLaunchTooLarge
Definition: hip_runtime_api.h:266
int warpSize
Warp size.
Definition: hip_runtime_api.h:88
hipErrorAssert
Produced when the kernel calls assert.
Definition: hip_runtime_api.h:259
int cooperativeMultiDeviceUnmatchedFunc
Definition: hip_runtime_api.h:131
int cooperativeMultiDeviceUnmatchedGridDim
Definition: hip_runtime_api.h:133
unsigned hasFloatAtomicAdd
32-bit float atomic add in global and shared memory.
Definition: hip_runtime_api.h:50
int cooperativeLaunch
HIP device supports cooperative launch.
Definition: hip_runtime_api.h:118
unsigned hasSharedFloatAtomicExch
32-bit float atomic exch for shared memory.
Definition: hip_runtime_api.h:49
Definition: hip_runtime_api.h:347
int multiProcessorCount
Number of multi-processors (compute units).
Definition: hip_runtime_api.h:102
int integrated
APU vs dGPU.
Definition: hip_runtime_api.h:117
int ECCEnabled
Device has ECC support enabled.
Definition: hip_runtime_api.h:129
size_t totalConstMem
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:95
int maxTexture2D[2]
Maximum dimensions (width, height) of 2D images, in image elements.
Definition: hip_runtime_api.h:121
hipErrorHostMemoryAlreadyRegistered
Produced when trying to lock a page-locked memory.
Definition: hip_runtime_api.h:260
hipDeviceAttribute_t
Definition: hip_runtime_api.h:287
hipErrorMemoryAllocation
Memory allocation error.
Definition: hip_runtime_api.h:199
hipErrorLaunchFailure
An exception occurred on the device while executing a kernel.
Definition: hip_runtime_api.h:264
Definition: hip_runtime_api.h:314
int cooperativeMultiDeviceUnmatchedSharedMem
Definition: hip_runtime_api.h:137
hipErrorNotSupported
Produced when the hip API is not supported/implemented.
Definition: hip_runtime_api.h:270
hipErrorLaunchOutOfResources
Out of resources error.
Definition: hip_runtime_api.h:252
hipErrorInvalidResourceHandle
Resource handle (hipEvent_t or hipStream_t) invalid.
Definition: hip_runtime_api.h:245
hipMemoryType
Definition: hip_runtime_api.h:146
Maximum dimension width of 2D images in image elements.
Definition: hip_runtime_api.h:325
int pciDomainID
PCI Domain ID.
Definition: hip_runtime_api.h:110
Definition: hip_runtime_api.h:341
Address of the HDP_MEM_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:331
Device has ECC support enabled.
Definition: hip_runtime_api.h:339
Definition: hip_runtime_api.h:318
hipErrorPeerAccessAlreadyEnabled
Peer access was already enabled from the current device.
Definition: hip_runtime_api.h:254