Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Question: Running amdgcn-compiled code on a Mac #19

Description

@lancelet

Is it possible to run code compiled with the amdgcn llvm backend on macOS?

When I use Apple's openclc compiler, I get code I can load using clCreateProgramWithBinary:

/System/Library/Frameworks/OpenCL.framework/Libraries/openclc \
    -c -emit-llvm -arch gpu_32 \
    -o <output>.bc <input>.cl

However, compiling for the amdgcn back-end using clang-5.0.0 produces a [CL_BUILD_ERROR] : OpenCL Build Error : Compiler build log:\nUnknown bitstream version!\n with clCreateProgramWithBinary:

clang -c -cl-std=CL1.2       \
    -arch amdgcn             \
    -emit-llvm               \
    -Xclang                  \
    -finclude-default-header \
    -o <output>.bc <input>.cl

The two files look somewhat similar, so I'm wondering if there's anything I'm missing, or whether it's just that there's no way to run this code on a Mac.

Hex dump of the start of the Apple <output>.bc:

00000000  de c0 17 0b 00 00 00 00  14 00 00 00 b0 04 00 00  |................|
00000010  ff ff ff ff 42 43 c0 de  21 0c 00 00 29 01 00 00  |....BC..!...)...|
...

Hex dump of the start of the amdgcn <output.bc>:

00000000  de c0 17 0b 00 00 00 00  14 00 00 00 50 0c 00 00  |............P...|
00000010  ff ff ff ff 42 43 c0 de  35 14 00 00 05 00 00 00  |....BC..5.......|
...

(BTW: I'm trying to use clCreateProgramWithBinary with an AMD Radeon Pro 460, which AFAICT, is supported by amdgcn.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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