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_version.h>
36 #include <hip/hip_common.h>
40 HIP_ERROR_INVALID_VALUE,
41 HIP_ERROR_NOT_INITIALIZED,
42 HIP_ERROR_LAUNCH_OUT_OF_RESOURCES
175 unsigned allocationFlags;
189 #if __cplusplus >= 201703L
190 #define __HIP_NODISCARD [[nodiscard]]
192 #define __HIP_NODISCARD
203 typedef enum __HIP_NODISCARD hipError_t {
206 hipErrorOutOfMemory = 2,
210 hipErrorNotInitialized = 3,
212 hipErrorInitializationError = 3,
213 hipErrorDeinitialized = 4,
214 hipErrorProfilerDisabled = 5,
215 hipErrorProfilerNotInitialized = 6,
216 hipErrorProfilerAlreadyStarted = 7,
217 hipErrorProfilerAlreadyStopped = 8,
218 hipErrorInvalidConfiguration = 9,
219 hipErrorInvalidPitchValue = 12,
220 hipErrorInvalidSymbol = 13,
223 hipErrorInsufficientDriver = 35,
224 hipErrorMissingConfiguration = 52,
225 hipErrorPriorLaunchFailure = 53,
226 hipErrorInvalidDeviceFunction = 98,
229 hipErrorInvalidImage = 200,
231 hipErrorContextAlreadyCurrent = 202,
232 hipErrorMapFailed = 205,
235 hipErrorUnmapFailed = 206,
236 hipErrorArrayIsMapped = 207,
237 hipErrorAlreadyMapped = 208,
238 hipErrorNoBinaryForGpu = 209,
239 hipErrorAlreadyAcquired = 210,
240 hipErrorNotMapped = 211,
241 hipErrorNotMappedAsArray = 212,
242 hipErrorNotMappedAsPointer = 213,
243 hipErrorECCNotCorrectable = 214,
244 hipErrorUnsupportedLimit = 215,
245 hipErrorContextAlreadyInUse = 216,
246 hipErrorPeerAccessUnsupported = 217,
248 hipErrorInvalidGraphicsContext = 219,
249 hipErrorInvalidSource = 300,
250 hipErrorFileNotFound = 301,
251 hipErrorSharedObjectSymbolNotFound = 302,
252 hipErrorSharedObjectInitFailed = 303,
253 hipErrorOperatingSystem = 304,
254 hipErrorInvalidHandle = 400,
257 hipErrorNotFound = 500,
259 hipErrorIllegalAddress = 700,
264 hipErrorLaunchTimeOut = 702,
269 hipErrorSetOnActiveProcess = 708,
270 hipErrorContextIsDestroyed = 709,
302 hipErrorUnknown = 999,
314 #undef __HIP_NODISCARD
398 enum hipComputeMode {
399 hipComputeModeDefault = 0,
400 hipComputeModeExclusive = 1,
401 hipComputeModeProhibited = 2,
402 hipComputeModeExclusiveProcess = 3
409 #if (defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && !(defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
411 #elif !(defined(__HIP_PLATFORM_HCC__) || defined(__HIP_PLATFORM_AMD__)) && (defined(__HIP_PLATFORM_NVCC__) || defined(__HIP_PLATFORM_NVIDIA__))
412 #include "hip/nvidia_detail/hip_runtime_api.h"
414 #error("Must define exactly one of __HIP_PLATFORM_AMD__ or __HIP_PLATFORM_NVIDIA__");
429 #if defined(__cplusplus) && !defined(__HIP_DISABLE_CPP_FUNCTIONS__)
431 static inline hipError_t
hipMalloc(T** devPtr,
size_t size) {
@ hipDeviceAttributeMaxPitch
Maximum pitch in bytes allowed by memory copies.
Definition: hip_runtime_api.h:368
hipErrorStreamCaptureImplicit
Definition: hip_runtime_api.h:296
int regsPerBlock
Registers per block.
Definition: hip_runtime_api.h:88
@ hipDeviceAttributeManagedMemory
Device supports allocating managed memory on this system.
Definition: hip_runtime_api.h:384
@ hipDeviceAttributeMemoryBusWidth
Global memory bus width in bits.
Definition: hip_runtime_api.h:339
@ hipDeviceAttributePageableMemoryAccessUsesHostPageTables
Definition: hip_runtime_api.h:391
hipErrorInvalidMemcpyDirection
Invalid memory copy direction.
Definition: hip_runtime_api.h:222
unsigned hasGlobalInt64Atomics
64-bit integer atomics for global memory.
Definition: hip_runtime_api.h:54
int minor
Definition: hip_runtime_api.h:100
@ hipDeviceAttributeMaxBlockDimX
Maximum x-dimension of a block.
Definition: hip_runtime_api.h:323
hipErrorInvalidDevicePointer
Invalid Device Pointer.
Definition: hip_runtime_api.h:221
hipErrorMapBufferObjectFailed
Produced when the IPC memory attach failed from ROCr.
Definition: hip_runtime_api.h:234
size_t texturePitchAlignment
Pitch alignment requirement for texture references bound to pitched memory.
Definition: hip_runtime_api.h:130
@ hipDeviceAttributeMaxGridDimX
Maximum x-dimension of a grid.
Definition: hip_runtime_api.h:326
unsigned hasThreadFenceSystem
__threadfence_system.
Definition: hip_runtime_api.h:67
int pageableMemoryAccessUsesHostPageTables
Device accesses pageable memory via the host's page tables.
Definition: hip_runtime_api.h:149
Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
int maxTexture3D[3]
Maximum dimensions (width, height, depth) of 3D images, in image elements.
Definition: hip_runtime_api.h:125
int cooperativeMultiDeviceUnmatchedBlockDim
Definition: hip_runtime_api.h:138
hipErrorHostMemoryNotRegistered
Produced when trying to unlock a non-page-locked memory.
Definition: hip_runtime_api.h:274
hipErrorRuntimeOther
Definition: hip_runtime_api.h:309
@ hipDeviceAttributeClockRate
Peak clock frequency in kilohertz.
Definition: hip_runtime_api.h:337
int asicRevision
Revision of the GPU in this device.
Definition: hip_runtime_api.h:143
@ hipDeviceAttributeDirectManagedMemAccessFromHost
Definition: hip_runtime_api.h:385
@ hipDeviceAttributeMaxGridDimZ
Maximum z-dimension of a grid.
Definition: hip_runtime_api.h:328
@ hipMemoryTypeDevice
Definition: hip_runtime_api.h:158
@ hipDeviceAttributeMaxRegistersPerBlock
Definition: hip_runtime_api.h:333
hipErrorNoDevice
Call to hipGetDeviceCount returned 0 devices.
Definition: hip_runtime_api.h:227
int isLargeBar
1: if it is a large PCI bar device, else 0
Definition: hip_runtime_api.h:142
@ hipDeviceAttributeComputeCapabilityMinor
Minor compute capability version number.
Definition: hip_runtime_api.h:347
@ hipDeviceAttributeAsicRevision
Revision of the GPU in this device.
Definition: hip_runtime_api.h:383
int concurrentManagedAccess
Device can coherently access managed memory concurrently with the CPU.
Definition: hip_runtime_api.h:146
int l2CacheSize
L2 cache size.
Definition: hip_runtime_api.h:104
size_t textureAlignment
Alignment requirement for textures.
Definition: hip_runtime_api.h:129
hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory.
@ hipDeviceAttributeKernelExecTimeout
Run time limit for kernels executed on the device.
Definition: hip_runtime_api.h:371
@ hipDeviceAttributeL2CacheSize
Definition: hip_runtime_api.h:342
@ hipDeviceAttributeCooperativeMultiDeviceUnmatchedGridDim
Definition: hip_runtime_api.h:377
@ hipDeviceAttributeMaxTexture3DWidth
Maximum dimension width of 3D images in image elements.
Definition: hip_runtime_api.h:361
unsigned hasSurfaceFuncs
Surface functions.
Definition: hip_runtime_api.h:71
@ hipDeviceAttributeIntegrated
iGPU
Definition: hip_runtime_api.h:355
int isMultiGpuBoard
1 if device is on a multi-GPU board, 0 if not.
Definition: hip_runtime_api.h:115
@ hipDeviceAttributeMaxGridDimY
Maximum y-dimension of a grid.
Definition: hip_runtime_api.h:327
@ hipMemoryTypeHost
Memory is physically located on host.
Definition: hip_runtime_api.h:157
hipErrorInvalidContext
Produced when input context is invalid.
Definition: hip_runtime_api.h:230
unsigned hasSharedInt64Atomics
64-bit integer atomics for shared memory.
Definition: hip_runtime_api.h:55
int computeMode
Compute mode.
Definition: hip_runtime_api.h:106
@ hipDeviceAttributeIsMultiGpuBoard
Multiple GPU devices.
Definition: hip_runtime_api.h:354
int clockRate
Max clock frequency of the multiProcessors in khz.
Definition: hip_runtime_api.h:93
unsigned int * hdpRegFlushCntl
Addres of HDP_REG_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:127
hipErrorPeerAccessNotEnabled
Peer access was never enabled from the current device.
Definition: hip_runtime_api.h:267
int maxTexture1DLinear
Maximum size for 1D textures bound to linear memory.
Definition: hip_runtime_api.h:122
unsigned hasDynamicParallelism
Dynamic parallelism.
Definition: hip_runtime_api.h:73
int canMapHostMemory
Check whether HIP can map host memory.
Definition: hip_runtime_api.h:116
size_t sharedMemPerBlock
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:87
@ hipDeviceAttributeConcurrentManagedAccess
Definition: hip_runtime_api.h:387
@ hipDeviceAttributeCooperativeMultiDeviceLaunch
Support cooperative launch on multiple devices.
Definition: hip_runtime_api.h:357
int maxThreadsPerMultiProcessor
Maximum resident threads per multi-processor.
Definition: hip_runtime_api.h:105
int major
Definition: hip_runtime_api.h:97
@ hipDeviceAttributeMaxSharedMemoryPerBlock
Definition: hip_runtime_api.h:329
hipSuccess
Successful completion.
Definition: hip_runtime_api.h:204
hipErrorStreamCaptureInvalidated
Definition: hip_runtime_api.h:285
@ hipDeviceAttributeMaxThreadsPerBlock
Maximum number of threads per block.
Definition: hip_runtime_api.h:322
int gcnArch
DEPRECATED: use gcnArchName instead.
Definition: hip_runtime_api.h:117
Definition: hip_runtime_api.h:45
int kernelExecTimeoutEnabled
Run time limit for kernels executed on the device.
Definition: hip_runtime_api.h:131
int maxTexture1D
Maximum number of elements in 1D images.
Definition: hip_runtime_api.h:123
@ hipDeviceAttributeMaxBlockDimZ
Maximum z-dimension of a block.
Definition: hip_runtime_api.h:325
unsigned hasDoubles
Double-precision floating point.
Definition: hip_runtime_api.h:58
hipErrorInvalidKernelFile
In CUDA DRV, it is CUDA_ERROR_INVALID_PTX.
Definition: hip_runtime_api.h:247
int maxThreadsPerBlock
Max work items per work group or workgroup max size.
Definition: hip_runtime_api.h:90
@ hipDeviceAttributeMaxBlockDimY
Maximum y-dimension of a block.
Definition: hip_runtime_api.h:324
Definition: hip_runtime_api.h:84
@ hipDeviceAttributeCooperativeMultiDeviceUnmatchedBlockDim
Definition: hip_runtime_api.h:379
hipErrorStreamCaptureUnjoined
Definition: hip_runtime_api.h:290
@ hipDeviceAttributeMaxTexture2DHeight
Maximum dimension height of 2D images in image elements.
Definition: hip_runtime_api.h:360
unsigned hasSharedInt32Atomics
32-bit integer atomics for shared memory.
Definition: hip_runtime_api.h:49
hipErrorInvalidValue
Definition: hip_runtime_api.h:205
size_t memPitch
Maximum pitch in bytes allowed by memory copies.
Definition: hip_runtime_api.h:128
int pciBusID
PCI Bus ID.
Definition: hip_runtime_api.h:112
@ hipDeviceAttributeComputeCapabilityMajor
Major compute capability version number.
Definition: hip_runtime_api.h:346
@ hipDeviceAttributeMaxTexture3DDepth
Maximum dimensions depth of 3D images in image elements.
Definition: hip_runtime_api.h:363
hipErrorRuntimeMemory
Definition: hip_runtime_api.h:307
@ hipDeviceAttributeMaxThreadsPerMultiProcessor
Definition: hip_runtime_api.h:344
hipDeviceArch_t arch
Architectural feature flags. New for HIP.
Definition: hip_runtime_api.h:109
@ hipDeviceAttributeHdpRegFlushCntl
Address of the HDP_REG_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:366
hipErrorStreamCaptureUnmatched
The capture was not initiated in this stream.
Definition: hip_runtime_api.h:289
@ hipDeviceAttributePciBusId
PCI Bus ID.
Definition: hip_runtime_api.h:350
int tccDriver
1:If device is Tesla device using TCC driver, else 0
Definition: hip_runtime_api.h:133
hipError_t hipMalloc(void **ptr, size_t size)
Allocate memory on the default accelerator.
@ hipMemoryTypeUnified
Not used currently.
Definition: hip_runtime_api.h:162
@ hipDeviceAttributeTexturePitchAlignment
Pitch alignment requirement for 2D texture references bound to pitched memory;.
Definition: hip_runtime_api.h:370
@ hipDeviceAttributeWarpSize
Warp size in threads.
Definition: hip_runtime_api.h:332
unsigned hasGlobalInt32Atomics
32-bit integer atomics for global memory.
Definition: hip_runtime_api.h:47
unsigned hasSyncThreadsExt
__syncthreads_count, syncthreads_and, syncthreads_or.
Definition: hip_runtime_api.h:68
@ hipMemoryTypeArray
Definition: hip_runtime_api.h:160
hipErrorInvalidDevice
DeviceID must be in range 0...#compute-devices.
Definition: hip_runtime_api.h:228
unsigned hasFunnelShift
Funnel two words into one with shift&mask caps.
Definition: hip_runtime_api.h:64
@ hipDeviceAttributeMaxTexture3DHeight
Maximum dimensions height of 3D images in image elements.
Definition: hip_runtime_api.h:362
@ hipDeviceAttributeMemoryClockRate
Peak memory clock frequency in kilohertz.
Definition: hip_runtime_api.h:338
hipErrorNotReady
Definition: hip_runtime_api.h:258
struct hipPointerAttribute_t hipPointerAttribute_t
int maxGridSize[3]
Max grid dimensions (XYZ).
Definition: hip_runtime_api.h:92
@ hipDeviceAttributeComputeMode
Compute mode that device is currently in.
Definition: hip_runtime_api.h:341
hipErrorStreamCaptureIsolation
Definition: hip_runtime_api.h:292
@ hipDeviceAttributePciDeviceId
PCI Device ID.
Definition: hip_runtime_api.h:351
size_t maxSharedMemoryPerMultiProcessor
Maximum Shared Memory Per Multiprocessor.
Definition: hip_runtime_api.h:114
int clockInstructionRate
Definition: hip_runtime_api.h:107
unsigned int * hdpMemFlushCntl
Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:126
hipErrorStreamCaptureMerge
Definition: hip_runtime_api.h:287
Definition: hip_runtime_api.h:169
@ hipDeviceAttributeTotalConstantMemory
Constant memory size in bytes.
Definition: hip_runtime_api.h:331
unsigned hasWarpShuffle
Warp shuffle operations. (__shfl_*).
Definition: hip_runtime_api.h:63
int memoryBusWidth
Global memory bus width in bits.
Definition: hip_runtime_api.h:95
unsigned hasWarpVote
Warp vote instructions (__any, __all).
Definition: hip_runtime_api.h:61
char name[256]
Device name.
Definition: hip_runtime_api.h:85
unsigned hasGlobalFloatAtomicExch
32-bit float atomic exch for global memory.
Definition: hip_runtime_api.h:48
hipErrorStreamCaptureUnsupported
Definition: hip_runtime_api.h:283
int concurrentKernels
Device can possibly execute multiple kernels concurrently.
Definition: hip_runtime_api.h:110
unsigned hasWarpBallot
Warp ballot instructions (__ballot).
Definition: hip_runtime_api.h:62
size_t totalGlobalMem
Size of global memory region (in bytes).
Definition: hip_runtime_api.h:86
@ hipDeviceAttributeTextureAlignment
Alignment requirement for textures.
Definition: hip_runtime_api.h:369
int directManagedMemAccessFromHost
Host can directly access managed memory on the device without migration.
Definition: hip_runtime_api.h:145
#define hipHostMallocDefault
Flags that can be used with hipHostMalloc.
Definition: hip_runtime_api.h:156
char gcnArchName[256]
AMD GCN Arch Name.
Definition: hip_runtime_api.h:118
@ hipDeviceAttributeCanMapHostMemory
Device can map host memory into device address space.
Definition: hip_runtime_api.h:372
int maxThreadsDim[3]
Max number of threads in each dimension (XYZ) of a block.
Definition: hip_runtime_api.h:91
int cooperativeMultiDeviceLaunch
HIP device supports cooperative launch on multiple devices.
Definition: hip_runtime_api.h:121
unsigned has3dGrid
Grid and group dims are 3D (rather than 2D).
Definition: hip_runtime_api.h:72
@ hipDeviceAttributeMaxTexture1DWidth
Maximum number of elements in 1D images.
Definition: hip_runtime_api.h:358
@ hipDeviceAttributeCooperativeLaunch
Support cooperative launch.
Definition: hip_runtime_api.h:356
@ hipDeviceAttributeMultiprocessorCount
Number of multiprocessors on the device.
Definition: hip_runtime_api.h:340
int pciDeviceID
PCI Device ID.
Definition: hip_runtime_api.h:113
int memoryClockRate
Max global memory clock frequency in khz.
Definition: hip_runtime_api.h:94
hipErrorCooperativeLaunchTooLarge
Definition: hip_runtime_api.h:278
int pageableMemoryAccess
Definition: hip_runtime_api.h:147
int warpSize
Warp size.
Definition: hip_runtime_api.h:89
hipError_t hipMallocManaged(void **dev_ptr, size_t size, unsigned int flags __dparm(hipMemAttachGlobal))
Allocates memory that will be automatically managed by AMD HMM.
hipErrorAssert
Produced when the kernel calls assert.
Definition: hip_runtime_api.h:271
hipErrorCapturedEvent
Definition: hip_runtime_api.h:299
int cooperativeMultiDeviceUnmatchedFunc
Definition: hip_runtime_api.h:134
int cooperativeMultiDeviceUnmatchedGridDim
Definition: hip_runtime_api.h:136
hipErrorStreamCaptureWrongThread
Definition: hip_runtime_api.h:301
unsigned hasFloatAtomicAdd
32-bit float atomic add in global and shared memory.
Definition: hip_runtime_api.h:51
int cooperativeLaunch
HIP device supports cooperative launch.
Definition: hip_runtime_api.h:120
unsigned hasSharedFloatAtomicExch
32-bit float atomic exch for shared memory.
Definition: hip_runtime_api.h:50
@ hipDeviceAttributeCooperativeMultiDeviceUnmatchedSharedMem
Definition: hip_runtime_api.h:381
int multiProcessorCount
Number of multi-processors (compute units).
Definition: hip_runtime_api.h:103
int integrated
APU vs dGPU.
Definition: hip_runtime_api.h:119
int ECCEnabled
Device has ECC support enabled.
Definition: hip_runtime_api.h:132
@ hipDeviceAttributeCanUseStreamWaitValue
Definition: hip_runtime_api.h:393
size_t totalConstMem
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:96
int maxTexture2D[2]
Maximum dimensions (width, height) of 2D images, in image elements.
Definition: hip_runtime_api.h:124
#define hipMemAttachGlobal
Memory can be accessed by any stream on any device.
Definition: hip_runtime_api.h:172
hipErrorHostMemoryAlreadyRegistered
Produced when trying to lock a page-locked memory.
Definition: hip_runtime_api.h:272
hipDeviceAttribute_t
Definition: hip_runtime_api.h:321
hipErrorMemoryAllocation
Memory allocation error.
Definition: hip_runtime_api.h:209
hipErrorLaunchFailure
An exception occurred on the device while executing a kernel.
Definition: hip_runtime_api.h:276
@ hipDeviceAttributeConcurrentKernels
Definition: hip_runtime_api.h:348
int cooperativeMultiDeviceUnmatchedSharedMem
Definition: hip_runtime_api.h:140
hipErrorNotSupported
Produced when the hip API is not supported/implemented.
Definition: hip_runtime_api.h:282
hipErrorLaunchOutOfResources
Out of resources error.
Definition: hip_runtime_api.h:263
hipErrorInvalidResourceHandle
Resource handle (hipEvent_t or hipStream_t) invalid.
Definition: hip_runtime_api.h:256
@ hipDeviceAttributePageableMemoryAccess
Definition: hip_runtime_api.h:389
hipMemoryType
Definition: hip_runtime_api.h:156
@ hipDeviceAttributeMaxTexture2DWidth
Maximum dimension width of 2D images in image elements.
Definition: hip_runtime_api.h:359
int pciDomainID
PCI Domain ID.
Definition: hip_runtime_api.h:111
@ hipDeviceAttributeCooperativeMultiDeviceUnmatchedFunc
Definition: hip_runtime_api.h:375
int managedMemory
Device supports allocating managed memory on this system.
Definition: hip_runtime_api.h:144
@ hipDeviceAttributeHdpMemFlushCntl
Address of the HDP_MEM_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:365
@ hipDeviceAttributeEccEnabled
Device has ECC support enabled.
Definition: hip_runtime_api.h:373
struct hipDeviceProp_t hipDeviceProp_t
@ hipDeviceAttributeMaxSharedMemoryPerMultiprocessor
Definition: hip_runtime_api.h:352
hipErrorPeerAccessAlreadyEnabled
Peer access was already enabled from the current device.
Definition: hip_runtime_api.h:265