[llvm-dev] Trying to build clang-13 for openmp target offload

Jost, Gabriele (ARC-TNC)[Supersmith] via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 22 16:15:50 PDT 2021


Hello,
I am trying to build clang-13 with support for OpenMP target offload to Nvidia GPUS.
I can build clang, but it stubbornly refuses to build the openmpRTL, I get this in the cmake output:

- Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_V
EO_INCLUDE_DIRS)
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building AMDGPU plugin for dlopened libhsa
-- LIBOMPTARGET: Not generating amdgcn test targets as amdgpu-arch is not found
-- LIBOMPTARGET: Building CUDA offloading plugin.
-- LIBOMPTARGET: Building CUDA plugin linked against libcuda
-- LIBOMPTARGET: Enable tests using CUDA plugin
-- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not found.
-- LIBOMPTARGET: Not building x86_64 offloading plugin: libffi dependency not found.
-- LIBOMPTARGET: Building AMDGCN device RTL. Using clang from in-tree build
-- LIBOMPTARGET: Not building NVPTX deviceRTL: clang not found
-- LIBOMPTARGET: Not building NVPTX deviceRTL: clang not found
-- LIBOMPTARGET: Building the llvm-omp-device-info tool

So, it wants an existig clang. I already have a clang built, I tried to use the old clang rather than gcc, but that lead to other errors.
The AMDGCM RTL is built using the in-tree clang. Is there a way to do the same for nvptx?

I has also tried a 2-step approach, building the deviceRTL seperately, but then it complaints about some previously built tools.

Have you encountered such a situation before and can maybe provide some guidance?

Here is the cmake I am using:
CMAKE_OPTIONS="\
    -DLLVM_ENABLE_PROJECTS=clang \
    -DLLVM_ENABLE_RUNTIMES=openmp;compiler-rt \
    -DLLVM_TARGETS_TO_BUILD=X86;NVPTX \
    -DCMAKE_LIBRARY_PATH='${LD_LIBRARY_PATH};/lib64;${CUDA_PATH}/lib64/stubs' \
    -DLIBOMPTARGET_DEP_LIBELF_LIBRARIES:FILEPATH=/usr/lib64/libelf.so.1 \
    -DLIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR=/usr/include \
    -DLIBOMPTARGET_DEP_LIBFFI_INCLUDE_DIR=/usr/include:${CLANG}/extra-includes \
    -DFFI_INCLUDE_DIR:PATH=/usr/include \
    -DLIBOMPTARGET_DEP_LIBFFI_LIBRARIES=${CLANG}/extra-libs/libffi.so \
    -DCMAKE_C_COMPILER=gcc\
    -DCMAKE_CXX_COMPILER=g++ \
    -DLLVM_ENABLE_BACKTRACES=ON \
    -DLLVM_ENABLE_WERROR=OFF \
    -DLLVM_ENABLE_RTTI=ON \
    -DLIBOMP_FORTRAN_MODULES=ON \
    -DOPENMP_ENABLE_LIBOMPTARGET=ON \
    -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=35,60,70 \
    -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_${COMPUTE_CAPABILITY}"


Gabriele Jost

************************************************************************
Gabriele Jost       NASA Ames Research Center
Email: Gabriele.Jost at nasa.gov      Mail Stop 258-6
Work Phone: (650) 604-0468         Bldg. 258, Rm. 232-4
Scientific & HPC Application           P.O. Box 1
Development/Optimization            Moffett Field, CA 94035-0001
************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20211022/91793694/attachment.html>


More information about the llvm-dev mailing list