Module Management#
Modules | |
Cooperative groups kernel launch of Module management. | |
Functions | |
hipError_t | hipModuleGetGlobal (hipDeviceptr_t *dptr, size_t *bytes, hipModule_t hmod, const char *name) |
Returns a global pointer from a module. | |
hipError_t | hipModuleLoad (hipModule_t *module, const char *fname) |
Loads code object from file into a module the currrent context. | |
hipError_t | hipModuleUnload (hipModule_t module) |
Frees the module. | |
hipError_t | hipModuleGetFunction (hipFunction_t *function, hipModule_t module, const char *kname) |
Function with kname will be extracted if present in module. | |
hipError_t | hipGetFuncBySymbol (hipFunction_t *functionPtr, const void *symbolPtr) |
Gets pointer to device entry function that matches entry function symbolPtr. | |
hipError_t | hipModuleGetTexRef (textureReference **texRef, hipModule_t hmod, const char *name) |
returns the handle of the texture reference with the name from the module. | |
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. | |
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. | |
hipError_t | hipLinkAddData (hipLinkState_t state, hipJitInputType type, void *data, size_t size, const char *name, unsigned int numOptions, hipJitOption *options, void **optionValues) |
Adds bitcode data to be linked with options. | |
hipError_t | hipLinkAddFile (hipLinkState_t state, hipJitInputType type, const char *path, unsigned int numOptions, hipJitOption *options, void **optionValues) |
Adds a file with bitcode to be linked with options. | |
hipError_t | hipLinkComplete (hipLinkState_t state, void **hipBinOut, size_t *sizeOut) |
Completes the linking of the given program. | |
hipError_t | hipLinkCreate (unsigned int numOptions, hipJitOption *options, void **optionValues, hipLinkState_t *stateOut) |
Creates a linker instance with options. | |
hipError_t | hipLinkDestroy (hipLinkState_t state) |
Deletes the linker instance. | |
Detailed Description
This section describes the module management functions of HIP runtime API.
Function Documentation
◆ hipGetFuncBySymbol()
hipError_t hipGetFuncBySymbol | ( | hipFunction_t * | functionPtr, |
const void * | symbolPtr | ||
) |
Gets pointer to device entry function that matches entry function symbolPtr.
- Parameters
-
[out] functionPtr Device entry function [in] symbolPtr Pointer to device entry function to search for
◆ hipLinkAddData()
hipError_t hipLinkAddData | ( | hipLinkState_t | state, |
hipJitInputType | type, | ||
void * | data, | ||
size_t | size, | ||
const char * | name, | ||
unsigned int | numOptions, | ||
hipJitOption * | options, | ||
void ** | optionValues | ||
) |
Adds bitcode data to be linked with options.
- Parameters
-
[in] state hip link state [in] type Type of the input data or bitcode [in] data Input data which is null terminated [in] size Size of the input data [in] name Optional name for this input [in] numOptions Size of the options [in] options Array of options applied to this input [in] optionValues Array of option values cast to void*
If adding the file fails, it will
- Returns
- hipErrorInvalidConfiguration
- See also
- hipError_t
◆ hipLinkAddFile()
hipError_t hipLinkAddFile | ( | hipLinkState_t | state, |
hipJitInputType | type, | ||
const char * | path, | ||
unsigned int | numOptions, | ||
hipJitOption * | options, | ||
void ** | optionValues | ||
) |
Adds a file with bitcode to be linked with options.
- Parameters
-
[in] state hip link state [in] type Type of the input data or bitcode [in] path Path to the input file where bitcode is present [in] numOptions Size of the options [in] options Array of options applied to this input [in] optionValues Array of option values cast to void*
- Returns
- hipSuccess, hipErrorInvalidValue
If adding the file fails, it will
- Returns
- hipErrorInvalidConfiguration
- See also
- hipError_t
◆ hipLinkComplete()
hipError_t hipLinkComplete | ( | hipLinkState_t | state, |
void ** | hipBinOut, | ||
size_t * | sizeOut | ||
) |
Completes the linking of the given program.
- Parameters
-
[in] state hip link state [out] hipBinOut Upon success, points to the output binary [out] sizeOut Size of the binary is stored (optional)
- Returns
- hipSuccess hipErrorInvalidValue
If adding the data fails, it will
- Returns
- hipErrorInvalidConfiguration
- See also
- hipError_t
◆ hipLinkCreate()
hipError_t hipLinkCreate | ( | unsigned int | numOptions, |
hipJitOption * | options, | ||
void ** | optionValues, | ||
hipLinkState_t * | stateOut | ||
) |
Creates a linker instance with options.
- Parameters
-
[in] numOptions Number of options [in] option Array of options [in] optionValues Array of option values cast to void* [out] stateOut hip link state created upon success
- See also
- hipSuccess
◆ hipLinkDestroy()
hipError_t hipLinkDestroy | ( | hipLinkState_t | state | ) |
Deletes the linker instance.
- Parameters
-
[in] state link state instance
- Returns
- hipSuccess hipErrorInvalidValue
- See also
- hipSuccess
◆ hipModuleGetFunction()
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 Module to get function from [in] kname Pointer to the name of function [out] function Pointer to function handle
◆ hipModuleGetGlobal()
hipError_t hipModuleGetGlobal | ( | hipDeviceptr_t * | dptr, |
size_t * | bytes, | ||
hipModule_t | hmod, | ||
const char * | name | ||
) |
Returns a global pointer from a module.
Returns in *dptr and *bytes the pointer and size of the global of name name located in module hmod. If no variable of that name exists, it returns hipErrorNotFound. Both parameters dptr and bytes are optional. If one of them is NULL, it is ignored and hipSuccess is returned.
- Parameters
-
[out] dptr Returns global device pointer [out] bytes Returns global size in bytes [in] hmod Module to retrieve global from [in] name Name of global to retrieve
◆ hipModuleGetTexRef()
hipError_t hipModuleGetTexRef | ( | textureReference ** | texRef, |
hipModule_t | hmod, | ||
const char * | name | ||
) |
returns the handle of the texture reference with the name from the module.
- Parameters
-
[in] hmod Module [in] name Pointer of name of texture reference [out] texRef Pointer of texture reference
◆ hipModuleLoad()
hipError_t hipModuleLoad | ( | hipModule_t * | module, |
const char * | fname | ||
) |
Loads code object from file into a module the currrent context.
- Parameters
-
[in] fname Filename of code object to load [out] module Module
- Warning
- File/memory resources allocated in this function are released only in hipModuleUnload.
◆ hipModuleLoadData()
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 The pointer to the location of data [out] module Retuned module
- Returns
- hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized
◆ hipModuleLoadDataEx()
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 The pointer to the location of data [out] module Retuned module [in] numOptions Number of options [in] options Options for JIT [in] optionValues Option values for JIT
- Returns
- hipSuccess, hipErrorNotInitialized, hipErrorOutOfMemory, hipErrorNotInitialized
◆ hipModuleUnload()
hipError_t hipModuleUnload | ( | hipModule_t | module | ) |
Frees the module.
- Parameters
-
[in] module Module to free
The module is freed, and the code objects associated with it are destroyed.