[Openmp-dev] AMDGPU and clang-tools-extra

Ye Luo via Openmp-dev openmp-dev at lists.llvm.org
Wed May 19 19:38:27 PDT 2021


Based on the CMake output, LLVM was found on the machine so LLVM_DIR is set.
However, clang was not found so CLANG_TOOL is NOT-FOUND

if (LLVM_DIR)
  # Builds that use pre-installed LLVM have LLVM_DIR set.
  find_program(CLANG_TOOL clang PATHS ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
  find_program(LINK_TOOL llvm-link PATHS ${LLVM_TOOLS_BINARY_DIR}
    NO_DEFAULT_PATH)
  find_program(OPT_TOOL opt PATHS ${LLVM_TOOLS_BINARY_DIR} NO_DEFAULT_PATH)
  libomptarget_say("Building AMDGCN device RTL. Using clang: ${CLANG_TOOL}")

Use ENABLE_RUNTIMES does workaround this issue as this part is bypassed.

@Jon please take care of the case when any of the find_program fails.

Second issue is libelf. I had this issue in the past when libelf is spack
installed.
libomptarget CMake found libelf library files but didn't check the header
files.
This caused all the complaints about <libelf/libelf.h> not found.
The workaround in my case is apt instal libelf-dev.

I think the libelf search needs to be more robust in libomptarget.

Best,
Ye
===================
Ye Luo, Ph.D.
Computational Science Division & Leadership Computing Facility
Argonne National Laboratory


On Wed, May 19, 2021 at 8:19 PM Itaru Kitayama <itaru.kitayama at gmail.com>
wrote:

> Hi all,
> As the files are too large for the list; I've uploaded them to:
>
> https://github.com/spack/spack/issues/23654
>
> On Thu, May 20, 2021 at 10:14 AM Itaru Kitayama
> <itaru.kitayama at gmail.com> wrote:
> >
> > Hi Ye,
> > https://github.com/ikitayama/spack for-ye , as I need to set
> > ENABLE_RUNTIMES explicitly.
> >
> > $ spack install llvm at main+omp_debug+cuda cuda_arch=80
> >
> > On Thu, May 20, 2021 at 6:53 AM Ye Luo <xw111luoye at gmail.com> wrote:
> > >
> > > -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="openmp"
> > > I think this is what Jon refers to.
> > >
> > > If you have issues building llvm at main in spack. Please provide your
> spack command and attach the following files
> > > spack-build-01-cmake-out.txt
> > > spack-build-02-build-out.txt
> > > from your spack-stage llvm build folder.
> > > Best,
> > > Ye
> > > ===================
> > > Ye Luo, Ph.D.
> > > Computational Science Division & Leadership Computing Facility
> > > Argonne National Laboratory
> > >
> > >
> > > On Wed, May 19, 2021 at 4:34 PM Itaru Kitayama <
> itaru.kitayama at gmail.com> wrote:
> > >>
> > >> Jon, Ye,
> > >> Is this
> > >>
> > >> -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_RUNTIMES="openmp"
> > >>
> > >> correct? I used, and Spack as well, combined them (clang and openmp
> > >> projects) together indeed in ENABLE_PROJECTS.
> > >> On Thu, May 20, 2021 at 5:18 AM Ye Luo via Openmp-dev
> > >> <openmp-dev at lists.llvm.org> wrote:
> > >> >
> > >> > spack install llvm at main does work on my workstation with ubuntu
> 20.04. rocm is installed and amd pieces for OpenMP offload are rebuilt
> properly. I have limited ideas about the experience on other OSes.
> > >> >
> > >> > yeluo at epyc-server:~/opt/llvm-clang/llvm-project$ ls
> /home/packages/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-main-6n25gihrin6rc727fbothf44yq6zbp5a/lib/libomp
> > >> > libomp.so                      libomptarget-amdgcn-gfx803.bc
> libomptarget.rtl.cuda.so
> > >> > libomptarget-amdgcn-gfx700.bc  libomptarget-amdgcn-gfx900.bc
> libomptarget.rtl.x86_64.so
> > >> > libomptarget-amdgcn-gfx701.bc  libomptarget-amdgcn-gfx906.bc
> libomptarget.so
> > >> > libomptarget-amdgcn-gfx801.bc  libomptarget.rtl.amdgpu.so
> > >> >
> > >> > yeluo at epyc-server:~/opt/llvm-clang/llvm-project$ which clang-tidy
> > >> >
> /home/packages/spack/opt/spack/linux-ubuntu20.04-zen2/gcc-10.2.0/llvm-main-6n25gihrin6rc727fbothf44yq6zbp5a/bin/clang-tidy
> > >> >
> > >> > spack uses ENABLE_PROJECTS and doesn't use ENABLE_RUNTIMES right
> now.
> > >> > So the output from building clang-tools-extra and openmp can be
> blended.
> > >> >
> > >> > Best,
> > >> > Ye
> > >> > ===================
> > >> > Ye Luo, Ph.D.
> > >> > Computational Science Division & Leadership Computing Facility
> > >> > Argonne National Laboratory
> > >> >
> > >> >
> > >> > On Wed, May 19, 2021 at 2:22 PM Jon Chesterfield via Openmp-dev <
> openmp-dev at lists.llvm.org> wrote:
> > >> >>>
> > >> >>> Date: Wed, 19 May 2021 15:09:18 +0900
> > >> >>> From: Itaru Kitayama via Openmp-dev <openmp-dev at lists.llvm.org>
> > >> >>> To: openmp-dev <openmp-dev at lists.llvm.org>
> > >> >>> Subject: [Openmp-dev] AMDGPU and clang-tools-extra
> > >> >>> Message-ID:
> > >> >>>         <CANW9uysd4uCQ7j3Jr1qmn2=RPo5a5OGU9e8-vPuuGv=
> P0nAXDQ at mail.gmail.com>
> > >> >>> Content-Type: text/plain; charset="UTF-8"
> > >> >>>
> > >> >>> I am trying to build llvm on main branch with Spack with help
> from Tom, however
> > >> >>> the AMDGPU code does not seem to work well with clang-tools-extra
> > >> >>> project, which
> > >> >>> is added together with the clang project when a Spack build
> initiated.
> > >> >>> Has anyone
> > >> >>> observed an issue with AMDGPU code with tools in upstream?
> > >> >>
> > >> >>
> > >> >> None reported. I don't build clang-tools-extra, seems totally
> independent.
> > >> >>
> > >> >> Are you building openmp with ENABLE_PROJECTS and a clang that
> can't build amdgpu code, instead of ENABLE_RUNTIMES? If so, use
> ENABLE_RUNTIMES, a working clang, or disable the amdgpu library.
> > >> >>
> > >> >> Otherwise, please expand on 'does not seem to work well'.
> > >> >>
> > >> >> Jon
> > >> >> _______________________________________________
> > >> >> Openmp-dev mailing list
> > >> >> Openmp-dev at lists.llvm.org
> > >> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
> > >> >
> > >> > _______________________________________________
> > >> > Openmp-dev mailing list
> > >> > Openmp-dev at lists.llvm.org
> > >> > https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/openmp-dev/attachments/20210519/5ff4b3c9/attachment-0001.html>


More information about the Openmp-dev mailing list