hip.hiprtc#
(No short description)
- Attributes:
- hiprtcLinkState:
alias of
ihiprtcLinkState
- hiprtcProgram:
alias of
_hiprtcProgram
- class hip.hiprtc.hiprtcResult(value)#
Bases:
_hiprtcResult__Base
@{
- Attributes:
- HIPRTC_SUCCESS:
Success
- HIPRTC_ERROR_OUT_OF_MEMORY:
Out of memory
- HIPRTC_ERROR_PROGRAM_CREATION_FAILURE:
Failed to create program
- HIPRTC_ERROR_INVALID_INPUT:
Invalid input
- HIPRTC_ERROR_INVALID_PROGRAM:
Invalid program
- HIPRTC_ERROR_INVALID_OPTION:
Invalid option
- HIPRTC_ERROR_COMPILATION:
Compilation error
- HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE:
Failed in builtin operation
- HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION:
No name expression after compilation
- HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION:
No lowered names before compilation
- HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID:
Invalid name expression
- HIPRTC_ERROR_INTERNAL_ERROR:
Internal error
- HIPRTC_ERROR_LINKING:
Error in linking
- HIPRTC_SUCCESS = 0#
- HIPRTC_ERROR_OUT_OF_MEMORY = 1#
- HIPRTC_ERROR_PROGRAM_CREATION_FAILURE = 2#
- HIPRTC_ERROR_INVALID_INPUT = 3#
- HIPRTC_ERROR_INVALID_PROGRAM = 4#
- HIPRTC_ERROR_INVALID_OPTION = 5#
- HIPRTC_ERROR_COMPILATION = 6#
- HIPRTC_ERROR_BUILTIN_OPERATION_FAILURE = 7#
- HIPRTC_ERROR_NO_NAME_EXPRESSIONS_AFTER_COMPILATION = 8#
- HIPRTC_ERROR_NO_LOWERED_NAMES_BEFORE_COMPILATION = 9#
- HIPRTC_ERROR_NAME_EXPRESSION_NOT_VALID = 10#
- HIPRTC_ERROR_INTERNAL_ERROR = 11#
- HIPRTC_ERROR_LINKING = 100#
- static ctypes_type()#
The type of the enum constants as ctypes type.
- class hip.hiprtc.hiprtcJIT_option(value)#
Bases:
_hiprtcJIT_option__Base
hiprtc JIT option
- Attributes:
- HIPRTC_JIT_MAX_REGISTERS:
Maximum registers
- HIPRTC_JIT_THREADS_PER_BLOCK:
Thread per block
- HIPRTC_JIT_WALL_TIME:
Time from aall clock
- HIPRTC_JIT_INFO_LOG_BUFFER:
Log buffer info
- HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES:
Log buffer size in bytes
- HIPRTC_JIT_ERROR_LOG_BUFFER:
Log buffer error
- HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES:
Log buffer size in bytes
- HIPRTC_JIT_OPTIMIZATION_LEVEL:
Optimization level
HIPRTC_JIT_TARGET_FROM_HIPCONTEXT:
- HIPRTC_JIT_TARGET:
JIT target
- HIPRTC_JIT_FALLBACK_STRATEGY:
Fallback strategy
- HIPRTC_JIT_GENERATE_DEBUG_INFO:
Generate debug information
- HIPRTC_JIT_LOG_VERBOSE:
Log verbose
- HIPRTC_JIT_GENERATE_LINE_INFO:
Generate line information
- HIPRTC_JIT_CACHE_MODE:
Cache mode
- HIPRTC_JIT_NEW_SM3X_OPT:
New SM3X option
- HIPRTC_JIT_FAST_COMPILE:
Fast compile
- HIPRTC_JIT_GLOBAL_SYMBOL_NAMES:
Global symbol names
- HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS:
Global symbol address
- HIPRTC_JIT_GLOBAL_SYMBOL_COUNT:
Global symbol count
- HIPRTC_JIT_LTO:
LTO
- HIPRTC_JIT_FTZ:
FTZ
- HIPRTC_JIT_PREC_DIV:
Prec_VIV
- HIPRTC_JIT_PREC_SQRT:
PREC_SQRT
- HIPRTC_JIT_FMA:
FMA
- HIPRTC_JIT_NUM_OPTIONS:
Number of options
- HIPRTC_JIT_IR_TO_ISA_OPT_EXT:
AMD only. Linker options to be passed on to
- HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT:
AMD only. Count of linker options
- HIPRTC_JIT_MAX_REGISTERS = 0#
- HIPRTC_JIT_THREADS_PER_BLOCK = 1#
- HIPRTC_JIT_WALL_TIME = 2#
- HIPRTC_JIT_INFO_LOG_BUFFER = 3#
- HIPRTC_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4#
- HIPRTC_JIT_ERROR_LOG_BUFFER = 5#
- HIPRTC_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6#
- HIPRTC_JIT_OPTIMIZATION_LEVEL = 7#
- HIPRTC_JIT_TARGET_FROM_HIPCONTEXT = 8#
- HIPRTC_JIT_TARGET = 9#
- HIPRTC_JIT_FALLBACK_STRATEGY = 10#
- HIPRTC_JIT_GENERATE_DEBUG_INFO = 11#
- HIPRTC_JIT_LOG_VERBOSE = 12#
- HIPRTC_JIT_GENERATE_LINE_INFO = 13#
- HIPRTC_JIT_CACHE_MODE = 14#
- HIPRTC_JIT_NEW_SM3X_OPT = 15#
- HIPRTC_JIT_FAST_COMPILE = 16#
- HIPRTC_JIT_GLOBAL_SYMBOL_NAMES = 17#
- HIPRTC_JIT_GLOBAL_SYMBOL_ADDRESS = 18#
- HIPRTC_JIT_GLOBAL_SYMBOL_COUNT = 19#
- HIPRTC_JIT_LTO = 20#
- HIPRTC_JIT_FTZ = 21#
- HIPRTC_JIT_PREC_DIV = 22#
- HIPRTC_JIT_PREC_SQRT = 23#
- HIPRTC_JIT_FMA = 24#
- HIPRTC_JIT_NUM_OPTIONS = 25#
- HIPRTC_JIT_IR_TO_ISA_OPT_EXT = 10000#
- HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT = 10001#
- static ctypes_type()#
The type of the enum constants as ctypes type.
- class hip.hiprtc.hiprtcJITInputType(value)#
Bases:
_hiprtcJITInputType__Base
hiprtc JIT input type
- Attributes:
- HIPRTC_JIT_INPUT_CUBIN:
Input cubin
- HIPRTC_JIT_INPUT_PTX:
Input PTX
- HIPRTC_JIT_INPUT_FATBINARY:
Input fat binary
- HIPRTC_JIT_INPUT_OBJECT:
Input object
- HIPRTC_JIT_INPUT_LIBRARY:
Input library
- HIPRTC_JIT_INPUT_NVVM:
Input NVVM
- HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES:
Number of legacy input type
- HIPRTC_JIT_INPUT_LLVM_BITCODE:
LLVM bitcode
- HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE:
LLVM bundled bitcode
- HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE:
LLVM archives of boundled bitcode
- HIPRTC_JIT_NUM_INPUT_TYPES:
(undocumented)
- HIPRTC_JIT_INPUT_CUBIN = 0#
- HIPRTC_JIT_INPUT_PTX = 1#
- HIPRTC_JIT_INPUT_FATBINARY = 2#
- HIPRTC_JIT_INPUT_OBJECT = 3#
- HIPRTC_JIT_INPUT_LIBRARY = 4#
- HIPRTC_JIT_INPUT_NVVM = 5#
- HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES = 6#
- HIPRTC_JIT_INPUT_LLVM_BITCODE = 100#
- HIPRTC_JIT_INPUT_LLVM_BUNDLED_BITCODE = 101#
- HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE = 102#
- HIPRTC_JIT_NUM_INPUT_TYPES = 9#
- static ctypes_type()#
The type of the enum constants as ctypes type.
- class hip.hiprtc.ihiprtcLinkState#
Bases:
Pointer
Python wrapper for cdef class chiprtc.ihiprtcLinkState.
Python wrapper for cdef class chiprtc.ihiprtcLinkState.
If this type is initialized via its
__init__
method, it allocates a member of the underlying C type and destroys it again if the wrapper type is deallocated.This type also serves as adapter when appearing as argument type in a function signature. In this case, the type can further be initialized from a number of Python objects:
None
:This will set the
self._ptr
attribute toNULL
.int
:Interprets the integer value as pointer address and writes it to
self._ptr
. No ownership is transferred.-
Takes the pointer address
pyobj.value
and writes it toself._ptr
. No ownership is transferred. object
that implements the CUDA Array Interface protocol:Takes the integer-valued pointer address, i.e. the first entry of the
data
tuple frompyobj
’s member__cuda_array_interface__
and writes it toself._ptr
.object
that implements the Python buffer protocol:If the object represents a simple contiguous array, writes the
Py_buffer
associated withpyobj
toself._py_buffer
, sets theself._py_buffer_acquired
flag toTrue
, and writesself._py_buffer.buf
to the data pointerself._ptr
.-
Takes the pointer address
pyobj._ptr
and writes it toself._ptr
. No ownership is transferred.
Type checks are performed in the above order.
- C Attributes:
- _ptr (C type
void *
, protected): Stores a pointer to the data of the original Python object.
- _is_ptr_owner (C type
bint
, protected): If this wrapper is the owner of the underlying data.
- _py_buffer (C type ``Py_buffer`, protected):
Stores a pointer to the data of the original Python object.
- _py_buffer_acquired (C type
bint
, protected): Stores a pointer to the data of the original Python object.
- _ptr (C type
- static PROPERTIES()#
- __getitem__(key, /)#
Return self[key].
- __init__()#
Constructor.
- as_c_void_p(self)#
Returns the data’s address as
ctypes.c_void_p
Note:Implemented as function to not collide with autogenerated property names.
- createRef(self) Pointer #
Creates are reference to this pointer.
Returns a
Pointer
that stores the address of this `~.Pointer’s data pointer.- Note:
No ownership information is transferred.
- static fromObj(pyobj)#
Creates a ihiprtcLinkState from a Python object.
Derives a ihiprtcLinkState from the given Python object
pyobj
. In casepyobj
is itself anihiprtcLinkState
reference, this method returns it directly. No newihiprtcLinkState
is created in this case.
- is_ptr_null#
If data pointer is NULL.
- hip.hiprtc.hiprtcLinkState#
alias of
ihiprtcLinkState
- hip.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
tuple
of size 1 that contains (in that order):bytes
: const char pointer to the NULL-terminated error string
- hip.hiprtc.hiprtcVersion()#
Sets the parameters as major and minor version.
- hip.hiprtc.hiprtcProgram#
alias of
_hiprtcProgram
- hip.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
tuple
of size 1 that contains (in that order):
- hip.hiprtc.hiprtcCompileProgram(prog, int 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
tuple
of size 1 that contains (in that order):
- hip.hiprtc.hiprtcCreateProgram(src, name, int 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_INPUT
orHIPRTC_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
tuple
of size 2 that contains (in that order):_hiprtcProgram
:runtime compilation program instance.
- hip.hiprtc.hiprtcDestroyProgram(prog)#
Destroys an instance of given hiprtcProgram.
If prog is NULL, it will return
HIPRTC_ERROR_INVALID_INPUT
.- See:
- Args:
- Returns:
A
tuple
of size 1 that contains (in that order):
- hip.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_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:
- Args:
- Returns:
A
tuple
of size 2 that contains (in that order):
- hip.hiprtc.hiprtcGetProgramLog(prog, log)#
Gets the log generated by the runtime compilation program instance.
- See:
- Args:
- Returns:
A
tuple
of size 1 that contains (in that order):
- hip.hiprtc.hiprtcGetProgramLogSize(prog)#
Gets the size of log generated by the runtime compilation program instance.
- hip.hiprtc.hiprtcGetCode(prog, code)#
Gets the pointer of compilation binary by the runtime compilation program instance.
- See:
- Args:
- Returns:
A
tuple
of size 1 that contains (in that order):
- hip.hiprtc.hiprtcGetCodeSize(prog)#
Gets the size of compilation binary by the runtime compilation program instance.
- hip.hiprtc.hiprtcGetBitcode(prog, bitcode)#
Gets the pointer of compiled bitcode by the runtime compilation program instance.
- See:
- Args:
- Returns:
A
tuple
of size 1 that contains (in that order):hiprtcResult
: HIPRTC_SUCCESS
- hip.hiprtc.hiprtcGetBitcodeSize(prog)#
Gets the size of compiled bitcode by the runtime compilation program instance.
- hip.hiprtc.hiprtcLinkCreate(unsigned int 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
tuple
of size 2 that contains (in that order):hiprtcResult
:HIPRTC_SUCCESS
,HIPRTC_ERROR_INVALID_INPUT
,HIPRTC_ERROR_INVALID_OPTION
ihiprtcLinkState
:hiprtc link state created upon success
- hip.hiprtc.hiprtcLinkAddFile(hip_link_state, input_type, file_path, unsigned int 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 (
hiprtcJITInputType
) – 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 (
Pointer
/object
) – IN: Array of option values cast to void*
- hip_link_state (
- Returns:
A
tuple
of size 1 that contains (in that order):
- hip.hiprtc.hiprtcLinkAddData(hip_link_state, input_type, image, unsigned long image_size, name, unsigned int 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 (
hiprtcJITInputType
) – 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 (
Pointer
/object
) – IN: Array of option values cast to void*
- hip_link_state (
- Returns:
A
tuple
of size 1 that contains (in that order):
- hip.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
tuple
of size 3 that contains (in that order):
- hip.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
tuple
of size 1 that contains (in that order):