Error when attempting basic OpenMP configure & build

I’m attempting to build OpenMP from source following the instructions here: llvm-project/openmp at main · llvm/llvm-project · GitHub

I use this cmake call to configure & build:

cd llvm/openmp
mkdir build && cd build
cmake --build .

When I do this, I get an error about an unknown target CPU:

[  9%] Building LLVM bitcode Workshare.cpp-gfx1036.bc
error: unknown target CPU 'gfx1036'
note: valid target CPU values are: gfx600, tahiti, gfx601, pitcairn, verde, gfx602, hainan, oland, gfx700, kaveri, gfx701, hawaii, gfx702, gfx703, kabini, mullins, gfx704, bonaire, gfx705, gfx801, carrizo, gfx802, iceland, tonga, gfx803, fiji, polaris10, polaris11, gfx805, tongapro, gfx810, stoney, gfx900, gfx902, gfx904, gfx906, gfx908, gfx909, gfx90a, gfx90c, gfx1010, gfx1011, gfx1012, gfx1013, gfx1030, gfx1031, gfx1032, gfx1033, gfx1034, gfx1035
make[2]: *** [libomptarget/DeviceRTL/CMakeFiles/omptarget-amdgpu-gfx1036-bc.dir/build.make:244: libomptarget/DeviceRTL/Workshare.cpp-gfx1036.bc] Error 1
make[1]: *** [CMakeFiles/Makefile2:2110: libomptarget/DeviceRTL/CMakeFiles/omptarget-amdgpu-gfx1036-bc.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

I’m using cmake version 3.23.1 and clang version 13.0.1.

Can anyone advise what I might be doing wrong here? Apologies if this is a trivial question.



Please refer to Support, Getting Involved, and FAQ — LLVM/OpenMP 15.0.0git documentation for more details on how to build OpenMP with target offloading support.
If you don’t need the feature, then you could disable them via CMake argument -DENABLE_LIBOMPTARGET=OFF.

For your specific case, it is because your clang doesn’t support those GPU arch that were added in recent version. Internally, if the compiler is clang, by default we will proceed to build everything. We don’t check the compatibility of the clang, which is a problem here. We are improving it, at least have the plan to do so.

Generally, we assume that the build of OpenMP requires LLVM of the same version. The version here means commit id. We don’t assume backward compatibility. If you want to use standalone build, which I’m also using that, you could first build LLVM/Clang, and then use that to build OpenMP standalone.

1 Like