Skip to content

Clang 9 - Tripple amdgcn-amd-amdpal produces incomplete binary #79

Closed
@Lolliedieb

Description

@Lolliedieb

Hello,

I am used to compile my kernels for AMD ROCm platform (Vega 64) with clang-9 using the following call:

clang-9 -x cl -Xclang -finclude-default-header
-target amdgcn-amd-amdhsa -mcpu=gfx900
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/opencl.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/ocml.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/ockl.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/oclc_correctly_rounded_sqrt_off.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/oclc_daz_opt_off.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/oclc_finite_only_off.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/oclc_unsafe_math_off.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/oclc_wavefrontsize64_off.amdgcn.bc
-Xclang -mlink-bitcode-file -Xclang ./opencl/bitcode/oclc_isa_version_900.amdgcn.bc
kernel.cl -o kernel.so

The kernel builds and runs without a problem on ROCm 2.10 (Ubuntu 18.4). Changing the target to amdgcn-amd-amdpal works without any warning or error message, but the resulting binary file is only approx 2/3 the size (196.4 kb vs. 128.1 kb) and the kernels do not run (tested with amdgpu-pro 19.30, also Ubuntu). Disassembling the .so file shows valid gcn asm, but it seems all metadata, kernel names and so on are missing.

I am not sure if this is a bug or if I am doing something wrong - but tried to follow the instructions of the OpenCL back end as close as possible.

Ps: The kernels do not use any inline ASM or similar - its mostly stock OpenCL 1.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions