Skip to content

Seeking Guidance on HSACO File Compilation #223

@jianqiao673

Description

@jianqiao673

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions