From 54003d4d72c5f77bf228579e56b8e2e421a19bbb Mon Sep 17 00:00:00 2001 From: Ye Luo Date: Tue, 16 May 2023 04:20:02 -0500 Subject: Update llvm recipe regarding libomptarget. (#36675) --- var/spack/repos/builtin/packages/llvm/package.py | 35 +++++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index f62822e3ca..01fa8f0f2f 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -88,11 +88,6 @@ class Llvm(CMakePackage, CudaPackage): description="Build the LLVM Fortran compiler frontend " "(experimental - parser only, needs GCC)", ) - variant( - "omp_debug", - default=False, - description="Include debugging code in OpenMP runtime libraries", - ) variant("lldb", default=True, when="+clang", description="Build the LLVM debugger") variant("lld", default=True, description="Build the LLVM linker") variant("mlir", default=False, when="@10:", description="Build with MLIR support") @@ -107,6 +102,18 @@ class Llvm(CMakePackage, CudaPackage): variant( "libcxx", default=True, when="+clang", description="Build the LLVM C++ standard library" ) + variant( + "libomptarget", + default=True, + when="+clang", + description="Build the OpenMP offloading library", + ) + variant( + "omp_debug", + default=False, + when="+libomptarget", + description="Include debugging code in OpenMP runtime libraries", + ) variant( "compiler-rt", when="+clang", @@ -132,7 +139,7 @@ class Llvm(CMakePackage, CudaPackage): ) variant( "targets", - default="none", + default="all", description=( "What targets to build. Spack's target family is always added " "(e.g. X86 is automatically enabled when targeting znver2)." @@ -230,7 +237,7 @@ class Llvm(CMakePackage, CudaPackage): depends_on("hwloc") depends_on("hwloc@2.0.1:", when="@9:") depends_on("elf", when="+cuda") # libomptarget - depends_on("libffi", when="+cuda") # libomptarget + depends_on("libffi", when="+libomptarget") # libomptarget # llvm-config --system-libs libraries. depends_on("zlib") @@ -272,6 +279,15 @@ class Llvm(CMakePackage, CudaPackage): conflicts("%clang@:10", when="@13:+libcxx") conflicts("%apple-clang@:11", when="@13:+libcxx") + # libomptarget + conflicts("+cuda", when="@15:") # +cuda variant is obselete since LLVM 15 + conflicts( + "targets=none", + when="+libomptarget", + msg="Non-host backends needed for offloading, set targets=all", + ) + conflicts("~lld", when="+libomptarget") + # cuda_arch value must be specified conflicts("cuda_arch=none", when="+cuda", msg="A value for cuda_arch must be specified.") @@ -644,6 +660,11 @@ class Llvm(CMakePackage, CudaPackage): else: projects.append("openmp") + if "+libomptarget" in spec: + cmake_args.append(define("OPENMP_ENABLE_LIBOMPTARGET", True)) + else: + cmake_args.append(define("OPENMP_ENABLE_LIBOMPTARGET", False)) + if "@8" in spec: cmake_args.append(from_variant("CLANG_ANALYZER_ENABLE_Z3_SOLVER", "z3")) elif "@9:" in spec: -- cgit v1.2.3-60-g2f50