rocm.bindings.hiprtc#
2026-09-24
12 min read time
Advanced Micro Devices, Inc.
Attributes#
Classes#
(No short description) |
Functions#
|
|
|
Returns text string message to explain the error which occurred |
Sets the parameters as major and minor version. |
|
|
Adds the given name exprssion to the runtime compilation program. |
|
Compiles the given runtime compilation program. |
|
Creates an instance of hiprtcProgram with the given input parameters, |
|
Destroys an instance of given hiprtcProgram. |
|
Gets the lowered (mangled) name from an instance of hiprtcProgram with the given input |
|
Gets the log generated by the runtime compilation program instance. |
|
Gets the size of log generated by the runtime compilation program instance. |
|
Gets the pointer of compilation binary by the runtime compilation program instance. |
|
Gets the size of compilation binary by the runtime compilation program instance. |
|
Gets the pointer of compiled bitcode by the runtime compilation program instance. |
|
Gets the size of compiled bitcode by the runtime compilation program instance. |
|
Creates the link instance via hiprtc APIs. |
|
Adds a file with bit code to be linked with options |
|
Completes the linking of the given program. |
|
Completes the linking of the given program. |
|
Deletes the link instance via hiprtc APIs. |
Module Contents#
- class rocm.bindings.hiprtc.hiprtcResult#
Bases:
enum.IntEnumhiprtc error code
- class rocm.bindings.hiprtc.ihiprtcLinkState(*args, **kwargs)#
Bases:
rocm.bindings.util.types.Pointer(No short description)
- rocm.bindings.hiprtc.hiprtcLinkState#
- rocm.bindings.hiprtc.hiprtcGetErrorString(result)#
Returns text string message to explain the error which occurred
- Warning:
In HIP, this function returns the name of the error, if the hiprtc result is defined, it will return “Invalid HIPRTC error code”
- See:
- Args:
- result (
hiprtcResult) – IN: code to convert to string.
- result (
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult:Always returns
HIPRTC_SUCCESS.
bytes: const char pointer to the NULL-terminated error string
C signature
const char * hiprtcGetErrorString(hiprtcResult result)
- rocm.bindings.hiprtc.hiprtcVersion()#
Sets the parameters as major and minor version.
- Returns:
A
tupleof size 3 that contains (in that order):hiprtcResult: py:obj:HIPRTC_ERROR_INVALID_INPUT,HIPRTC_SUCCESSint:HIP Runtime Compilation major version.
int:HIP Runtime Compilation minor version.
C signature
hiprtcResult hiprtcVersion(int * major, int * minor)
- rocm.bindings.hiprtc.hiprtcProgram#
- rocm.bindings.hiprtc.hiprtcAddNameExpression(prog, 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:
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcAddNameExpression(hiprtcProgram prog, const char * name_expression)
- rocm.bindings.hiprtc.hiprtcCompileProgram(prog, numOptions, options)#
Compiles the given runtime compilation program.
If the compiler failed to build the runtime compilation program, it will return
HIPRTC_ERROR_COMPILATION.- See:
- Args:
- prog (
_hiprtcProgram/object) – IN: runtime compilation program instance.
- numOptions (
int) – IN: number of compiler options.
- options (
ListOfBytes/object) – IN: compiler options as const array of strins.
- prog (
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcCompileProgram(hiprtcProgram prog, int numOptions, const char *const * options)
- rocm.bindings.hiprtc.hiprtcCreateProgram(src, name, numHeaders, headers, 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_INPUTorHIPRTC_ERROR_INVALID_PROGRAM.If failed to create the program, it will return
HIPRTC_ERROR_PROGRAM_CREATION_FAILURE.- See:
- Args:
- src (
CStr/object) – IN: const char pointer to the program source.
- name (
CStr/object) – IN: const char pointer to the program name.
- numHeaders (
int) – IN: number of headers.
- headers (
ListOfBytes/object) – IN: array of strings pointing to headers.
- includeNames (
ListOfBytes/object) – IN: array of strings pointing to names included in program source.
- src (
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS_hiprtcProgram:runtime compilation program instance.
C signature
hiprtcResult hiprtcCreateProgram(hiprtcProgram * prog, const char * src, const char * name, int numHeaders, const char *const * headers, const char *const * includeNames)
- rocm.bindings.hiprtc.hiprtcDestroyProgram(prog)#
Destroys an instance of given hiprtcProgram.
If prog is NULL, it will return
HIPRTC_ERROR_INVALID_INPUT.- See:
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcDestroyProgram(hiprtcProgram * prog)
- rocm.bindings.hiprtc.hiprtcGetLoweredName(prog, name_expression)#
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_INPUTIf name_expression is not found, it will return
HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALIDIf failed to get lowered_name from the program, it will return
HIPRTC_ERROR_COMPILATION.- See:
- Args:
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcGetLoweredName(hiprtcProgram prog, const char * name_expression, const char ** lowered_name)
- rocm.bindings.hiprtc.hiprtcGetProgramLog(prog, log)#
Gets the log generated by the runtime compilation program instance.
- See:
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcGetProgramLog(hiprtcProgram prog, char * log)
- rocm.bindings.hiprtc.hiprtcGetProgramLogSize(prog)#
Gets the size of log generated by the runtime compilation program instance.
- See:
- Args:
- prog (
_hiprtcProgram/object) – IN: runtime compilation program instance.
- prog (
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESSint:size of generated log.
C signature
hiprtcResult hiprtcGetProgramLogSize(hiprtcProgram prog, size_t * logSizeRet)
- rocm.bindings.hiprtc.hiprtcGetCode(prog, code)#
Gets the pointer of compilation binary by the runtime compilation program instance.
- See:
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcGetCode(hiprtcProgram prog, char * code)
- rocm.bindings.hiprtc.hiprtcGetCodeSize(prog)#
Gets the size of compilation binary by the runtime compilation program instance.
- See:
- Args:
- prog (
_hiprtcProgram/object) – IN: runtime compilation program instance.
- prog (
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESSint:the size of binary.
C signature
hiprtcResult hiprtcGetCodeSize(hiprtcProgram prog, size_t * codeSizeRet)
- rocm.bindings.hiprtc.hiprtcGetBitcode(prog, bitcode)#
Gets the pointer of compiled bitcode by the runtime compilation program instance.
- See:
- Args:
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcGetBitcode(hiprtcProgram prog, char * bitcode)
- rocm.bindings.hiprtc.hiprtcGetBitcodeSize(prog)#
Gets the size of compiled bitcode by the runtime compilation program instance.
- See:
- Args:
- prog (
_hiprtcProgram/object) – IN: runtime compilation program instance.
- prog (
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESSint:the size of bitcode.
C signature
hiprtcResult hiprtcGetBitcodeSize(hiprtcProgram prog, size_t * bitcode_size)
- rocm.bindings.hiprtc.hiprtcLinkCreate(num_options, option_ptr, option_vals_pptr)#
Creates the link instance via hiprtc APIs.
- See:
- Args:
- num_options (
int) – IN: Number of options
- option_ptr (
HiprtcLinkCreate_option_ptr/object) – IN: Array of options
- option_vals_pptr (
ListOfPointer/object) – IN: Array of option values cast to void*
- num_options (
- Returns:
A
tupleof size 2 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS,HIPRTC_ERROR_INVALID_INPUT,HIPRTC_ERROR_INVALID_OPTIONihiprtcLinkState:hiprtc link state created upon success
C signature
hiprtcResult hiprtcLinkCreate(unsigned int num_options, hipJitOption * option_ptr, void ** option_vals_pptr, hiprtcLinkState * hip_link_state_ptr)
- rocm.bindings.hiprtc.hiprtcLinkAddFile(hip_link_state, input_type, file_path, num_options, options_ptr, option_values)#
Adds a file with bit code to be linked with options
If input values are invalid, it will
- See:
- Args:
- hip_link_state (
ihiprtcLinkState/object) – IN: hiprtc link state
- input_type (
hipJitInputType) – IN: Type of the input data or bitcode
- file_path (
CStr/object) – IN: Path to the input file where bitcode is present
- num_options (
int) – IN: Size of the options
- options_ptr (
Pointer/object) – IN: Array of options applied to this input
- option_values (
ListOfPointer/object) – IN: Array of option values cast to void*
- hip_link_state (
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: One of:py:obj:
HIPRTC_SUCCESSpy:obj:
HIPRTC_ERROR_INVALID_INPUT
C signature
hiprtcResult hiprtcLinkAddFile(hiprtcLinkState hip_link_state, hipJitInputType input_type, const char * file_path, unsigned int num_options, hipJitOption * options_ptr, void ** option_values)
- rocm.bindings.hiprtc.hiprtcLinkAddData(hip_link_state, input_type, image, image_size, name, num_options, options_ptr, option_values)#
Completes the linking of the given program.
If adding the file fails, it will
- See:
- Args:
- hip_link_state (
ihiprtcLinkState/object) – IN: hiprtc link state
- input_type (
hipJitInputType) – IN: Type of the input data or bitcode
- image (
Pointer/object) – IN: Input data which is null terminated
- image_size (
int) – IN: Size of the input data
- name (
CStr/object) – IN: Optional name for this input
- num_options (
int) – IN: Size of the options
- options_ptr (
Pointer/object) – IN: Array of options applied to this input
- option_values (
ListOfPointer/object) – IN: Array of option values cast to void*
- hip_link_state (
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: One of:
C signature
hiprtcResult hiprtcLinkAddData(hiprtcLinkState hip_link_state, hipJitInputType input_type, void * image, size_t image_size, const char * name, unsigned int num_options, hipJitOption * options_ptr, void ** option_values)
- rocm.bindings.hiprtc.hiprtcLinkComplete(hip_link_state)#
Completes the linking of the given program.
If adding the data fails, it will
- See:
- Args:
- hip_link_state (
ihiprtcLinkState/object) – IN: hiprtc link state
- hip_link_state (
- Returns:
A
tupleof size 3 that contains (in that order):hiprtcResult: One of:py:obj:
HIPRTC_SUCCESSpy:obj:
HIPRTC_ERROR_LINKING
int:Size of the binary is stored (optional)
C signature
hiprtcResult hiprtcLinkComplete(hiprtcLinkState hip_link_state, void ** bin_out, size_t * size_out)
- rocm.bindings.hiprtc.hiprtcLinkDestroy(hip_link_state)#
Deletes the link instance via hiprtc APIs.
- See:
- Args:
- hip_link_state (
ihiprtcLinkState/object) – IN: link state instance
- hip_link_state (
- Returns:
A
tupleof size 1 that contains (in that order):hiprtcResult: py:obj:HIPRTC_SUCCESS
C signature
hiprtcResult hiprtcLinkDestroy(hiprtcLinkState hip_link_state)