HIP: Heterogenous-computing Interface for Portability
Modules | Functions
Initialization and Version

Modules

 Management
 

Functions

hipError_t hipInit (unsigned int flags)
 Explicitly initializes the HIP runtime. More...
 
hipError_t hipDeviceGet (hipDevice_t *device, int ordinal)
 Returns a handle to a compute device. More...
 
hipError_t hipDeviceComputeCapability (int *major, int *minor, hipDevice_t device)
 Returns the compute capability of the device. More...
 
hipError_t hipDeviceGetName (char *name, int len, hipDevice_t device)
 Returns an identifer string for the device. More...
 
hipError_t hipDeviceGetPCIBusId (char *pciBusId, int len, int device)
 Returns a PCI Bus Id string for the device, overloaded to take int device ID. More...
 
hipError_t hipDeviceGetByPCIBusId (int *device, const int *pciBusId)
 Returns a handle to a compute device. More...
 
hipError_t hipDeviceTotalMem (size_t *bytes, hipDevice_t device)
 Returns the total amount of memory on the device. More...
 
hipError_t hipDriverGetVersion (int *driverVersion)
 Returns the approximate HIP driver version. More...
 
hipError_t hipRuntimeGetVersion (int *runtimeVersion)
 Returns the approximate HIP Runtime version. More...
 
hipError_t hipModuleLoad (hipModule_t *module, const char *fname)
 Loads code object from file into a hipModule_t. More...
 
hipError_t hipModuleUnload (hipModule_t module)
 Frees the module. More...
 
hipError_t hipModuleGetFunction (hipFunction_t *function, hipModule_t module, const char *kname)
 Function with kname will be extracted if present in module. More...
 
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 More...
 
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. More...
 
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. Options are not used. hipModuleLoadData is called. More...
 
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 kernelparams or extra More...
 

Detailed Description

----------------------------------------------------------------------------------------------—

Function Documentation

hipError_t hipDeviceComputeCapability ( int *  major,
int *  minor,
hipDevice_t  device 
)

Returns the compute capability of the device.

Parameters
[out]major
[out]minor
[in]device
Returns
hipSuccess, #hipErrorInavlidDevice
hipError_t hipDeviceGet ( hipDevice_t *  device,
int  ordinal 
)

Returns a handle to a compute device.

Parameters
[out]device
[in]ordinal
Returns
hipSuccess, #hipErrorInavlidDevice
hipError_t hipDeviceGetByPCIBusId ( int *  device,
const int *  pciBusId 
)

Returns a handle to a compute device.

Parameters
[out]devicehandle
[in]PCIBus ID
Returns
hipSuccess, #hipErrorInavlidDevice, hipErrorInvalidValue
hipError_t hipDeviceGetName ( char *  name,
int  len,
hipDevice_t  device 
)

Returns an identifer string for the device.

Parameters
[out]name
[in]len
[in]device
Returns
hipSuccess, #hipErrorInavlidDevice
hipError_t hipDeviceGetPCIBusId ( char *  pciBusId,
int  len,
int  device 
)

Returns a PCI Bus Id string for the device, overloaded to take int device ID.

Parameters
[out]pciBusId
[in]len
[in]device
Returns
hipSuccess, #hipErrorInavlidDevice
hipError_t hipDeviceTotalMem ( size_t *  bytes,
hipDevice_t  device 
)

Returns the total amount of memory on the device.

Parameters
[out]bytes
[in]device
Returns
hipSuccess, #hipErrorInavlidDevice
hipError_t hipDriverGetVersion ( int *  driverVersion)

Returns the approximate HIP driver version.

Parameters
[out]driverVersion
Returns
hipSuccess, #hipErrorInavlidValue
Warning
The HIP feature set does not correspond to an exact CUDA SDK driver revision. This function always set *driverVersion to 4 as an approximation though HIP supports some features which were introduced in later CUDA SDK revisions. HIP apps code should not rely on the driver revision number here and should use arch feature flags to test device capabilities or conditional compilation.
See also
hipRuntimeGetVersion
hipError_t hipInit ( unsigned int  flags)

Explicitly initializes the HIP runtime.

Most HIP APIs implicitly initialize the HIP runtime. This API provides control over the timing of the initialization.

hipError_t hipModuleGetFunction ( hipFunction_t function,
hipModule_t  module,
const char *  kname 
)

Function with kname will be extracted if present in module.

Parameters
[in]module
[in]kname
[out]function
Returns
hipSuccess, hipErrorInvalidValue, hipErrorInvalidContext, hipErrorNotInitialized, hipErrorNotFound,
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

Parameters
[out]dptr
[out]bytes
[in]hmod
[in]name
Returns
hipSuccess, hipErrorInvalidValue, hipErrorNotInitialized
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 kernelparams or extra

Parameters
[in]fKernel to launch.
[in]gridDimXX grid dimension specified as multiple of blockDimX.
[in]gridDimYY grid dimension specified as multiple of blockDimY.
[in]gridDimZZ grid dimension specified as multiple of blockDimZ.
[in]blockDimXX block dimensions specified in work-items
[in]blockDimYY grid dimension specified in work-items
[in]blockDimZZ grid dimension specified in work-items
[in]sharedMemBytesAmount of dynamic shared memory to allocate for this kernel. The kernel can access this with HIP_DYNAMIC_SHARED.
[in]streamStream where the kernel should be dispatched. May be 0, in which case th default stream is used with associated synchronization rules.
[in]kernelParams
[in]extraPointer to kernel arguments. These are passed directly to the kernel and must be in the memory layout and alignment expected by the kernel.
Returns
hipSuccess, hipInvalidDevice, hipErrorNotInitialized, hipErrorInvalidValue
Warning
kernellParams argument is not yet implemented in HIP. Please use extra instead. Please refer to hip_porting_driver_api.md for sample usage.
hipError_t hipModuleLoad ( hipModule_t module,
const char *  fname 
)

Loads code object from file into a hipModule_t.

Parameters
[in]fname
[out]module
Returns
hipSuccess, hipErrorInvalidValue, hipErrorInvalidContext, hipErrorFileNotFound, hipErrorOutOfMemory, hipErrorSharedObjectInitFailed, hipErrorNotInitialized
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.

Parameters
[in]image
[out]module
Returns
hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized
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. Options are not used. hipModuleLoadData is called.

Parameters
[in]image
[out]module
[in]numberof options
[in]optionsfor JIT
[in]optionvalues for JIT
Returns
hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized
hipError_t hipModuleUnload ( hipModule_t  module)

Frees the module.

Parameters
[in]module
Returns
hipSuccess, hipInvalidValue module is freed and the code objects associated with it are destroyed
hipError_t hipRuntimeGetVersion ( int *  runtimeVersion)

Returns the approximate HIP Runtime version.

Parameters
[out]runtimeVersion
Returns
hipSuccess, #hipErrorInavlidValue
Warning
On HIP/HCC path this function returns HIP runtime patch version however on HIP/NVCC path this function return CUDA runtime version.
See also
hipDriverGetVersion