Runtime compilation#
-
const char *hiprtcGetErrorString(hiprtcResult result)#
Returns text string message to explain the error which occurred.
See also
Warning
In HIP, this function returns the name of the error, if the hiprtc result is defined, it will return “Invalid HIPRTC error code”
- Parameters:
result – [in] code to convert to string.
- Returns:
const char pointer to the NULL-terminated error string
-
hiprtcResult hiprtcVersion(int *major, int *minor)#
Sets the parameters as major and minor version.
- Parameters:
major – [out] HIP Runtime Compilation major version.
minor – [out] HIP Runtime Compilation minor version.
- Returns:
-
hiprtcResult hiprtcAddNameExpression(hiprtcProgram prog, const char *name_expression)#
Adds the given name exprssion to the runtime compilation program.
If const char pointer is NULL, it will return HIPRTC_ERROR_INVALID_INPUT.
See also
- Parameters:
prog – [in] runtime compilation program instance.
name_expression – [in] const char pointer to the name expression.
- Returns:
-
hiprtcResult hiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char **options)#
Compiles the given runtime compilation program.
If the compiler failed to build the runtime compilation program, it will return HIPRTC_ERROR_COMPILATION.
See also
- Parameters:
prog – [in] runtime compilation program instance.
numOptions – [in] number of compiler options.
options – [in] compiler options as const array of strins.
- Returns:
-
hiprtcResult hiprtcCreateProgram(hiprtcProgram *prog, const char *src, const char *name, int numHeaders, const char **headers, const char **includeNames)#
Creates an instance of hiprtcProgram with the given input parameters, and sets the output hiprtcProgram prog with it.
Any invalide input parameter, it will return HIPRTC_ERROR_INVALID_INPUT or HIPRTC_ERROR_INVALID_PROGRAM.
If failed to create the program, it will return HIPRTC_ERROR_PROGRAM_CREATION_FAILURE.
See also
- Parameters:
prog – [inout] runtime compilation program instance.
src – [in] const char pointer to the program source.
name – [in] const char pointer to the program name.
numHeaders – [in] number of headers.
headers – [in] array of strings pointing to headers.
includeNames – [in] array of strings pointing to names included in program source.
- Returns:
-
hiprtcResult hiprtcDestroyProgram(hiprtcProgram *prog)#
Destroys an instance of given hiprtcProgram.
If prog is NULL, it will return HIPRTC_ERROR_INVALID_INPUT.
See also
- Parameters:
prog – [in] runtime compilation program instance.
- Returns:
-
hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog, const char *name_expression, const char **lowered_name)#
Gets the lowered (mangled) name from an instance of hiprtcProgram with the given input parameters, and sets the output lowered_name with it.
If any invalide nullptr input parameters, it will return HIPRTC_ERROR_INVALID_INPUT
If name_expression is not found, it will return HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID
If failed to get lowered_name from the program, it will return HIPRTC_ERROR_COMPILATION.
See also
- Parameters:
prog – [in] runtime compilation program instance.
name_expression – [in] const char pointer to the name expression.
lowered_name – [inout] const char array to the lowered (mangled) name.
- Returns:
-
hiprtcResult hiprtcGetProgramLog(hiprtcProgram prog, char *log)#
Gets the log generated by the runtime compilation program instance.
See also
- Parameters:
prog – [in] runtime compilation program instance.
log – [out] memory pointer to the generated log.
- Returns:
-
hiprtcResult hiprtcGetCode(hiprtcProgram prog, char *code)#
Gets the pointer of compilation binary by the runtime compilation program instance.
See also
- Parameters:
prog – [in] runtime compilation program instance.
code – [out] char pointer to binary.
- Returns:
-
hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog, size_t *codeSizeRet)#
Gets the size of compilation binary by the runtime compilation program instance.
See also
- Parameters:
prog – [in] runtime compilation program instance.
codeSizeRet – [out] the size of binary.
- Returns:
-
hiprtcResult hiprtcGetBitcodeSize(hiprtcProgram prog, size_t *bitcode_size)#
Gets the size of compiled bitcode by the runtime compilation program instance.
See also
- Parameters:
prog – [in] runtime compilation program instance.
bitcode_size – [out] the size of bitcode.
- Returns:
-
hiprtcResult hiprtcLinkCreate(unsigned int num_options, hiprtcJIT_option *option_ptr, void **option_vals_pptr, hiprtcLinkState *hip_link_state_ptr)#
Creates the link instance via hiprtc APIs.
See also
- Parameters:
num_options – [in] Number of options
option_ptr – [in] Array of options
option_vals_pptr – [in] Array of option values cast to void*
hip_link_state_ptr – [out] hiprtc link state created upon success
- Returns:
HIPRTC_SUCCESS, HIPRTC_ERROR_INVALID_INPUT, HIPRTC_ERROR_INVALID_OPTION
-
hiprtcResult hiprtcLinkAddFile(hiprtcLinkState hip_link_state, hiprtcJITInputType input_type, const char *file_path, unsigned int num_options, hiprtcJIT_option *options_ptr, void **option_values)#
Adds a file with bit code to be linked with options.
If input values are invalid, it will
See also
- Parameters:
hip_link_state – [in] hiprtc link state
input_type – [in] Type of the input data or bitcode
file_path – [in] Path to the input file where bitcode is present
num_options – [in] Size of the options
options_ptr – [in] Array of options applied to this input
option_values – [in] Array of option values cast to void*
- Returns:
- Returns:
-
hiprtcResult hiprtcLinkAddData(hiprtcLinkState hip_link_state, hiprtcJITInputType input_type, void *image, size_t image_size, const char *name, unsigned int num_options, hiprtcJIT_option *options_ptr, void **option_values)#
Completes the linking of the given program.
If adding the file fails, it will
See also
- Parameters:
hip_link_state – [in] hiprtc link state
input_type – [in] Type of the input data or bitcode
image – [in] Input data which is null terminated
image_size – [in] Size of the input data
name – [in] Optional name for this input
num_options – [in] Size of the options
options_ptr – [in] Array of options applied to this input
option_values – [in] Array of option values cast to void*
- Returns:
- Returns:
-
hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void **bin_out, size_t *size_out)#
Completes the linking of the given program.
If adding the data fails, it will
See also
- Parameters:
hip_link_state – [in] hiprtc link state
bin_out – [out] Upon success, points to the output binary
size_out – [out] Size of the binary is stored (optional)
- Returns:
- Returns:
-
hiprtcResult hiprtcLinkDestroy(hiprtcLinkState hip_link_state)#
Deletes the link instance via hiprtc APIs.
See also
- Parameters:
hip_link_state – [in] link state instance
- Returns: