Seeking Guidance on HSACO File Compilation
Hello author. We are a research team from the School of Computer Science and Technology at Shandong University, currently working on GPU memory optimization. Currently, we are attempting to write our own kernel operators. However, we have encountered an issue while compiling and generating HSACO files. We would greatly appreciate your guidance on the following questions: Question 1: How to compile HSACO files We are facing difficulties in compiling HSACO files. Currently, we are using Clang-12 (included with ROCm v4.2.0) for compilation. The complete command we are using to compile gemm.heaso file is as follows:
clang-12 \
-target amdgcn--amdhsa \
-mcpu=gfx906 \
-x cl \
-cl-std=CL2.0 \
-I/opt/rocm-4.2.0/opencl/include \
-include opencl-c.h \
-Xclang -mlink-builtin-bitcode \
-Xclang /opt/rocm-4.2.0/amdgcn/bitcode/opencl.bc \
gemm.cl \
-o gemm.hsaco
This command or environment configuration seems to be causing discrepancies in the output. We hope you can advise us on the necessary compilation environment and tools, as well as any undocumented critical steps or parameters. Question 2: Regarding the choice of Clang compiler version We noticed that different HSACO files in your project (e.g., gemm.hsaco and kernels.hsaco) appear to have been compiled using different versions of Clang (e.g., Clang-12 and Clang-8). Is it necessary to select a specific Clang version when compiling different kernels? If so, what is the rationale behind this? If you have more detailed compilation documentation, specific environment configuration instructions, or any other relevant resources that you could share, it would be immensely helpful for our work. Thanks
The compiler that has been stable to use is the one in ROCm 3.8. We have been using the ROCm docker image to compile HSACO. Can you try to see if that works. Different clang version may be just because we compiled the binary at different times of development.
The operating system we use is Windows, and it's difficult to configure ROCm3.8 with docker in Windows. Do you use Linux as your operating system or will different operating system affect the configuration of ROCm3.8?
Yes. We have always been using Linux to compile the HSACOs.
We still have some difficulties on compiling the HSACOs .If you can offer us the command you compile the HSACOs, we will appreciate a lot
We have not been creating HSACOs for a long time. What error did you get?