From fb4e1cad4529d3d7583f7e083470e062491efc97 Mon Sep 17 00:00:00 2001 From: Greg Becker Date: Wed, 3 Apr 2024 15:34:23 -0700 Subject: [PATCH] remove dpcpp compiler and package (#43418) `dpcpp` is deprecated by intel and has been superseded by `oneapi` compilers for a very long time. --------- Co-authored-by: becker33 --- lib/spack/env/cc | 5 +- lib/spack/spack/build_systems/autotools.py | 5 - lib/spack/spack/compilers/dpcpp.py | 34 ---- .../repos/builtin/packages/amrex/package.py | 5 +- .../double-batched-fft-library/package.py | 6 +- .../repos/builtin/packages/dpcpp/package.py | 166 ------------------ .../ginkgo/1.4.0_dpcpp_use_old_standard.patch | 70 -------- .../repos/builtin/packages/ginkgo/package.py | 6 +- .../repos/builtin/packages/hypre/package.py | 5 +- .../intel-oneapi-compilers/package.py | 5 +- .../repos/builtin/packages/kokkos/package.py | 1 - .../repos/builtin/packages/onednn/package.py | 3 +- 12 files changed, 13 insertions(+), 298 deletions(-) delete mode 100644 lib/spack/spack/compilers/dpcpp.py delete mode 100644 var/spack/repos/builtin/packages/dpcpp/package.py delete mode 100644 var/spack/repos/builtin/packages/ginkgo/1.4.0_dpcpp_use_old_standard.patch diff --git a/lib/spack/env/cc b/lib/spack/env/cc index f72a6663a3..6c4db38ba1 100755 --- a/lib/spack/env/cc +++ b/lib/spack/env/cc @@ -248,7 +248,7 @@ case "$command" in lang_flags=C debug_flags="-g" ;; - c++|CC|g++|clang++|armclang++|icpc|icpx|dpcpp|pgc++|nvc++|xlc++|xlc++_r|FCC|amdclang++|crayCC) + c++|CC|g++|clang++|armclang++|icpc|icpx|pgc++|nvc++|xlc++|xlc++_r|FCC|amdclang++|crayCC) command="$SPACK_CXX" language="C++" comp="CXX" @@ -526,7 +526,7 @@ categorize_arguments() { continue fi - replaced="$after$stripped" + replaced="$after$stripped" # it matched, remove it shift @@ -913,4 +913,3 @@ fi # Execute the full command, preserving spaces with IFS set # to the alarm bell separator. IFS="$lsep"; exec $full_command_list - diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index 1f44ebf137..ce4d6bc279 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -434,11 +434,6 @@ def _do_patch_libtool(self): r"crtendS\.o", ]: x.filter(regex=(rehead + o), repl="") - elif self.pkg.compiler.name == "dpcpp": - # Hack to filter out spurious predep_objects when building with Intel dpcpp - # (see https://github.com/spack/spack/issues/32863): - x.filter(regex=r"^(predep_objects=.*)/tmp/conftest-[0-9A-Fa-f]+\.o", repl=r"\1") - x.filter(regex=r"^(predep_objects=.*)/tmp/a-[0-9A-Fa-f]+\.o", repl=r"\1") elif self.pkg.compiler.name == "nag": for tag in ["fc", "f77"]: marker = markers[tag] diff --git a/lib/spack/spack/compilers/dpcpp.py b/lib/spack/spack/compilers/dpcpp.py deleted file mode 100644 index 392817fd39..0000000000 --- a/lib/spack/spack/compilers/dpcpp.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -import os - -import spack.compilers.oneapi - - -class Dpcpp(spack.compilers.oneapi.Oneapi): - """This is the same as the oneAPI compiler but uses dpcpp instead of - icpx (for DPC++ source files). It explicitly refers to dpcpp, so that - CMake test files which check the compiler name (e.g. CMAKE_CXX_COMPILER) - detect it as dpcpp. - - Ideally we could switch out icpx for dpcpp where needed in the oneAPI - compiler definition, but two things are needed for that: (a) a way to - tell the compiler that it should be using dpcpp and (b) a way to - customize the link_paths - - See also: https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-setup/using-the-command-line/invoking-the-compiler.html - """ - - # Subclasses use possible names of C++ compiler - cxx_names = ["dpcpp"] - - # Named wrapper links within build_env_path - link_paths = { - "cc": os.path.join("oneapi", "icx"), - "cxx": os.path.join("oneapi", "dpcpp"), - "f77": os.path.join("oneapi", "ifx"), - "fc": os.path.join("oneapi", "ifx"), - } diff --git a/var/spack/repos/builtin/packages/amrex/package.py b/var/spack/repos/builtin/packages/amrex/package.py index ec976c8adb..ab2f2910f0 100644 --- a/var/spack/repos/builtin/packages/amrex/package.py +++ b/var/spack/repos/builtin/packages/amrex/package.py @@ -300,11 +300,10 @@ def cmake_args(self): if "+sycl" in self.spec: args.append("-DAMReX_GPU_BACKEND=SYCL") # SYCL GPU backend only supported with Intel's oneAPI or DPC++ compilers - sycl_compatible_compilers = ["dpcpp", "icpx"] + sycl_compatible_compilers = ["icpx"] if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): raise InstallError( - "AMReX's SYCL GPU Backend requires DPC++ (dpcpp)" - + " or the oneAPI CXX (icpx) compiler." + "AMReX's SYCL GPU Backend requires the oneAPI CXX (icpx) compiler." ) return args diff --git a/var/spack/repos/builtin/packages/double-batched-fft-library/package.py b/var/spack/repos/builtin/packages/double-batched-fft-library/package.py index c420275d54..bfee55f033 100644 --- a/var/spack/repos/builtin/packages/double-batched-fft-library/package.py +++ b/var/spack/repos/builtin/packages/double-batched-fft-library/package.py @@ -41,10 +41,8 @@ class DoubleBatchedFftLibrary(CMakePackage): def cmake_args(self): cxx_compiler = os.path.basename(self.compiler.cxx) - if self.spec.satisfies("+sycl") and cxx_compiler not in ["icpx", "dpcpp"]: - raise InstallError( - "The Double-Batched FFT Library requires the oneapi DPC++/C++ Compiler" - ) + if self.spec.satisfies("+sycl") and cxx_compiler not in ["icpx"]: + raise InstallError("The Double-Batched FFT Library requires the oneapi C++ Compiler") return [ self.define_from_variant("BUILD_SHARED_LIBS", "shared"), diff --git a/var/spack/repos/builtin/packages/dpcpp/package.py b/var/spack/repos/builtin/packages/dpcpp/package.py deleted file mode 100644 index 4fa5a00abb..0000000000 --- a/var/spack/repos/builtin/packages/dpcpp/package.py +++ /dev/null @@ -1,166 +0,0 @@ -# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - - -import os - -from spack.package import * - - -class Dpcpp(CMakePackage): - """Data Parallel C++ compiler: Intel's implementation of SYCL programming model""" - - homepage = "https://intel.github.io/llvm-docs/" - git = "https://github.com/intel/llvm.git" - - license("Apache-2.0") - - version("develop", branch="sycl") - version("2021.09", commit="bd68232bb96386bf7649345c0557ba520e73c02d") - version("2021.12", commit="27f59d8906fcc8aece7ff6aa570ccdee52168c2d") - - maintainers("ravil-mobile") - variant("cuda", default=False, description="switch from OpenCL to CUDA") - variant("rocm", default=False, description="switch from OpenCL to ROCm") - variant( - "rocm-platform", - default="AMD", - values=("AMD", "NVIDIA"), - multi=False, - description="choose ROCm backend", - ) - variant("openmp", default=False, description="build with OpenMP without target offloading") - variant("esimd-cpu", default=False, description="build with ESIMD_CPU support") - variant("assertions", default=False, description="build with assertions") - variant("docs", default=False, description="build Doxygen documentation") - variant("werror", default=False, description="treat warnings as errors") - variant("shared", default=False, description="build shared libraries") - variant("remangle_libclc", default=True, description="remangle libclc gen. variants") - variant("lld", default=False, description="use LLD linker for build") - - depends_on("cmake@3.16.2:", type="build") - depends_on("ninja@1.10.0:", type="build") - - depends_on("cuda@10.2.0:11.4.999", when="+cuda") - - # NOTE: AMD HIP needs to be tested; it will be done in the next update - # depends_on('cuda@10.2.0:10.2.999', when='rocm-platform=NVIDIA', type='build') - # depends_on('hip@4.0.0:', when='+rocm', type='build') - - root_cmakelists_dir = "llvm" - - def cmake_args(self): - llvm_external_projects = "sycl;llvm-spirv;opencl;libdevice;xpti;xptifw" - - if "+openmp" in self.spec: - llvm_external_projects += ";openmp" - - sycl_dir = os.path.join(self.stage.source_path, "sycl") - spirv_dir = os.path.join(self.stage.source_path, "llvm-spirv") - xpti_dir = os.path.join(self.stage.source_path, "xpti") - xptifw_dir = os.path.join(self.stage.source_path, "xptifw") - libdevice_dir = os.path.join(self.stage.source_path, "libdevice") - llvm_enable_projects = "clang;" + llvm_external_projects - libclc_targets_to_build = "" - sycl_build_pi_rocm_platform = self.spec.variants["rocm-platform"].value - - if self.spec.satisfies("target=x86_64:"): - llvm_targets_to_build = "X86" - elif self.spec.satisfies("target=aarch64:"): - llvm_targets_to_build = "ARM;AArch64" - else: - raise InstallError( - "target is not supported. " "This package only works on x86_64 or aarch64" - ) - - is_cuda = "+cuda" in self.spec - is_rocm = "+rocm" in self.spec - - if is_cuda or is_rocm: - llvm_enable_projects += ";libclc" - - if is_cuda: - llvm_targets_to_build += ";NVPTX" - libclc_targets_to_build = "nvptx64--;nvptx64--nvidiacl" - - if is_rocm: - if sycl_build_pi_rocm_platform == "AMD": - llvm_targets_to_build += ";AMDGPU" - libclc_targets_to_build += ";amdgcn--;amdgcn--amdhsa" - elif sycl_build_pi_rocm_platform and not is_cuda: - llvm_targets_to_build += ";NVPTX" - libclc_targets_to_build += ";nvptx64--;nvptx64--nvidiacl" - - args = [ - self.define_from_variant("LLVM_ENABLE_ASSERTIONS", "assertions"), - self.define("LLVM_TARGETS_TO_BUILD", llvm_targets_to_build), - self.define("LLVM_EXTERNAL_PROJECTS", llvm_external_projects), - self.define("LLVM_EXTERNAL_SYCL_SOURCE_DIR", sycl_dir), - self.define("LLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR", spirv_dir), - self.define("LLVM_EXTERNAL_XPTI_SOURCE_DIR", xpti_dir), - self.define("XPTI_SOURCE_DIR", xpti_dir), - self.define("LLVM_EXTERNAL_XPTIFW_SOURCE_DIR", xptifw_dir), - self.define("LLVM_EXTERNAL_LIBDEVICE_SOURCE_DIR", libdevice_dir), - self.define("LLVM_ENABLE_PROJECTS", llvm_enable_projects), - self.define("LIBCLC_TARGETS_TO_BUILD", libclc_targets_to_build), - self.define_from_variant("SYCL_BUILD_PI_CUDA", "cuda"), - self.define_from_variant("SYCL_BUILD_PI_ROCM", "rocm"), - self.define("SYCL_BUILD_PI_ROCM_PLATFORM", sycl_build_pi_rocm_platform), - self.define("LLVM_BUILD_TOOLS", True), - self.define_from_variant("SYCL_ENABLE_WERROR", "werror"), - self.define("SYCL_INCLUDE_TESTS", True), - self.define_from_variant("LIBCLC_GENERATE_REMANGLED_VARIANTS", "remangle_libclc"), - self.define_from_variant("LLVM_ENABLE_DOXYGEN", "docs"), - self.define_from_variant("LLVM_ENABLE_SPHINX", "docs"), - self.define_from_variant("BUILD_SHARED_LIBS", "shared"), - self.define("SYCL_ENABLE_XPTI_TRACING", "ON"), - self.define_from_variant("LLVM_ENABLE_LLD", "lld"), - self.define_from_variant("SYCL_BUILD_PI_ESIMD_CPU", "esimd-cpu"), - ] - - if is_cuda or (is_rocm and sycl_build_pi_rocm_platform == "NVIDIA"): - args.append(self.define("CUDA_TOOLKIT_ROOT_DIR", self.spec["cuda"].prefix)) - - if "+openmp" in self.spec: - omp_dir = os.path.join(self.stage.source_path, "openmp") - args.extend( - [ - self.define("LLVM_EXTERNAL_OPENMP_SOURCE_DIR", omp_dir), - self.define("OPENMP_ENABLE_LIBOMPTARGET", False), - ] - ) - - if self.compiler.name == "gcc": - gcc_prefix = ancestor(self.compiler.cc, 2) - args.append(self.define("GCC_INSTALL_PREFIX", gcc_prefix)) - - return args - - def setup_build_environment(self, env): - if "+cuda" in self.spec: - env.set("CUDA_LIB_PATH", "{0}/lib64/stubs".format(self.spec["cuda"].prefix)) - - @run_after("install") - def post_install(self): - clang_cpp_path = os.path.join(self.spec.prefix.bin, "clang++") - dpcpp_path = os.path.join(self.spec.prefix.bin, "dpcpp") - - real_clang_cpp_path = os.path.realpath(clang_cpp_path) - os.symlink(real_clang_cpp_path, dpcpp_path) - - def setup_run_environment(self, env): - bin_path = self.spec.prefix.bin - for env_var_name, compiler in zip(["CC", "CXX"], ["clang", "clang++"]): - env.set(env_var_name, os.path.join(bin_path, compiler)) - - include_env_vars = ["C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", "INCLUDE"] - for var in include_env_vars: - env.prepend_path(var, self.prefix.include) - env.prepend_path(var, self.prefix.include.sycl) - - sycl_build_pi_rocm_platform = self.spec.variants["rocm-platform"].value - if "+cuda" in self.spec or sycl_build_pi_rocm_platform == "NVIDIA": - env.prepend_path("PATH", self.spec["cuda"].prefix.bin) - env.set("CUDA_TOOLKIT_ROOT_DIR", self.spec["cuda"].prefix) diff --git a/var/spack/repos/builtin/packages/ginkgo/1.4.0_dpcpp_use_old_standard.patch b/var/spack/repos/builtin/packages/ginkgo/1.4.0_dpcpp_use_old_standard.patch deleted file mode 100644 index 54ed07c22d..0000000000 --- a/var/spack/repos/builtin/packages/ginkgo/1.4.0_dpcpp_use_old_standard.patch +++ /dev/null @@ -1,70 +0,0 @@ -commit 83164570f0d3511d114114bcc2b02ad23b753ed0 -Author: Yuhsiang M. Tsai -Date: Wed Oct 6 16:33:16 2021 +0200 - - syclstd 1.2.1 in new release to propagate subgroup - remove 64 subgroup in dense to avoid conj_trans issue on cpu temporarily - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index ceb269b1cb..b47388a596 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -67,7 +67,8 @@ if(MSVC) - elseif(GINKGO_BUILD_DPCPP OR CMAKE_CXX_COMPILER MATCHES "dpcpp") - # For now always use `-ffp-model=precise` with DPC++. This can be removed when - # the floating point issues are fixed. -- set(GINKGO_COMPILER_FLAGS "-Wpedantic;-ffp-model=precise" CACHE STRING -+ # -sycl-std=1.2.1 (or -sycl-std=2017) is temporary workaround after 2021.4 to propagate subgroup setting correctly -+ set(GINKGO_COMPILER_FLAGS "-Wpedantic;-ffp-model=precise;-sycl-std=1.2.1" CACHE STRING - "Set the required CXX compiler flags, mainly used for warnings. Current default is `-Wpedantic;-ffp-model=precise`") - else() - set(GINKGO_COMPILER_FLAGS "-Wpedantic" CACHE STRING -diff --git a/cmake/create_test.cmake b/cmake/create_test.cmake -index 9d22406f9a..dcc452b293 100644 ---- a/cmake/create_test.cmake -+++ b/cmake/create_test.cmake -@@ -40,6 +40,7 @@ function(ginkgo_create_dpcpp_test test_name) - add_executable(${test_target_name} ${test_name}.dp.cpp) - target_compile_features(${test_target_name} PUBLIC cxx_std_17) - target_compile_options(${test_target_name} PRIVATE "${GINKGO_DPCPP_FLAGS}") -+ target_compile_options(${test_target_name} PRIVATE "${GINKGO_COMPILER_FLAGS}") - target_link_options(${test_target_name} PRIVATE -fsycl-device-code-split=per_kernel) - ginkgo_set_test_target_properties(${test_name} ${test_target_name}) - # Note: MKL_ENV is empty on linux. Maybe need to apply MKL_ENV to all test. -diff --git a/dpcpp/CMakeLists.txt b/dpcpp/CMakeLists.txt -index fee9ec3639..ce71fd5d3c 100644 ---- a/dpcpp/CMakeLists.txt -+++ b/dpcpp/CMakeLists.txt -@@ -68,6 +68,7 @@ target_compile_definitions(ginkgo_dpcpp PRIVATE GKO_COMPILING_DPCPP) - - set(GINKGO_DPCPP_FLAGS ${GINKGO_DPCPP_FLAGS} PARENT_SCOPE) - target_compile_options(ginkgo_dpcpp PRIVATE "${GINKGO_DPCPP_FLAGS}") -+target_compile_options(ginkgo_dpcpp PRIVATE "${GINKGO_COMPILER_FLAGS}") - # Note: add MKL as PRIVATE not PUBLIC (MKL example shows) to avoid propagating - # find_package(MKL) everywhere when linking ginkgo (see the MKL example - # https://software.intel.com/content/www/us/en/develop/documentation/onemkl-windows-developer-guide/top/getting-started/cmake-config-for-onemkl.html) -diff --git a/dpcpp/matrix/dense_kernels.dp.cpp b/dpcpp/matrix/dense_kernels.dp.cpp -index 0c89530d1d..9a86ab9cd1 100644 ---- a/dpcpp/matrix/dense_kernels.dp.cpp -+++ b/dpcpp/matrix/dense_kernels.dp.cpp -@@ -69,14 +69,14 @@ namespace dpcpp { - namespace dense { - - -+// Disable the 64 subgroup. CPU supports 64 now, but conj_transpose will -+// lead CL_OUT_OF_RESOURCES. TODO: investigate this issue. - using KCFG_1D = ConfigSet<11, 7>; - constexpr auto kcfg_1d_list = -- syn::value_list(); --constexpr auto subgroup_list = -- syn::value_list(); -+ syn::value_list(); -+constexpr auto subgroup_list = syn::value_list(); - constexpr auto kcfg_1d_array = syn::as_array(kcfg_1d_list); - constexpr int default_block_size = 256; - diff --git a/var/spack/repos/builtin/packages/ginkgo/package.py b/var/spack/repos/builtin/packages/ginkgo/package.py index c17485d93a..4e063cd9d2 100644 --- a/var/spack/repos/builtin/packages/ginkgo/package.py +++ b/var/spack/repos/builtin/packages/ginkgo/package.py @@ -121,7 +121,7 @@ def setup_build_environment(self, env): env.set("MKLROOT", join_path(spec["intel-oneapi-mkl"].prefix, "mkl", "latest")) env.set("DPL_ROOT", join_path(spec["intel-oneapi-dpl"].prefix, "dpl", "latest")) # The `IntelSYCLConfig.cmake` is broken with spack. By default, it - # relies on the CMAKE_CXX_COMPILER being the real ipcx/dpcpp + # relies on the CMAKE_CXX_COMPILER being the real ipcx # compiler. If not, the variable SYCL_COMPILER of that script is # broken, and all the SYCL detection mechanism is wrong. We fix it # by giving hint environment variables. @@ -200,9 +200,9 @@ def cmake_args(self): ) if "+sycl" in self.spec: - sycl_compatible_compilers = ["dpcpp", "icpx"] + sycl_compatible_compilers = ["icpx"] if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): - raise InstallError("ginkgo +sycl requires DPC++ (dpcpp) or icpx compiler.") + raise InstallError("ginkgo +sycl requires icpx compiler.") return args @property diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index e0e28f374b..f61cba9cc0 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -286,11 +286,10 @@ def configure_args(self): if spec.satisfies("+sycl"): configure_args.append("--with-sycl") - sycl_compatible_compilers = ["dpcpp", "icpx"] + sycl_compatible_compilers = ["icpx"] if not (os.path.basename(self.compiler.cxx) in sycl_compatible_compilers): raise InstallError( - "Hypre's SYCL GPU Backend requires DPC++ (dpcpp)" - + " or the oneAPI CXX (icpx) compiler." + "Hypre's SYCL GPU Backend requires the oneAPI CXX (icpx) compiler." ) if spec.satisfies("+unified-memory"): diff --git a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py index 7eb40c7e6a..bff6586460 100644 --- a/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py +++ b/var/spack/repos/builtin/packages/intel-oneapi-compilers/package.py @@ -223,10 +223,7 @@ @IntelOneApiPackage.update_description class IntelOneapiCompilers(IntelOneApiPackage): - """Intel oneAPI Compilers. Includes: icc, icpc, ifort, icx, icpx, ifx, - and dpcpp. - - """ + """Intel oneAPI Compilers. Includes: icc, icpc, ifort, icx, icpx, and ifx.""" maintainers("rscohn2") diff --git a/var/spack/repos/builtin/packages/kokkos/package.py b/var/spack/repos/builtin/packages/kokkos/package.py index 0f994087d2..878b9e249e 100644 --- a/var/spack/repos/builtin/packages/kokkos/package.py +++ b/var/spack/repos/builtin/packages/kokkos/package.py @@ -64,7 +64,6 @@ class Kokkos(CMakePackage, CudaPackage, ROCmPackage): conflicts("+openmptarget", when="@:3.5") # https://github.com/spack/spack/issues/29052 - conflicts("@:3.5 +sycl", when="%dpcpp@2022:") conflicts("@:3.5 +sycl", when="%oneapi@2022:") tpls_variants = { diff --git a/var/spack/repos/builtin/packages/onednn/package.py b/var/spack/repos/builtin/packages/onednn/package.py index 40708d41e0..a49c7df626 100644 --- a/var/spack/repos/builtin/packages/onednn/package.py +++ b/var/spack/repos/builtin/packages/onednn/package.py @@ -85,7 +85,6 @@ class Onednn(CMakePackage): "tbb", "seq", conditional("threadpool", when="@1.4:"), - conditional("dpcpp", when="@2:"), conditional("sycl", when="@2:"), ), multi=False, @@ -94,7 +93,7 @@ class Onednn(CMakePackage): "gpu_runtime", default="none", description="Runtime to use for GPU engines", - values=("ocl", "none", conditional("dpcpp", when="@2:"), conditional("sycl", when="@2:")), + values=("ocl", "none", conditional("sycl", when="@2:")), multi=False, ) variant(