summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/llvm/package.py
diff options
context:
space:
mode:
authorYe Luo <yeluo@anl.gov>2023-05-16 04:20:02 -0500
committerGitHub <noreply@github.com>2023-05-16 11:20:02 +0200
commit54003d4d72c5f77bf228579e56b8e2e421a19bbb (patch)
tree1a954d97d69ab53b0e569a3e2c35d9b1530e7179 /var/spack/repos/builtin/packages/llvm/package.py
parentc47b554fa1fbbd4f4272a0c197d3f68d32c079b9 (diff)
downloadspack-54003d4d72c5f77bf228579e56b8e2e421a19bbb.tar.gz
spack-54003d4d72c5f77bf228579e56b8e2e421a19bbb.tar.bz2
spack-54003d4d72c5f77bf228579e56b8e2e421a19bbb.tar.xz
spack-54003d4d72c5f77bf228579e56b8e2e421a19bbb.zip
Update llvm recipe regarding libomptarget. (#36675)
Diffstat (limited to 'var/spack/repos/builtin/packages/llvm/package.py')
-rw-r--r--var/spack/repos/builtin/packages/llvm/package.py35
1 files changed, 28 insertions, 7 deletions
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")
@@ -108,6 +103,18 @@ class Llvm(CMakePackage, CudaPackage):
"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",
default=True,
@@ -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: