Documentation review and update

Change-Id: If40d096646014d70a198db3532758028abe6a93f


[ROCm/hip commit: b1b099941d]
이 커밋은 다음에 포함됨:
Ben Sander
2016-09-02 09:15:49 -05:00
부모 cac6e516ac
커밋 3f22169885
4개의 변경된 파일과 19개의 추가작업 그리고 19개의 파일을 삭제
+12 -9
파일 보기
@@ -669,20 +669,23 @@ The following C++ features are not supported:
- Try/catch
## Kernel Compilation
HIP now supports compiling C++/HIP kernels to binary. Eventhough HIP does not support fatbinary (yet), the user can specify the target for which the binary can be generated. The file format for binary is `.co` which means Code Object. The following command builds the binary using `hipcc`.
hipcc now supports compiling C++/HIP kernels to binary code objects.
The user can specify the target for which the binary can be generated. HIP/HCC does not yet support fat binaries so only a single target may be specified.
The file format for binary is `.co` which means Code Object. The following command builds the code object using `hipcc`.
`hipcc --genisa --target-isa=[TARGET GPU] [INPUT FILE] -o [OUTPUT FILE]`
`hipcc --genco --target-isa=[TARGET GPU] [INPUT FILE] -o [OUTPUT FILE]`
```[TARGET GPU] = fiji/hawaii
[INPUT FILE] = Name of the file containing kernels
[OUTPUT FILE] = Name of the generated code object file```
Note that the kernel file should have `int main(){}` at the end it so that the binary is generated. This happens because HCC generates binaries at linking time rather than compilation
Note that the kernel file should have `int main(){}` at the end it so that the binary is generated. This happens because HCC generates binaries at linking time rather than compilation.
You need 3 things to run kernel in binary.
1. Kernel Binary
2. Name of kernel binary
3. Name of the kernel
We already got first two of them. In order to get name of the kernel, try `objdump -x [OUTPUT FILE]`. OUTPUT FILE is file generated by hipcc during kernel compilation. The output from objdump has symbol to the kernel whose name is mangled with `grid_launch_parm`, `__functor`, `__cxxamp_trampoline`. An example of how it looks is `ZN12_GLOBAL__N_137_Z3Cpy16grid_launch_parmPfS0__functor19__cxxamp_trampolineEiiiiiiPKfPf` where `Cpy` is the name of the kernel written in C++.
To load a kernel into HIP, we need both the code object and the name of the kernel stored within the code object.
In order to get name of the kernel, use:
```
$ objdump -x [CODE_OBJECT_FILE]`.
```
CODE_OBJECT_FILE is file generated by hipcc during kernel compilation. The output from objdump has symbol to the kernel whose name is mangled with `grid_launch_parm`, `__functor`, `__cxxamp_trampoline`. An example of how it looks is `ZN12_GLOBAL__N_137_Z3Cpy16grid_launch_parmPfS0__functor19__cxxamp_trampolineEiiiiiiPKfPf` where `Cpy` is the name of the kernel written in C++. The hipLoadKernelModule API needs to specify this mangled name on the HIP/hcc path.