SWDEV-384013 - Add HIPRTC_JIT_IR_TO_ISA_OPT_EXT header changes (#3176)

Change-Id: Ie466cd02f2aed30e1568c4d76d60c9048af0fe4c

[ROCm/hip commit: fdc00547cb]
This commit is contained in:
ROCm CI Service Account
2023-03-06 21:11:39 +05:30
committed by GitHub
parent d3152b1415
commit c808e5394f
2 changed files with 61 additions and 39 deletions
+18 -2
View File
@@ -159,13 +159,13 @@ hiprtcLinkComplete(rtc_link_state, // hiprtc link state
If the hiprtcLinkComplete returns successfully, the generated binary can be loaded and run using the hipModule* APIs.
```cpp
hipModuleLoadData( &module, binary );
hipModuleLoadData(&module, binary);
```
#### Note
- The compiled binary must be loaded before hiprtc link instance is destroyed using the hiprtcLinkDestroy API.
```cpp
hiprtcLinkDestroy( rtc_link_state);
hiprtcLinkDestroy(rtc_link_state);
```
- The correct sequence of calls is : hiprtcLinkCreate, hiprtcLinkAddData or hiprtcLinkAddFile, hiprtcLinkComplete, hiprtcModuleLoadData, hiprtcLinkDestroy.
@@ -186,6 +186,22 @@ HIPRTC_JIT_INPUT_LLVM_ARCHIVES_OF_BUNDLED_BITCODE = 102,
HIPRTC_JIT_NUM_INPUT_TYPES = (HIPRTC_JIT_NUM_LEGACY_INPUT_TYPES + 3)
```
#### Link Options
- `HIPRTC_JIT_IR_TO_ISA_OPT_EXT` - AMD Only. Options to be passed on to link step of compiler by `hiprtcLinkCreate`.
- `HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT` - AMD Only. Count of options passed on to link step of compiler.
Example:
```cpp
const char* isaopts[] = {"-mllvm", "-inline-threshold=1", "-mllvm", "-inlinehint-threshold=1"};
std::vector<hiprtcJIT_option> jit_options = {HIPRTC_JIT_IR_TO_ISA_OPT_EXT,
HIPRTC_JIT_IR_TO_ISA_OPT_COUNT_EXT};
size_t isaoptssize = 4;
const void* lopts[] = {(void*)isaopts, (void*)(isaoptssize)};
hiprtcLinkState linkstate;
hiprtcLinkCreate(2, jit_options.data(), (void**)lopts, &linkstate);
```
## Error Handling
HIPRTC defines the hiprtcResult enumeration type and a function hiprtcGetErrorString for API call error handling. hiprtcResult enum defines the API result codes. HIPRTC APIs return hiprtcResult to indicate the call result. hiprtcGetErrorString function returns a string describing the given hiprtcResult code, e.g., HIPRTC_SUCCESS to "HIPRTC_SUCCESS". For unrecognized enumeration values, it returns "Invalid HIPRTC error code".