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
47 unsigned hasGlobalInt32Atomics : 1;
48 unsigned hasGlobalFloatAtomicExch : 1;
49 unsigned hasSharedInt32Atomics : 1;
50 unsigned hasSharedFloatAtomicExch : 1;
51 unsigned hasFloatAtomicAdd : 1;
54 unsigned hasGlobalInt64Atomics : 1;
55 unsigned hasSharedInt64Atomics : 1;
58 unsigned hasDoubles : 1;
61 unsigned hasWarpVote : 1;
62 unsigned hasWarpBallot : 1;
63 unsigned hasWarpShuffle : 1;
64 unsigned hasFunnelShift : 1;
67 unsigned hasThreadFenceSystem : 1;
68 unsigned hasSyncThreadsExt : 1;
71 unsigned hasSurfaceFuncs : 1;
72 unsigned has3dGrid : 1;
73 unsigned hasDynamicParallelism : 1;
101 int multiProcessorCount;
118 char gcnArchName[256];
135 int cooperativeMultiDeviceUnmatchedGridDim;
137 int cooperativeMultiDeviceUnmatchedBlockDim;
139 int cooperativeMultiDeviceUnmatchedSharedMem;
148 int pageableMemoryAccessUsesHostPageTables;
156 typedef enum hipMemoryType {
170 enum hipMemoryType memoryType;
175 unsigned allocationFlags;
189 #if __cplusplus >= 201703L 190 #define __HIP_NODISCARD [[nodiscard]] 192 #define __HIP_NODISCARD 203 typedef enum __HIP_NODISCARD hipError_t {
205 hipErrorInvalidValue = 1,
206 hipErrorOutOfMemory = 2,
209 hipErrorMemoryAllocation = 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,
221 hipErrorInvalidDevicePointer = 17,
222 hipErrorInvalidMemcpyDirection = 21,
223 hipErrorInsufficientDriver = 35,
224 hipErrorMissingConfiguration = 52,
225 hipErrorPriorLaunchFailure = 53,
226 hipErrorInvalidDeviceFunction = 98,
227 hipErrorNoDevice = 100,
228 hipErrorInvalidDevice = 101,
229 hipErrorInvalidImage = 200,
230 hipErrorInvalidContext = 201,
231 hipErrorContextAlreadyCurrent = 202,
232 hipErrorMapFailed = 205,
234 hipErrorMapBufferObjectFailed = 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,
247 hipErrorInvalidKernelFile = 218,
248 hipErrorInvalidGraphicsContext = 219,
249 hipErrorInvalidSource = 300,
250 hipErrorFileNotFound = 301,
251 hipErrorSharedObjectSymbolNotFound = 302,
252 hipErrorSharedObjectInitFailed = 303,
253 hipErrorOperatingSystem = 304,
254 hipErrorInvalidHandle = 400,
256 hipErrorInvalidResourceHandle = 400,
257 hipErrorNotFound = 500,
258 hipErrorNotReady = 600,
259 hipErrorIllegalAddress = 700,
263 hipErrorLaunchOutOfResources = 701,
264 hipErrorLaunchTimeOut = 702,
265 hipErrorPeerAccessAlreadyEnabled =
267 hipErrorPeerAccessNotEnabled =
269 hipErrorSetOnActiveProcess = 708,
270 hipErrorContextIsDestroyed = 709,
271 hipErrorAssert = 710,
272 hipErrorHostMemoryAlreadyRegistered =
274 hipErrorHostMemoryNotRegistered =
276 hipErrorLaunchFailure =
278 hipErrorCooperativeLaunchTooLarge =
280 hipErrorNotSupported = 801,
283 hipErrorStreamCaptureUnsupported = 900,
284 hipErrorStreamCaptureInvalidated = 901,
286 hipErrorStreamCaptureMerge = 902,
288 hipErrorStreamCaptureUnmatched = 903,
290 hipErrorStreamCaptureUnjoined = 904,
291 hipErrorStreamCaptureIsolation = 905,
293 hipErrorStreamCaptureImplicit = 906,
297 hipErrorCapturedEvent = 907,
300 hipErrorStreamCaptureWrongThread = 908,
302 hipErrorUnknown = 999,
307 hipErrorRuntimeMemory = 1052,
308 hipErrorRuntimeOther = 1053,
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) {
Definition: hip_runtime_api.h:389
Device supports allocating managed memory on this system.
Definition: hip_runtime_api.h:384
Definition: hip_runtime_api.h:375
size_t totalConstMem
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:96
hipError_t hipMallocManaged(void **dev_ptr, size_t size, unsigned int flags __dparm(hipMemAttachGlobal))
Allocates memory that will be automatically managed by AMD HMM.
Definition: hip_runtime_api.h:352
int asicRevision
Revision of the GPU in this device.
Definition: hip_runtime_api.h:143
Maximum x-dimension of a block.
Definition: hip_runtime_api.h:323
Maximum x-dimension of a grid.
Definition: hip_runtime_api.h:326
Maximum pitch in bytes allowed by memory copies.
Definition: hip_runtime_api.h:368
int concurrentManagedAccess
Device can coherently access managed memory concurrently with the CPU.
Definition: hip_runtime_api.h:146
Global memory bus width in bits.
Definition: hip_runtime_api.h:339
Definition: hip_runtime_api.h:391
Definition: hip_runtime_api.h:385
unsigned int * hdpRegFlushCntl
Addres of HDP_REG_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:127
size_t texturePitchAlignment
Pitch alignment requirement for texture references bound to pitched memory.
Definition: hip_runtime_api.h:130
int canMapHostMemory
Check whether HIP can map host memory.
Definition: hip_runtime_api.h:116
Definition: hip_runtime_api.h:333
#define hipMemAttachGlobal
Memory can be accessed by any stream on any device.
Definition: hip_runtime_api.h:172
Revision of the GPU in this device.
Definition: hip_runtime_api.h:383
int regsPerBlock
Registers per block.
Definition: hip_runtime_api.h:88
Definition: hip_runtime_api.h:342
Run time limit for kernels executed on the device.
Definition: hip_runtime_api.h:371
#define hipHostMallocDefault
Flags that can be used with hipHostMalloc.
Definition: hip_runtime_api.h:156
Maximum dimension width of 3D images in image elements.
Definition: hip_runtime_api.h:361
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
Peak clock frequency in kilohertz.
Definition: hip_runtime_api.h:337
int maxTexture1D
Maximum number of elements in 1D images.
Definition: hip_runtime_api.h:123
Definition: hip_runtime_api.h:169
int clockRate
Max clock frequency of the multiProcessors in khz.
Definition: hip_runtime_api.h:93
Maximum z-dimension of a grid.
Definition: hip_runtime_api.h:328
Minor compute capability version number.
Definition: hip_runtime_api.h:347
Definition: hip_runtime_api.h:329
int pciBusID
PCI Bus ID.
Definition: hip_runtime_api.h:112
Definition: hip_runtime_api.h:377
Maximum y-dimension of a grid.
Definition: hip_runtime_api.h:327
Multiple GPU devices.
Definition: hip_runtime_api.h:354
int tccDriver
1:If device is Tesla device using TCC driver, else 0
Definition: hip_runtime_api.h:133
int maxThreadsPerBlock
Max work items per work group or workgroup max size.
Definition: hip_runtime_api.h:90
int maxTexture1DLinear
Maximum size for 1D textures bound to linear memory.
Definition: hip_runtime_api.h:122
Maximum y-dimension of a block.
Definition: hip_runtime_api.h:324
hipError_t hipHostMalloc(void **ptr, size_t size, unsigned int flags)
Allocate device accessible page locked host memory.
Definition: hip_runtime_api.h:379
size_t sharedMemPerBlock
Size of shared memory region (in bytes).
Definition: hip_runtime_api.h:87
Definition: hip_runtime_api.h:387
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
size_t memPitch
Maximum pitch in bytes allowed by memory copies.
Definition: hip_runtime_api.h:128
int l2CacheSize
L2 cache size.
Definition: hip_runtime_api.h:104
hipDeviceAttribute_t
Definition: hip_runtime_api.h:321
size_t textureAlignment
Alignment requirement for textures.
Definition: hip_runtime_api.h:129
Major compute capability version number.
Definition: hip_runtime_api.h:346
Maximum number of threads per block.
Definition: hip_runtime_api.h:322
int gcnArch
DEPRECATED: use gcnArchName instead.
Definition: hip_runtime_api.h:117
Maximum dimensions depth of 3D images in image elements.
Definition: hip_runtime_api.h:363
int kernelExecTimeoutEnabled
Run time limit for kernels executed on the device.
Definition: hip_runtime_api.h:131
int computeMode
Compute mode.
Definition: hip_runtime_api.h:106
Maximum z-dimension of a block.
Definition: hip_runtime_api.h:325
PCI Bus ID.
Definition: hip_runtime_api.h:350
unsigned int * hdpMemFlushCntl
Addres of HDP_MEM_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:126
Maximum dimension height of 2D images in image elements.
Definition: hip_runtime_api.h:360
Warp size in threads.
Definition: hip_runtime_api.h:332
int major
Definition: hip_runtime_api.h:97
Maximum dimensions height of 3D images in image elements.
Definition: hip_runtime_api.h:362
Contains C function APIs for HIP runtime. This file does not use any HCC builtin or special language ...
Peak memory clock frequency in kilohertz.
Definition: hip_runtime_api.h:338
Definition: hip_runtime_api.h:344
Address of the HDP_REG_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:366
int clockInstructionRate
Definition: hip_runtime_api.h:107
int cooperativeMultiDeviceLaunch
HIP device supports cooperative launch on multiple devices.
Definition: hip_runtime_api.h:121
Constant memory size in bytes.
Definition: hip_runtime_api.h:331
Pitch alignment requirement for 2D texture references bound to pitched memory;.
Definition: hip_runtime_api.h:370
int warpSize
Warp size.
Definition: hip_runtime_api.h:89
int concurrentKernels
Device can possibly execute multiple kernels concurrently.
Definition: hip_runtime_api.h:110
Alignment requirement for textures.
Definition: hip_runtime_api.h:369
size_t totalGlobalMem
Size of global memory region (in bytes).
Definition: hip_runtime_api.h:86
hipError_t hipMalloc(void **ptr, size_t size)
Allocate memory on the default accelerator.
Compute mode that device is currently in.
Definition: hip_runtime_api.h:341
PCI Device ID.
Definition: hip_runtime_api.h:351
Device can map host memory into device address space.
Definition: hip_runtime_api.h:372
Number of multiprocessors on the device.
Definition: hip_runtime_api.h:340
int integrated
APU vs dGPU.
Definition: hip_runtime_api.h:119
int memoryBusWidth
Global memory bus width in bits.
Definition: hip_runtime_api.h:95
Definition: hip_runtime_api.h:84
size_t maxSharedMemoryPerMultiProcessor
Maximum Shared Memory Per Multiprocessor.
Definition: hip_runtime_api.h:114
int cooperativeLaunch
HIP device supports cooperative launch.
Definition: hip_runtime_api.h:120
Support cooperative launch.
Definition: hip_runtime_api.h:356
Maximum number of elements in 1D images.
Definition: hip_runtime_api.h:358
int pciDeviceID
PCI Device ID.
Definition: hip_runtime_api.h:113
int pciDomainID
PCI Domain ID.
Definition: hip_runtime_api.h:111
int ECCEnabled
Device has ECC support enabled.
Definition: hip_runtime_api.h:132
int managedMemory
Device supports allocating managed memory on this system.
Definition: hip_runtime_api.h:144
int directManagedMemAccessFromHost
Host can directly access managed memory on the device without migration.
Definition: hip_runtime_api.h:145
Definition: hip_runtime_api.h:45
Definition: hip_runtime_api.h:381
int memoryClockRate
Max global memory clock frequency in khz.
Definition: hip_runtime_api.h:94
Maximum dimension width of 2D images in image elements.
Definition: hip_runtime_api.h:359
int pageableMemoryAccess
Definition: hip_runtime_api.h:147
Address of the HDP_MEM_COHERENCY_FLUSH_CNTL register.
Definition: hip_runtime_api.h:365
Definition: hip_runtime_api.h:393
Device has ECC support enabled.
Definition: hip_runtime_api.h:373
int cooperativeMultiDeviceUnmatchedFunc
Definition: hip_runtime_api.h:134
Definition: hip_runtime_api.h:348