SWDEV-447806 - fix for HIP RTC example re-uses kernel variable

Change-Id: I9a1d18868098225012d01515c60b7bcdbe7bc533
Этот коммит содержится в:
Julia Jiang
2024-07-26 15:29:20 -04:00
коммит произвёл Julia Jiang
родитель 48eab71214
Коммит ffa2f0634f
+8 -8
Просмотреть файл
@@ -6,10 +6,10 @@ Kernels can be stored as a text string and can be passed to HIPRTC APIs alongsid
NOTE:
* This library can be used on systems without HIP installed nor AMD GPU driver installed at all (offline compilation). Therefore, it does not depend on any HIP runtime library.
* But it does depend on comgr. You may try to statically link comgr into HIPRTC to avoid any ambiguity.
* But it does depend on COMGr. You may try to statically link COMGr into HIPRTC to avoid any ambiguity.
* Developers can decide to bundle this library with their application.
## Example
## Compilation APIs
To use HIPRTC functionality, HIPRTC header needs to be included first.
`#include <hip/hiprtc.h>`
@@ -32,12 +32,12 @@ R"(
Now to compile this kernel, it needs to be associated with `hiprtcProgram` type, which is done by declaring `hiprtcProgram prog;` and associating the string of kernel with this program:
```cpp
hiprtcCreateProgram(&prog, // HIPRTC program
kernel, // kernel string
"gpu_kernel.cu", // Name of the file
num_headers, // Number of headers
&header_sources[0], // Header sources
&header_names[0]); // Name of header files
hiprtcCreateProgram(&prog, // HIPRTC program handle
kernel_source, // HIP kernel source string
"vector_add.cpp", // Name of the HIP program, can be null or an empty string
0, // Number of headers
NULL, // Header sources
NULL); // Name of header files
```
`hiprtcCreateProgram` API also allows you to add headers which can be included in your RTC program.