From 24c01a5c045474b058a38babd69f0cd7878f55fd Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 13 May 2026 13:53:39 +0200 Subject: [PATCH 01/13] Added recipe for intel dpcpp with amd gpu support --- .../prgenv-gnu-dpcpp/25.11/amdgpu/README.md | 103 +++++ .../25.11/amdgpu/compilers.yaml | 4 + .../prgenv-gnu-dpcpp/25.11/amdgpu/config.yaml | 11 + .../25.11/amdgpu/environments.yaml | 91 +++++ .../25.11/amdgpu/extra/reframe.yaml | 17 + .../25.11/amdgpu/modules.yaml | 23 ++ .../25.11/amdgpu/post-install | 8 + .../amdgpu/repo/packages/llvmdpcpp/package.py | 154 ++++++++ .../amdgpu/repo/packages/py_dash/package.py | 28 ++ .../0001-remove-blas-override-7.2.patch | 19 + .../rocblas/0001-remove-blas-override.patch | 19 + ...7-add-rocm-openmp-extras-include-dir.patch | 20 + .../rocblas/0008-link-roctracer.patch | 16 + .../rocblas/0009-use-rocm-smi-config.patch | 15 + .../amdgpu/repo/packages/rocblas/package.py | 326 ++++++++++++++++ .../packages/rocprofiler_systems/package.py | 360 ++++++++++++++++++ .../25.11/amdgpu/repo/repo.yaml | 2 + 17 files changed, 1216 insertions(+) create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/README.md create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/compilers.yaml create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/config.yaml create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/extra/reframe.yaml create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/modules.yaml create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/post-install create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/py_dash/package.py create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override-7.2.patch create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override.patch create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0007-add-rocm-openmp-extras-include-dir.patch create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0008-link-roctracer.patch create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0009-use-rocm-smi-config.patch create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/package.py create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocprofiler_systems/package.py create mode 100644 recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/repo.yaml diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/README.md b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/README.md new file mode 100644 index 000000000..5d0c84a55 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/README.md @@ -0,0 +1,103 @@ +# prgenv-gnu-dpcpp (AMD GPU / HIP) + +> **Status: Experimental** + +GNU compiler toolchain with Intel DPC++ SYCL compiler and HIP backend for +AMD GPU systems on Alps (gfx90a / MI250X, gfx942 / MI300A & MI300X). + +## Overview + +This recipe combines: +- The AMD GPU toolchain from `prgenv-gnu/7.2.0/amdgpu` (ROCm 7.2.0, HIP, RCCL, …) +- The Intel DPC++ SYCL compiler approach from `prgenv-gnu-dpcpp/25.11/gh200` + +The Intel oneAPI binary distribution is x86_64 only and does not expose the +full HIP backend build path, so a custom Spack package (`llvmdpcpp`) builds +the compiler from the [intel/llvm](https://github.com/intel/llvm) `sycl` +branch directly, configured with `SYCL_ENABLE_BACKENDS=opencl;level_zero;hip` +and `LLVM_TARGETS_TO_BUILD=X86;SPIRV;AMDGPU`. + +The environment provides: + +- Intel DPC++ compiler (`clang++ -fsycl`) with HIP backend targeting gfx942, gfx90a +- Full ROCm 7.2.0 stack (rocBLAS, rocFFT, rocSOLVER, rocSPARSE, rocProfiler, …) +- HIP libraries (hipBLAS, hipBLASLt, hipFFT, hipSPARSE, hipRAND, hipDNN) +- GPU-aware MPI (cray-mpich@9.1.0 + ROCm GTL) +- RCCL + aws-ofi-rccl for multi-node GPU collectives +- Common development tools: Boost, CMake, FFTW, HDF5, NetCDF, OpenBLAS, Python, … + +## Custom Spack package: llvmdpcpp + +Located at `repo/packages/llvmdpcpp/package.py`. The build mirrors the +upstream `configure.py --hip` path from the +[GetStartedGuide](https://github.com/intel/llvm/blob/sycl/sycl/doc/GetStartedGuide.md#build-dpc-toolchain-with-support-for-hip-amd). +Key differences from the gh200 (CUDA) variant: + +- `+hip` instead of `+cuda cuda_arch=90` — no `amdgpu_target` variant needed; + architecture is chosen at application compile time via `--offload-arch=` +- `SYCL_ENABLE_BACKENDS` includes `hip` instead of `cuda` +- `LLVM_TARGETS_TO_BUILD` includes `AMDGPU` instead of `NVPTX` +- `lld` added to `LLVM_ENABLE_PROJECTS` (required for AMDGPU ELF code object linking) +- `SYCL_BUILD_UR_HIP_PLATFORM=AMD` (Unified Runtime HIP adapter platform) +- `UR_HIP_INCLUDE_DIR` / `UR_HIP_HSA_INCLUDE_DIR` / `UR_HIP_LIB_DIR` point to + Spack's `hip` and `hsa-rocr-dev` prefixes (replaces the monolithic `UR_HIP_ROCM_DIR` + that upstream assumes at `/opt/rocm`) +- libclc built as a **runtime target** using `LLVM_RUNTIME_TARGETS=default;amdgcn-amd-amdhsa-llvm` + and `RUNTIMES_amdgcn-amd-amdhsa-llvm_LLVM_ENABLE_RUNTIMES=libclc` — not via + per-arch `LIBCLC_TARGETS_TO_BUILD` entries + +## Build + +```bash +salloc -N 1 --time=240 -A + +mkdir -p /dev/shm/$USER +git clone https://github.com/eth-cscs/stackinator.git /dev/shm/$USER/stackinator +uv tool install --editable /dev/shm/$USER/stackinator +git clone git@github.com:eth-cscs/alps-cluster-config.git /dev/shm/$USER/alps-cluster-config + +stack-config \ + --build /dev/shm/$USER/dpcpp-amdgpu \ + --recipe /path/to/recipes/prgenv-gnu-dpcpp/25.11/amdgpu \ + --system /dev/shm/$USER/alps-cluster-config/ + +cd /dev/shm/$USER/dpcpp-amdgpu +env --ignore-environment PATH=/usr/bin:/bin:$(pwd -P)/spack/bin HOME=$HOME make store.squashfs -j144 + +cp store.squashfs /path/to/persistent/dpcpp-amdgpu.squashfs +``` + +## Usage + +### Setup + +```bash +uenv start --view=default /path/to/dpcpp-amdgpu.squashfs +export ROCM_PATH=$(ls -d /user-environment/linux-x86_64/llvm-amdgpu-*) +``` + +### Compile + +```bash +# Non-MPI SYCL targeting AMD GPU +clang++ -std=c++17 -O3 -fsycl \ + -fsycl-targets=amdgcn-amd-amdhsa \ + -Xsycl-target-backend --offload-arch=gfx942 \ + source.cpp -o binary + +# MPI (MPICH_CXX tells mpicxx to use DPC++ instead of g++) +MPICH_CXX=clang++ mpicxx -std=c++17 -O3 -fsycl \ + -fsycl-targets=amdgcn-amd-amdhsa \ + -Xsycl-target-backend --offload-arch=gfx942 \ + source.cpp -o binary +``` + +### Run + +```bash +# single-node +./binary + +# multi-node MPI +srun -n ./binary +``` diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/compilers.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/compilers.yaml new file mode 100644 index 000000000..986a58633 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/compilers.yaml @@ -0,0 +1,4 @@ +gcc: + version: "13" +llvm-amdgpu: + version: "7.2.0" diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/config.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/config.yaml new file mode 100644 index 000000000..cd5f7e0b1 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/config.yaml @@ -0,0 +1,11 @@ +name: prgenv-gnu-dpcpp +spack: + repo: https://github.com/spack/spack.git + commit: releases/v1.1 + packages: + repo: https://github.com/spack/spack-packages.git + commit: 876d656ad17366f92e2233d843ba285d655150dd # develop on 2026-03-09 +store: /user-environment +description: GNU Compiler toolchain with Intel DPC++ SYCL (HIP backend), cray-mpich, Python, CMake and other development tools for gfx90a, gfx942 (MI300A, MI250X) +default-view: default +version: 2 diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml new file mode 100644 index 000000000..ef91722d0 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml @@ -0,0 +1,91 @@ +gcc-env: + compiler: [gcc, llvm-amdgpu] + network: + mpi: cray-mpich@9.1.0+rocm + unify: when_possible + duplicates: + strategy: full + specs: + # Intel DPC++ SYCL compiler with HIP/ROCm backend + - llvmdpcpp@sycl +clang +hip + # Base development tools (from prgenv-gnu-dpcpp/25.11) + - boost@1.88.0 +chrono +filesystem +iostreams +mpi +python +regex +serialization +shared +system +timer + - cmake + - fftw + - fmt + - gmp + - gsl + - hdf5+cxx+hl+fortran + - netlib-scalapack + - lua + - libtree + - lz4 + - meson + - netcdf-c + - netcdf-cxx + - netcdf-cxx4 + - netcdf-fortran + - ninja + - openblas threads=openmp + - osu-micro-benchmarks ~xccl + - papi + - python@3 + - zlib-ng + # AMD GPU packages (from prgenv-gnu/7.2.0/amdgpu) + - hip@7.2.0 ^mesa + - hdf5+mpi + - hipcub + - llvm-amdgpu + # rocm packages + - rocblas ~tensile ^py-msgpack %cxx=gcc + - rocfft + - rocm-cmake %cxx=gcc + - rocm-openmp-extras + - rocm-core %cxx=gcc + - rocminfo + - rocprim + - rocprofiler-dev + - rocprofiler-sdk + - rocprofiler-systems +internal-dyninst +internal-boost + - rocprofiler-compute + - rocrand + - rocsolver + - rocsparse + - rocthrust + - roctracer-dev-api %cxx=gcc + - roctracer-dev + - rocm-gdb + - rocm-debug-agent + - hsa-rocr-dev + - comgr + # hip packages + - hipblas + - hipblaslt + - hiprand + - hipsparse + - hipfft + - hipblas-common + - hipdnn + # networking + - rccl + # commits pinned for reproducibility, not bugs; update when updating recipe + - aws-ofi-rccl@git.6dae1b0d588c27689ba6daa32710359ea96de78c=cxi + - rccl-tests@git.6405c76e6826663bbb67bd40aeee8c70aa5d3094=develop %cxx=llvm-amdgpu + variants: + - +mpi + - +rocm + - amdgpu_target=gfx942,gfx90a + - amdgpu_target_sram_ecc=gfx942,gfx90a + - ^python@3.12.12 + views: + default: + link: roots + exclude: ["llvm"] + uenv: + add_compilers: true + prefix_paths: + LD_LIBRARY_PATH: [lib, lib64] + env_vars: + set: + - FI_PROVIDER: "cxi" + - MPIR_CVAR_CH4_OFI_ENABLE_HMEM: "1" diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/extra/reframe.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/extra/reframe.yaml new file mode 100644 index 000000000..4fee97aa6 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/extra/reframe.yaml @@ -0,0 +1,17 @@ +default: + features: + - rocm + - mpi + - rccl + - rccl-tests + - openmp + - prgenv + - serial + - mpich + - osu-micro-benchmarks + - sycl-dpcpp + cc: mpicc + cxx: mpic++ + ftn: mpifort + views: + - default diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/modules.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/modules.yaml new file mode 100644 index 000000000..841f61f0e --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/modules.yaml @@ -0,0 +1,23 @@ +modules: + # Paths to check when creating modules for all module sets + prefix_inspections: + bin: + - PATH + lib: + - LD_LIBRARY_PATH + lib64: + - LD_LIBRARY_PATH + + default: + arch_folder: false + # Where to install modules + roots: + tcl: /user-environment/modules + tcl: + all: + autoload: none + hash_length: 0 + exclude_implicits: true + exclude: ['%gcc@7.5.0', 'gcc %gcc@7.5.0', 'llvm-amdgpu', 'rccl-tests'] + projections: + all: '{name}/{version}' diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/post-install b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/post-install new file mode 100644 index 000000000..0e423467e --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/post-install @@ -0,0 +1,8 @@ +#!/bin/bash + +set -e + +# remove offending environment variables +jq '.views["default"].env.values.scalar["HIPCC_LINK_FLAGS_APPEND"]|="" | .views["default"].env.values.scalar["HIPCC_COMPILE_FLAGS_APPEND"]|="" ' /user-environment/meta/env.json > /tmp/env.json +# copy file back to destination +cp /tmp/env.json /user-environment/meta/env.json diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py new file mode 100644 index 000000000..5acda9226 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -0,0 +1,154 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +""" +Custom Spack package for Intel DPC++ (intel/llvm sycl branch) with HIP/ROCm backend. + +This builds the full DPC++ SYCL compiler from the intel/llvm repository with +support for AMD GPUs via the HIP backend, targeting gfx90a (MI250X) and +gfx942 (MI300A/MI300X). + +The build approach mirrors the upstream configure.py --hip flag: + - AMDGPU added to LLVM_TARGETS_TO_BUILD + - hip added to SYCL_ENABLE_BACKENDS + - lld added to LLVM_ENABLE_PROJECTS (required for AMDGPU linking chain) + - libclc built as a runtime target via LLVM_RUNTIME_TARGETS / LLVM_ENABLE_RUNTIMES + - UR_HIP_ROCM_DIR / UR_HIP_* used for Unified Runtime HIP adapter (not HIP_PATH) + - SYCL_BUILD_UR_HIP_PLATFORM=AMD +""" + +import os + +from spack_repo.builtin.build_systems.cmake import CMakePackage, generator + +from spack.package import * + + +class Llvmdpcpp(CMakePackage): + """Intel DPC++ SYCL compiler built from the intel/llvm open-source repository, + with HIP/ROCm backend for AMD GPUs.""" + + homepage = "https://github.com/intel/llvm" + git = "https://github.com/intel/llvm.git" + + maintainers("gandanie") + + version("sycl", branch="sycl", preferred=True) + version("sycl-2025.1", tag="sycl/unified/2025.1") + + variant("clang", default=True, description="Build clang (required for DPC++)") + variant("hip", default=False, description="Enable HIP/ROCm backend for AMD GPUs") + + depends_on("cmake@3.20:", type="build") + depends_on("ninja", type="build") + depends_on("python@3.6:", type="build") + depends_on("zstd", type="link") + + # HIP/ROCm dependencies + # Unified Runtime HIP adapter needs HIP headers/lib and HSA headers + depends_on("hip", when="+hip") + depends_on("hsa-rocr-dev", when="+hip") + depends_on("llvm-amdgpu", when="+hip") + + # Force clang on + conflicts("~clang", msg="DPC++ requires clang") + + generator("ninja") + + @property + def root_cmakelists_dir(self): + """The CMakeLists.txt is in the llvm subdirectory.""" + return "llvm" + + def cmake_args(self): + spec = self.spec + src = self.stage.source_path + + # Paths to DPC++-specific sub-projects within intel/llvm + sycl_dir = os.path.join(src, "sycl") + spirv_dir = os.path.join(src, "llvm-spirv") + xpti_dir = os.path.join(src, "xpti") + xptifw_dir = os.path.join(src, "xptifw") + libdevice_dir = os.path.join(src, "libdevice") + jit_dir = os.path.join(src, "sycl-jit") + + # LLVM targets: X86 host + SPIRV for SYCL IR + llvm_targets = "X86;SPIRV" + + # SYCL backends (level_zero included for CPU/Intel GPU fallback) + sycl_backends = ["opencl", "level_zero"] + + # Projects: lld is required for AMDGPU linking chain + llvm_projects = ( + "clang;llvm-spirv;opencl;xpti;xptifw;libdevice;sycl;sycl-jit" + ) + + # Runtime targets for libclc device library + # "default" covers non-GPU (CPU, OpenCL) runtimes + runtime_targets = ["default"] + + if spec.satisfies("+hip"): + llvm_targets += ";AMDGPU" + sycl_backends.append("hip") + # lld is required for AMDGPU ELF code object linking + llvm_projects += ";lld" + # libclc AMD target (generic; arch chosen at application compile time) + runtime_targets.append("amdgcn-amd-amdhsa-llvm") + + args = [ + self.define("CMAKE_BUILD_TYPE", "Release"), + self.define("LLVM_ENABLE_ASSERTIONS", False), + self.define("LLVM_TARGETS_TO_BUILD", llvm_targets), + self.define("LLVM_EXTERNAL_PROJECTS", + "sycl;llvm-spirv;opencl;xpti;xptifw;libdevice;sycl-jit"), + 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_EXTERNAL_SYCL_JIT_SOURCE_DIR", jit_dir), + self.define("LLVM_ENABLE_PROJECTS", llvm_projects), + self.define("LLVM_BUILD_TOOLS", True), + self.define("LLVM_ENABLE_ZSTD", True), + self.define("LLVM_USE_STATIC_ZSTD", True), + self.define("SYCL_ENABLE_WERROR", False), + self.define("SYCL_INCLUDE_TESTS", False), + self.define("BUILD_SHARED_LIBS", False), + self.define("SYCL_ENABLE_XPTI_TRACING", False), + self.define("SYCL_ENABLE_BACKENDS", ";".join(sycl_backends)), + self.define("SYCL_ENABLE_EXTENSION_JIT", True), + self.define("SYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB", True), + self.define("BUG_REPORT_URL", "https://github.com/intel/llvm/issues"), + # libclc runtime targets (mirrors configure.py libclc_enabled path) + self.define("LLVM_RUNTIME_TARGETS", ";".join(runtime_targets)), + ] + + # Add per-runtime libclc enablement (configure.py pattern) + for target in runtime_targets: + if target != "default": + args.append( + self.define( + "RUNTIMES_{}_LLVM_ENABLE_RUNTIMES".format(target), + "libclc", + ) + ) + + if spec.satisfies("+hip"): + # Unified Runtime HIP adapter variables (configure.py: UR_HIP_ROCM_DIR) + # Spack separates ROCm into individual packages, so provide each path: + hip_prefix = spec["hip"].prefix + hsa_prefix = spec["hsa-rocr-dev"].prefix + args.extend([ + self.define("SYCL_BUILD_UR_HIP_PLATFORM", "AMD"), + # HIP include/lib directories for the UR HIP adapter + self.define("UR_HIP_INCLUDE_DIR", + os.path.join(hip_prefix, "include")), + self.define("UR_HIP_HSA_INCLUDE_DIR", + os.path.join(hsa_prefix, "include")), + self.define("UR_HIP_LIB_DIR", + os.path.join(hip_prefix, "lib")), + ]) + + return args diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/py_dash/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/py_dash/package.py new file mode 100644 index 000000000..b7dcd8056 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/py_dash/package.py @@ -0,0 +1,28 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack_repo.builtin.build_systems.python import PythonPackage + +from spack.package import * + + +class PyDash(PythonPackage): + """Dash is the most downloaded, trusted Python framework + for building ML & data science web apps.""" + + homepage = "https://dash.plotly.com/" + pypi = "dash/dash-2.17.1.tar.gz" + git = "https://github.com/plotly/dash.git" + + license("MIT") + + version("3.0.0", sha256="2cbb071836b3ca546dbe38655083908b8be543f3bea9c4bf660b96490d3d4953") + version("2.17.1", sha256="ee2d9c319de5dcc1314085710b72cd5fa63ff994d913bf72979b7130daeea28e") + + depends_on("python@3.8:", type=("build", "run")) + depends_on("py-setuptools", type="build") + depends_on("py-typing-extensions") + depends_on("py-flask") + depends_on("py-plotly@5") + depends_on("py-importlib-metadata") diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override-7.2.patch b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override-7.2.patch new file mode 100644 index 000000000..1470bd924 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override-7.2.patch @@ -0,0 +1,19 @@ +diff --git a/projects/rocblas/clients/CMakeLists.txt b/projects/rocblas/clients/CMakeLists.txt +index 0f32675..65e458d 100644 +--- a/projects/rocblas/clients/CMakeLists.txt ++++ b/projects/rocblas/clients/CMakeLists.txt +@@ -163,14 +163,6 @@ if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS) + find_package(PkgConfig) + if(NOT PKG_CONFIG_FOUND) + message( FATAL_ERROR "Could not find libblis and pkgconfig is not available" ) +- else() +- pkg_search_module(PKGBLAS cblas) +- if(PKGBLAS_FOUND) +- set( BLAS_LIBRARY ${PKGBLAS_LIBRARIES} ) +- set( BLAS_INCLUDE_DIR ${PKGBLAS_INCLUDE_DIRS} ) +- else() +- message( FATAL_ERROR "Could not find libblis and pkgconfig can not find any other implementation of cblas" ) +- endif() + endif() + endif() + else() diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override.patch b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override.patch new file mode 100644 index 000000000..982f21143 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0001-remove-blas-override.patch @@ -0,0 +1,19 @@ +diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt +index 0f32675..65e458d 100644 +--- a/clients/CMakeLists.txt ++++ b/clients/CMakeLists.txt +@@ -163,14 +163,6 @@ if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS) + find_package(PkgConfig) + if(NOT PKG_CONFIG_FOUND) + message( FATAL_ERROR "Could not find libblis and pkgconfig is not available" ) +- else() +- pkg_search_module(PKGBLAS cblas) +- if(PKGBLAS_FOUND) +- set( BLAS_LIBRARY ${PKGBLAS_LIBRARIES} ) +- set( BLAS_INCLUDE_DIR ${PKGBLAS_INCLUDE_DIRS} ) +- else() +- message( FATAL_ERROR "Could not find libblis and pkgconfig can not find any other implementation of cblas" ) +- endif() + endif() + endif() + else() diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0007-add-rocm-openmp-extras-include-dir.patch b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0007-add-rocm-openmp-extras-include-dir.patch new file mode 100644 index 000000000..4e265011b --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0007-add-rocm-openmp-extras-include-dir.patch @@ -0,0 +1,20 @@ +diff --git a/clients/gtest/CMakeLists.txt b/clients/gtest/CMakeLists.txt +index 55e9bbe..32b350c 100644 +--- a/clients/gtest/CMakeLists.txt ++++ b/clients/gtest/CMakeLists.txt +@@ -164,6 +164,7 @@ target_include_directories( rocblas-test + $ + $ # may be blank if not used + $ ++ $ + ) + target_include_directories( rocblas_v3-test + SYSTEM PRIVATE +@@ -171,6 +172,7 @@ target_include_directories( rocblas_v3-test + $ + $ # may be blank if not used + $ ++ $ + ) + + if( BUILD_FORTRAN_CLIENTS ) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0008-link-roctracer.patch b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0008-link-roctracer.patch new file mode 100644 index 000000000..9e55ee44a --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0008-link-roctracer.patch @@ -0,0 +1,16 @@ +diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt +index 762580d..1692578 100644 +--- a/library/CMakeLists.txt ++++ b/library/CMakeLists.txt +@@ -81,7 +81,10 @@ function( rocblas_library_settings lib_target_ ) + else() + target_link_libraries( ${lib_target_} PRIVATE hip::device -lstdc++fs --rtlib=compiler-rt --unwindlib=libgcc) + if (BUILD_SHARED_LIBS) +- target_link_libraries(${lib_target_} PRIVATE -lroctx64) ++ find_path(ROCTRACER_INCLUDE_DIR "roctracer/roctx.h") ++ target_include_directories(${lib_target_} PUBLIC ${ROCTRACER_INCLUDE_DIR}) ++ find_library(ROCTX_LIB NAMES roctx64) ++ target_link_libraries(${lib_target_} PRIVATE ${ROCTX_LIB}) + endif() + endif() + target_link_libraries( ${lib_target_} PRIVATE Threads::Threads ) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0009-use-rocm-smi-config.patch b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0009-use-rocm-smi-config.patch new file mode 100644 index 000000000..0b474bc02 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/0009-use-rocm-smi-config.patch @@ -0,0 +1,15 @@ +diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt +index 6194286..292bd8d 100644 +--- a/clients/CMakeLists.txt ++++ b/clients/CMakeLists.txt +@@ -178,8 +178,8 @@ if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS) + + # Find the package ROCmSMI + if(NOT WIN32) +- find_package(ROCmSMI REQUIRED) +- list( APPEND COMMON_LINK_LIBS rocm_smi ) ++ find_package(rocm_smi CONFIG REQUIRED) ++ list( APPEND COMMON_LINK_LIBS rocm_smi64 ) + endif() + + find_package( GTest REQUIRED ) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/package.py new file mode 100644 index 000000000..514887c7d --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocblas/package.py @@ -0,0 +1,326 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import re + +from spack_repo.builtin.build_systems.cmake import CMakePackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage + +from spack.package import * + + +class Rocblas(CMakePackage): + """Radeon Open Compute BLAS library""" + + homepage = "https://github.com/ROCm/rocBLAS/" + git = "https://github.com/ROCm/rocm-libraries.git" + + tags = ["rocm"] + maintainers("cgmb", "srekolam", "renjithravindrankannath", "haampie", "afzpatel") + libraries = ["librocblas"] + license("MIT") + + def url_for_version(self, version): + if version <= Version("7.1.1"): + url = "https://github.com/ROCm/rocBLAS/archive/refs/tags/rocm-{0}.tar.gz" + else: + url = "https://github.com/ROCm/rocm-libraries/archive/rocm-{0}.tar.gz" + return url.format(version) + + version("7.2.0", sha256="8ad5f4a11f1ed8a7b927f2e65f24083ca6ce902a42021a66a815190a91ccb654") + version("7.1.1", sha256="29d43270ccf5d4818d261993f964d4fce4bd0a55c2b6dde60d1529b6c227a873") + version("7.1.0", sha256="54f38222d0e58344cf5c86f151d418c071b59145297fd2ed953bb561df1e12c3") + version("7.0.2", sha256="8398cda68242db2386abc9eaf00c3588bb27e2b382e29be2bc5624c2d4ac8a99") + version("7.0.0", sha256="337a77cec31927e484672002d245d3aebf7a67e95658a8477fc593c95cf281fb") + version("6.4.3", sha256="754dcc88b30468a2293d2406d7fe40f78dc92dd77c193758f937532217ecdad3") + version("6.4.2", sha256="703226c458bb3dd1155aad8bdc02cdae2ff789c6b44e41e4a49ae28e40baff98") + version("6.4.1", sha256="517950ff6b3715dee8b2bcfbdd3968c65e1910e4b8e353e148574ae08aa6dc73") + version("6.4.0", sha256="ab8e75c9f98d17817a650aa4f06ff1e6c6af92cd143079e361cb6a0c96676aaa") + version("6.3.3", sha256="73e91bd50c920b818742fa5bf9990c0676be5bfbafe321d5781607dc2ce27060") + version("6.3.2", sha256="455cad760d926c21101594197c4456f617e5873a8f17bb3e14bd762018545a9e") + version("6.3.1", sha256="88d2de6ce6b23a157eea8be63408350848935e4dfc3e27e5f2add78834c6d6ba") + version("6.3.0", sha256="051f53bb69a9aba55a0c66c32688bf6af80e29e4a6b56b380b3c427e7a6aff9d") + version("6.2.4", sha256="8bacf74e3499c445f1bb0a8048df1ef3ce6f72388739b1823b5784fd1e8aa22a") + version("6.2.1", sha256="cf3bd7b47694f95f387803191615e2ff5c1106175473be7a5b2e8eb6fb99179f") + version("6.2.0", sha256="184e9b39dcbed57c25f351b047d44c613f8a2bbab3314a20c335f024a12ad4e5") + version("6.1.2", sha256="1e83918bd7b28ec9ee292c6fb7eb0fc5f4db2d5d831a9a3db541f14a90c20a1a") + version("6.1.1", sha256="c920742fb8f45512c360cdb40e37d0ac767f042e52f1981264853dab5ec2c876") + version("6.1.0", sha256="af00357909da60d82618038aa9a3cc1f9d4ce1bdfb54db20ec746b592d478edf") + version("6.0.2", sha256="d1bf31063a2d349797b88c994c91d05f94e681bafb5550ad9b53529703d89dbb") + version("6.0.0", sha256="befa4a75f1de0ea37f2358d4c2de5406d7bce671ca9936e2294b64d3b3bafb60") + version("5.7.1", sha256="2984a5ed0ea5a05d40996ee3fddecb24399cbe8ea3e4921fc254e54d8f52fe4f") + version("5.7.0", sha256="024edd98de9687ee5394badc4dd4c543eef4eb3f71c96ff64100705d851e1744") + + amdgpu_targets = ROCmPackage.amdgpu_targets + + variant( + "amdgpu_target", + description="AMD GPU architecture", + values=auto_or_any_combination_of(*amdgpu_targets), + sticky=True, + ) + variant("tensile", default=True, description="Use Tensile as a backend") + variant("asan", default=False, description="Build with address-sanitizer enabled or disabled") + variant("hipblaslt", default=True, when="@6.3:", description="Build with hipblaslt") + + conflicts("+asan", when="os=rhel9") + conflicts("+asan", when="os=centos7") + conflicts("+asan", when="os=centos8") + + depends_on("c", type="build") # generated + depends_on("cxx", type="build") # generated + depends_on("fortran", type="build") # generated + + depends_on("cmake@3.16.8:", type="build") + + depends_on("googletest@1.10.0:", type="test") + depends_on("amdblis", type="test") + + for ver in [ + "6.2.0", + "6.2.1", + "6.2.4", + "6.3.0", + "6.3.1", + "6.3.2", + "6.3.3", + "6.4.0", + "6.4.1", + "6.4.2", + "6.4.3", + "7.0.0", + "7.0.2", + "7.1.0", + "7.1.1", + "7.2.0", + ]: + depends_on(f"rocm-smi-lib@{ver}", type="test", when=f"@{ver}") + + for ver in [ + "5.7.0", + "5.7.1", + "6.0.0", + "6.0.2", + "6.1.0", + "6.1.1", + "6.1.2", + "6.2.0", + "6.2.1", + "6.2.4", + "6.3.0", + "6.3.1", + "6.3.2", + "6.3.3", + "6.4.0", + "6.4.1", + "6.4.2", + "6.4.3", + "7.0.0", + "7.0.2", + "7.1.0", + "7.1.1", + ]: + depends_on(f"rocm-openmp-extras@{ver}", type="test", when=f"@{ver}") + + for ver in [ + "5.7.0", + "5.7.1", + "6.0.0", + "6.0.2", + "6.1.0", + "6.1.1", + "6.1.2", + "6.2.0", + "6.2.1", + "6.2.4", + "6.3.0", + "6.3.1", + "6.3.2", + "6.3.3", + "6.4.0", + "6.4.1", + "6.4.2", + "6.4.3", + "7.0.0", + "7.0.2", + "7.1.0", + "7.1.1", + "7.2.0", + ]: + depends_on(f"hip@{ver}", when=f"@{ver}") + depends_on(f"llvm-amdgpu@{ver}", type="build", when=f"@{ver}") + depends_on(f"rocminfo@{ver}", type="build", when=f"@{ver}") + depends_on(f"rocm-cmake@{ver}", type="build", when=f"@{ver}") + + for ver in [ + "6.3.0", + "6.3.1", + "6.3.2", + "6.3.3", + "6.4.0", + "6.4.1", + "6.4.2", + "6.4.3", + "7.0.0", + "7.0.2", + "7.1.0", + "7.1.1", + "7.2.0", + ]: + depends_on(f"hipblaslt@{ver}", when=f"@{ver} +hipblaslt") + + for ver in ["6.4.0", "6.4.1", "6.4.2", "6.4.3", "7.0.0", "7.0.2", "7.1.0", "7.1.1", "7.2.0"]: + depends_on(f"roctracer-dev@{ver}", when=f"@{ver}") + + depends_on("python@3.6:", type="build") + + with when("+tensile"): + depends_on("msgpack-c@3:") + + depends_on("py-virtualenv", type="build") + depends_on("perl-file-which", type="build") + depends_on("py-pyyaml", type="build") + depends_on("py-wheel", type="build") + depends_on("py-msgpack", type="build") + depends_on("py-pip", type="build") + depends_on("py-joblib", type="build") + depends_on("procps", type="build") + + for t_version, t_commit in [ + ("@5.7.0", "97e0cfc2c8cb87a1e38901d99c39090dc4181652"), + ("@5.7.1", "97e0cfc2c8cb87a1e38901d99c39090dc4181652"), + ("@6.0.0", "17df881bde80fc20f997dfb290f4bb4b0e05a7e9"), + ("@6.0.2", "17df881bde80fc20f997dfb290f4bb4b0e05a7e9"), + ("@6.1.0", "2b55ccf58712f67b3df0ca53b0445f094fcb96b2"), + ("@6.1.1", "2b55ccf58712f67b3df0ca53b0445f094fcb96b2"), + ("@6.1.2", "2b55ccf58712f67b3df0ca53b0445f094fcb96b2"), + ("@6.2.0", "dbc2062dced66e4cbee8e0591d76e0a1588a4c70"), + ("@6.2.1", "dbc2062dced66e4cbee8e0591d76e0a1588a4c70"), + ("@6.2.4", "81ae9537671627fe541332c0a5d953bfd6af71d6"), + ("@6.3.0", "aca95d1743c243dd0dd0c8b924608bc915ce1ae7"), + ("@6.3.1", "aca95d1743c243dd0dd0c8b924608bc915ce1ae7"), + ("@6.3.2", "aca95d1743c243dd0dd0c8b924608bc915ce1ae7"), + ("@6.3.3", "aca95d1743c243dd0dd0c8b924608bc915ce1ae7"), + ("@6.4.0", "be49885fce2a61b600ae4593f1c2d00c8b4fa11e"), + ("@6.4.1", "be49885fce2a61b600ae4593f1c2d00c8b4fa11e"), + ("@6.4.2", "be49885fce2a61b600ae4593f1c2d00c8b4fa11e"), + ("@6.4.3", "be49885fce2a61b600ae4593f1c2d00c8b4fa11e"), + ("@7.0.0", "cca3c8136aa812109629e6291ce9f0ca846b68d3"), + ("@7.0.2", "63c27e505cb532ff8e568d737bfdbd9e1d024665"), + ("@7.1.0", "0c8314da90fee8cf3b16dcb1bbc75bc1266e123f"), + ("@7.1.1", "0c8314da90fee8cf3b16dcb1bbc75bc1266e123f"), + ]: + resource( + name="Tensile", + git="https://github.com/ROCm/Tensile.git", + commit=t_commit, + placement="Tensile", + when=f"{t_version} +tensile", + ) + + patch("0007-add-rocm-openmp-extras-include-dir.patch", when="@5.7") + patch("0008-link-roctracer.patch", when="@6.4") + patch("0009-use-rocm-smi-config.patch", when="@6.4:7.1") + patch("0001-remove-blas-override.patch", when="@7.1") + patch("0001-remove-blas-override-7.2.patch", when="@7.2:") + patch( + "https://github.com/ROCm/rocm-libraries/commit/b3b20a3ea53051a14f30c28e577620c0beeea57c.patch?full_index=1", + sha256="1f436c5ad03c8fdc021f309a1ad84d4356f30c39c4cc940bb8267841561bf5f1", + when="@7.2", + ) + + @property + def root_cmakelists_dir(self): + if self.spec.satisfies("@7.2:"): + return "projects/rocblas" + else: + return "." + + def setup_build_environment(self, env: EnvironmentModifications) -> None: + env.set("CXX", self.spec["hip"].hipcc) + if self.spec.satisfies("+asan"): + env.set("CC", f"{self.spec['llvm-amdgpu'].prefix}/bin/clang") + env.set("CXX", f"{self.spec['llvm-amdgpu'].prefix}/bin/clang++") + env.set("ASAN_OPTIONS", "detect_leaks=0") + env.set("CFLAGS", "-fsanitize=address -shared-libasan") + env.set("CXXFLAGS", "-fsanitize=address -shared-libasan") + env.set("LDFLAGS", "-fuse-ld=lld") + + @classmethod + def determine_version(cls, lib): + match = re.search(r"lib\S*\.so\.\d+\.\d+\.(\d)(\d\d)(\d\d)", lib) + if match: + ver = "{0}.{1}.{2}".format( + int(match.group(1)), int(match.group(2)), int(match.group(3)) + ) + else: + ver = None + return ver + + def cmake_args(self): + args = [ + self.define("BUILD_CLIENTS_TESTS", self.run_tests), + self.define("BUILD_CLIENTS_BENCHMARKS", "OFF"), + self.define("BUILD_CLIENTS_SAMPLES", "OFF"), + self.define("RUN_HEADER_TESTING", "OFF"), + self.define_from_variant("BUILD_WITH_TENSILE", "tensile"), + self.define("CMAKE_INSTALL_LIBDIR", "lib"), + self.define("Tensile_CODE_OBJECT_VERSION", "default"), + ] + if self.run_tests: + args.append(self.define("LINK_BLIS", "ON")) + args.append( + self.define("BLIS_INCLUDE_DIR", self.spec["amdblis"].prefix + "/include/blis/") + ) + args.append( + self.define("BLAS_LIBRARY", self.spec["amdblis"].prefix + "/lib/libblis.a") + ) + if self.spec.satisfies("@:7.1"): + args.append( + self.define("ROCM_OPENMP_EXTRAS_DIR", self.spec["rocm-openmp-extras"].prefix) + ) + + if "+tensile" in self.spec: + if self.spec.satisfies("@:6.2"): + tensile_compiler = "hipcc" + else: + tensile_compiler = f"{self.spec['llvm-amdgpu'].prefix}/bin/amdclang++" + args += [ + self.define("Tensile_COMPILER", tensile_compiler), + self.define("Tensile_LOGIC", "asm_full"), + self.define("BUILD_WITH_TENSILE_HOST", "@3.7.0:" in self.spec), + self.define("Tensile_LIBRARY_FORMAT", "msgpack"), + ] + if self.spec.satisfies("@:7.1"): + tensile_path = join_path(self.stage.source_path, "Tensile") + args.append(self.define("Tensile_TEST_LOCAL_PATH", tensile_path)) + # Restrict the number of jobs Tensile can spawn. + # If we don't specify otherwise, Tensile creates a job per available core, + # and that consumes a lot of system memory. + # https://github.com/ROCm/Tensile/blob/93e10678a0ced7843d9332b80bc17ebf9a166e8e/Tensile/Parallel.py#L38 + args.append(self.define("Tensile_CPU_THREADS", min(16, make_jobs))) + + if "auto" not in self.spec.variants["amdgpu_target"]: + if self.spec.satisfies("@7.1:"): + args.append(self.define_from_variant("GPU_TARGETS", "amdgpu_target")) + else: + args.append(self.define_from_variant("AMDGPU_TARGETS", "amdgpu_target")) + + # See https://github.com/ROCm/rocBLAS/issues/1196 + if self.spec.satisfies("^cmake@3.21.0:3.21.2"): + args.append(self.define("__skip_rocmclang", "ON")) + + if self.spec.satisfies("@:6.3.1"): + args.append(self.define("BUILD_FILE_REORG_BACKWARD_COMPATIBILITY", True)) + if self.spec.satisfies("@6.3:"): + args.append(self.define_from_variant("BUILD_WITH_HIPBLASLT", "hipblaslt")) + if self.spec.satisfies("@7.1:"): + args.append(self.define("ROCTX_PATH", self.spec["roctracer-dev"].prefix)) + return args + + @run_after("build") + @on_package_attributes(run_tests=True) + def check_build(self): + exe = Executable(join_path(self.build_directory, "clients", "staging", "rocblas-test")) + exe("--gtest_filter=*quick*-*known_bug*") diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocprofiler_systems/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocprofiler_systems/package.py new file mode 100644 index 000000000..f6f996cab --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/rocprofiler_systems/package.py @@ -0,0 +1,360 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import re + +from spack_repo.builtin.build_systems.cmake import CMakePackage + +from spack.package import * + + +def submodules(package): + submodules = [ + "projects/rocprofiler-systems/external/timemory", + "projects/rocprofiler-systems/external/perfetto", + "projects/rocprofiler-systems/external/elfio", + "projects/rocprofiler-systems/external/dyninst", + "projects/rocprofiler-systems/external/PTL", + "projects/rocprofiler-systems/external/papi", + "projects/rocprofiler-systems/external/pybind11", + "projects/rocprofiler-systems/examples/openmp/external/ompvv", + ] + return submodules + + +class RocprofilerSystems(CMakePackage): + """Application Profiling, Tracing, and Analysis""" + + homepage = "https://github.com/ROCm/rocprofiler-systems" + git = "https://github.com/ROCm/rocm-systems.git" + url = "https://github.com/ROCm/rocprofiler-systems/archive/refs/tags/rocm-6.4.3.tar.gz" + executables = ["rocprof-sys-sample"] + tags = ["rocm"] + + maintainers("dgaliffiAMD", "afzpatel", "srekolam", "renjithravindrankannath") + + license("MIT") + + version( + "7.2.0", + git="https://github.com/ROCm/rocm-systems.git", + tag="rocm-7.2.0", + commit="fc0010cf6a5a972d42b276df946510f30343d493", + submodules=submodules, + ) + version( + "7.1.1", + git="https://github.com/ROCm/rocprofiler-systems", + branch="release/rocm-rel-7.1.1", + submodules=True, + ) + version( + "7.1.0", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-7.1.0", + commit="427f656162559f21fc3d6cb0e3688f3d31ae374c", + submodules=True, + ) + version( + "7.0.2", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-7.0.2", + commit="8bad624afb06ea2b567e985484d1b5d604865743", + submodules=True, + ) + version( + "7.0.0", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-7.0.0", + commit="1030d99db9934a07f1d276f6aadd0eb810b5f5f9", + submodules=True, + ) + version( + "6.4.3", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.4.3", + commit="ba0bfe8cf344294347cbb854084ab5b5df1b1a43", + submodules=True, + ) + version( + "6.4.2", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.4.2", + commit="ba0bfe8cf344294347cbb854084ab5b5df1b1a43", + submodules=True, + ) + version( + "6.4.1", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.4.1", + commit="2e945e4a08781e13a822f568814e2c434fd8858f", + submodules=True, + ) + version( + "6.4.0", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.4.0", + commit="c4cec593b6021f2b84294838f2ffe388ed8e911a", + submodules=True, + ) + version( + "6.3.3", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.3.3", + commit="f03ef1dd9a4e984e3e72056352532e6149e742fc", + submodules=True, + ) + version( + "6.3.2", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.3.2", + commit="2fd5fbbef941ff219a1ecef702f8cfaae6e8e5ba", + submodules=True, + ) + version( + "6.3.1", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.3.1", + commit="04a84dd0b0df3dfd61f7765696e0e474ec29f10b", + submodules=True, + ) + + version( + "6.3.0", + git="https://github.com/ROCm/rocprofiler-systems", + tag="rocm-6.3.0", + commit="71a5e271b5e07efd2948fb6e7b451db5e8e40cb8", + submodules=True, + ) + + variant( + "rocm", + default=True, + description="Enable ROCm API, kernel tracing, and GPU HW counters support", + ) + variant("strip", default=False, description="Faster binary instrumentation, worse debugging") + variant( + "python", default=False, description="Enable support for Python function profiling and API" + ) + variant("papi", default=True, description="Enable HW counters support via PAPI") + variant("ompt", default=True, description="Enable OpenMP Tools support") + variant( + "tau", + default=False, + description="Enable support for using TAU markers in omnitrace instrumentation", + ) + variant( + "caliper", + default=False, + description="Enable support for using Caliper markers in omnitrace instrumentation", + ) + variant( + "perfetto_tools", + default=False, + description="Install perfetto tools (e.g. traced, perfetto)", + ) + variant( + "mpi", + default=False, + description=( + "Enable intercepting MPI functions and aggregating output during finalization " + "(requires target application to use same MPI installation)" + ), + ) + variant( + "mpi_headers", + default=True, + description=( + "Enable intercepting MPI functions but w/o support for aggregating output " + "(target application can use any MPI installation)" + ), + ) + variant("internal-dyninst", default=False, description="build internal dyninst") + variant("internal-boost", default=False, description="build internal boost") + variant("internal-tbb", default=False, description="build internal tbb") + + conflicts("%rocmcc", when="+internal-tbb") + conflicts("%clang", when="+internal-tbb") + extends("python", when="+python") + + depends_on("c", type="build") # generated + depends_on("cxx", type="build") # generated + depends_on("fortran", type="build") # generated + + # hard dependencies + depends_on("cmake@3.16:", type="build") + depends_on("dyninst@:12", when="@6 ~internal-dyninst") + depends_on("dyninst@13", when="@7 ~internal-dyninst") + depends_on( + "boost@:1.88" + "+atomic+chrono+date_time+filesystem+system+thread+timer+container+random+exception", + when="@:7.1.0 +internal-dyninst", + ) + depends_on( + "boost@:1.88" + "+atomic+chrono+date_time+filesystem+system+thread+timer+container+random+exception", + when="@7.1.1:", + ) + depends_on("libiberty+pic", when="+internal-dyninst") + depends_on("intel-tbb@2019:2020.3", when="~internal-tbb") + depends_on("sqlite", when="@7.1:") + depends_on("elfutils") + depends_on("m4") + depends_on("texinfo") + depends_on("libunwind", type=("build", "run")) + depends_on("papi+shared", when="+papi") + depends_on("mpi", when="+mpi") + depends_on("tau", when="+tau") + depends_on("caliper", when="+caliper") + depends_on("python@3:", when="+python", type=("build", "run")) + depends_on("libunwind", when="+rocm") + depends_on("autoconf", when="+rocm") + depends_on("automake", when="+rocm") + depends_on("libtool", when="+rocm") + depends_on("sqlite", when="@7.1:") + with when("+rocm"): + for ver in ["6.3.0", "6.3.1", "6.3.2", "6.3.3"]: + depends_on(f"roctracer-dev@{ver}", when=f"@{ver}") + depends_on(f"rocprofiler-dev@{ver}", when=f"@{ver}") + + for ver in ["6.3.0", "6.3.1", "6.3.2", "6.3.3", "6.4.0", "6.4.1", "6.4.2", "6.4.3"]: + depends_on(f"rocm-smi-lib@{ver}", when=f"@{ver}") + + for ver in [ + "6.3.0", + "6.3.1", + "6.3.2", + "6.3.3", + "6.4.0", + "6.4.1", + "6.4.2", + "6.4.3", + "7.0.0", + "7.0.2", + "7.1.0", + "7.1.1", + "7.2.0", + ]: + depends_on(f"hip@{ver}", when=f"@{ver}") + + for ver in [ + "6.4.0", + "6.4.1", + "6.4.2", + "6.4.3", + "7.0.0", + "7.0.2", + "7.1.0", + "7.1.1", + "7.2.0", + ]: + depends_on(f"rocprofiler-sdk@{ver}", when=f"@{ver}") + + for ver in ["7.0.0", "7.0.2", "7.1.0", "7.1.1", "7.2.0"]: + depends_on(f"amdsmi@{ver}", when=f"@{ver}") + + # Fix GCC 13 build failure caused by a missing include of in dyninst + patch( + "https://github.com/ROCm/dyninst/commit/09e781d414c83b4ad587083d449a3e976546937d.patch?full_index=1", + sha256="e64c6b75393e7fbd711c0bd0233628c176a352cd10b4057f00eec283426eaf0a", + when="@:6.4.0 +internal-dyninst", + working_dir="external/dyninst", + ) + patch( + "https://github.com/ROCm/timemory/commit/b5e41aa9e4b83ab0868211d81924ac4f639bd998.patch?full_index=1", + sha256="2696f59dd9b6e74bf44bfcc56a0536c3f1f3845c29fac18f0224dee72bd9225f", + when="%rocmcc", + working_dir="external/timemory", + ) + + @property + def root_cmakelists_dir(self): + if self.spec.satisfies("@:7.1"): + return "." + else: + return "projects/rocprofiler-systems" + + def cmake_args(self): + spec = self.spec + + args = [ + self.define("SPACK_BUILD", True), + self.define("ROCPROFSYS_BUILD_PAPI", False), + self.define("ROCPROFSYS_BUILD_PYTHON", True), + self.define("ROCPROFSYS_BUILD_LIBUNWIND", False), + self.define("ROCPROFSYS_BUILD_STATIC_LIBGCC", False), + self.define("ROCPROFSYS_BUILD_STATIC_LIBSTDCXX", False), + self.define_from_variant("ROCPROFSYS_BUILD_DYNINST", "internal-dyninst"), + self.define_from_variant("ROCPROFSYS_BUILD_LTO", "ipo"), + self.define_from_variant("ROCPROFSYS_USE_MPI", "mpi"), + self.define_from_variant("ROCPROFSYS_USE_OMPT", "ompt"), + self.define_from_variant("ROCPROFSYS_USE_PAPI", "papi"), + self.define_from_variant("ROCPROFSYS_USE_RCCL", "rocm"), + self.define_from_variant("ROCPROFSYS_USE_PYTHON", "python"), + self.define_from_variant("ROCPROFSYS_USE_MPI_HEADERS", "mpi_headers"), + self.define_from_variant("ROCPROFSYS_STRIP_LIBRARIES", "strip"), + self.define_from_variant("ROCPROFSYS_INSTALL_PERFETTO_TOOLS", "perfetto_tools"), + self.define("ElfUtils_ROOT_DIR", spec["elfutils"].prefix), + # timemory arguments + self.define("TIMEMORY_BUILD_CALIPER", False), + self.define_from_variant("TIMEMORY_USE_TAU", "tau"), + self.define_from_variant("TIMEMORY_USE_CALIPER", "caliper"), + ] + if spec.satisfies("@:6.3"): + args.append(self.define_from_variant("ROCPROFSYS_USE_ROCM_SMI", "rocm")) + args.append(self.define_from_variant("ROCPROFSYS_USE_HIP", "rocm")) + args.append(self.define_from_variant("ROCPROFSYS_USE_ROCTRACER", "rocm")) + args.append(self.define_from_variant("ROCPROFSYS_USE_ROCPROFILER", "rocm")) + else: + args.append(self.define_from_variant("ROCPROFSYS_USE_ROCM", "rocm")) + + if "+tau" in spec: + tau_root = spec["tau"].prefix + args.append(self.define("TAU_ROOT_DIR", tau_root)) + + if "+mpi" in spec: + args.append(self.define("MPI_C_COMPILER", spec["mpi"].mpicc)) + args.append(self.define("MPI_CXX_COMPILER", spec["mpi"].mpicxx)) + + if spec.satisfies("@6.3:"): + args.append(self.define("dl_LIBRARY", "dl")) + args.append( + self.define("libunwind_INCLUDE_DIR", self.spec["libunwind"].prefix.include) + ) + if spec.satisfies("@7.0:"): + args.append(self.define_from_variant("ROCPROFSYS_BUILD_TBB", "internal-tbb")) + if spec.satisfies("+internal-dyninst"): + args.append(self.define_from_variant("DYNINST_BUILD_TBB", "internal-tbb")) + if spec.satisfies("+internal-boost"): + args.append(self.define_from_variant("ROCPROFSYS_BUILD_BOOST", "internal-boost")) + if spec.satisfies("@7.2:"): + args.append(self.define("libunwind_ROOT", self.spec["libunwind"].prefix)) + return args + + ## newer glibc have lintl inlcuded + # def flag_handler(self, name, flags): + # if self.spec.satisfies("@6.3:"): + # if name == "ldflags": + # flags.append("-lintl") + # return (flags, None, None) + + @classmethod + def determine_version(cls, exe): + output = Executable(exe)("--version", output=str, error=str) + match = re.search(r"rocm: v(\d+)\.(\d+)", output) + if match: + ver = "{0}.{1}".format(int(match.group(1)), int(match.group(2))) + else: + ver = None + return ver + + def setup_build_environment(self, env: EnvironmentModifications) -> None: + if "+tau" in self.spec: + import glob + + # below is how TAU_MAKEFILE is set in packages/tau/package.py + pattern = join_path(self.spec["tau"].prefix.lib, "Makefile.*") + files = glob.glob(pattern) + if files: + env.set("TAU_MAKEFILE", files[0]) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/repo.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/repo.yaml new file mode 100644 index 000000000..9a8f0ae84 --- /dev/null +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/repo.yaml @@ -0,0 +1,2 @@ +repo: + namespace: dpcpp From b47f22999ca42b17974092a4fe09581c10a9a1f9 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 13 May 2026 13:57:26 +0200 Subject: [PATCH 02/13] Add the uenv to the config as well --- config.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config.yaml b/config.yaml index 960b4e463..25d6970d9 100644 --- a/config.yaml +++ b/config.yaml @@ -351,6 +351,10 @@ uenvs: santis: [gh200] bristen: [a100] eiger: [zen2] + prgenv-gnu-dpcpp: + "25.11": + recipes: + amdgpu: 25.11/amdgpu prgenv-gnu-openmpi: "25.12": recipes: From 3a5a830d1c19b34cf5d038ce8dc4916104141ca6 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 13 May 2026 14:00:35 +0200 Subject: [PATCH 03/13] Fix recipe --- config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 25d6970d9..880c2e3bf 100644 --- a/config.yaml +++ b/config.yaml @@ -354,7 +354,7 @@ uenvs: prgenv-gnu-dpcpp: "25.11": recipes: - amdgpu: 25.11/amdgpu + mi200: 25.11/amdgpu prgenv-gnu-openmpi: "25.12": recipes: From 511bb3c33fa8c76d34452b6eb00d7268ee3b4835 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 13 May 2026 16:02:36 +0200 Subject: [PATCH 04/13] See if only building for gfx942 fixes the issue --- recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml index ef91722d0..afb791898 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml @@ -74,8 +74,8 @@ gcc-env: variants: - +mpi - +rocm - - amdgpu_target=gfx942,gfx90a - - amdgpu_target_sram_ecc=gfx942,gfx90a + - amdgpu_target=gfx942 + - amdgpu_target_sram_ecc=gfx942 - ^python@3.12.12 views: default: From 8e2fa91a6fd486bd54ca36b503b3191701c2866f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 13 May 2026 16:02:50 +0200 Subject: [PATCH 05/13] Try to fix issue with comgr and hip libraries --- .../amdgpu/repo/packages/llvmdpcpp/package.py | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index 5acda9226..496eaf339 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -46,8 +46,15 @@ class Llvmdpcpp(CMakePackage): depends_on("zstd", type="link") # HIP/ROCm dependencies - # Unified Runtime HIP adapter needs HIP headers/lib and HSA headers + # Unified Runtime HIP adapter needs HIP headers/lib, COMGR headers/lib, and HSA headers. + # Note: the UR HIP CMakeLists.txt uses a single UR_HIP_INCLUDE_DIR for both + # hip and amd_comgr headers, and a single UR_HIP_LIB_DIR for both + # libamdhip64.so and libamd_comgr.so. In a monolithic /opt/rocm install + # these all live together, but Spack splits them across separate prefixes. + # We create a symlink-farm staging directory at build time (see + # _create_rocm_staging_dirs below) to satisfy the UR adapter checks. depends_on("hip", when="+hip") + depends_on("comgr", when="+hip") depends_on("hsa-rocr-dev", when="+hip") depends_on("llvm-amdgpu", when="+hip") @@ -56,6 +63,35 @@ class Llvmdpcpp(CMakePackage): generator("ninja") + def _create_rocm_staging_dirs(self): + """Create staging include/lib directories merging hip and comgr prefixes. + + The UR HIP adapter (unified-runtime/source/adapters/hip/CMakeLists.txt) + uses a single UR_HIP_INCLUDE_DIR to look for both HIP headers and the + amd_comgr.h header, and a single UR_HIP_LIB_DIR for both libamdhip64.so + and libamd_comgr.so. In a monolithic ROCm install these share the same + directory; in Spack they are in separate prefixes. We create symlink + farms under the source staging path to satisfy both checks. + """ + staging = os.path.join(self.stage.source_path, "spack-rocm-staging") + inc_staging = os.path.join(staging, "include") + lib_staging = os.path.join(staging, "lib") + os.makedirs(inc_staging, exist_ok=True) + os.makedirs(lib_staging, exist_ok=True) + + for pkg_name in ["hip", "comgr"]: + pkg_spec = self.spec[pkg_name] + for subdir, staging_dir in [("include", inc_staging), ("lib", lib_staging)]: + src_dir = os.path.join(pkg_spec.prefix, subdir) + if os.path.isdir(src_dir): + for entry in os.listdir(src_dir): + src = os.path.join(src_dir, entry) + dst = os.path.join(staging_dir, entry) + if not os.path.exists(dst): + os.symlink(src, dst) + + return inc_staging, lib_staging + @property def root_cmakelists_dir(self): """The CMakeLists.txt is in the llvm subdirectory.""" @@ -136,19 +172,16 @@ def cmake_args(self): ) if spec.satisfies("+hip"): - # Unified Runtime HIP adapter variables (configure.py: UR_HIP_ROCM_DIR) - # Spack separates ROCm into individual packages, so provide each path: - hip_prefix = spec["hip"].prefix + # Create staging dirs that merge hip + comgr headers/libs into a + # single directory tree, as required by the UR HIP adapter. + inc_staging, lib_staging = self._create_rocm_staging_dirs() hsa_prefix = spec["hsa-rocr-dev"].prefix args.extend([ self.define("SYCL_BUILD_UR_HIP_PLATFORM", "AMD"), - # HIP include/lib directories for the UR HIP adapter - self.define("UR_HIP_INCLUDE_DIR", - os.path.join(hip_prefix, "include")), + self.define("UR_HIP_INCLUDE_DIR", inc_staging), self.define("UR_HIP_HSA_INCLUDE_DIR", os.path.join(hsa_prefix, "include")), - self.define("UR_HIP_LIB_DIR", - os.path.join(hip_prefix, "lib")), + self.define("UR_HIP_LIB_DIR", lib_staging), ]) return args From a69df4205e3fcc79f7db3d4c3b68f6954e714f95 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Wed, 13 May 2026 18:06:37 +0200 Subject: [PATCH 06/13] Use the correct gcc version --- .../25.11/amdgpu/repo/packages/llvmdpcpp/package.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index 496eaf339..36fefafad 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -159,6 +159,13 @@ def cmake_args(self): self.define("BUG_REPORT_URL", "https://github.com/intel/llvm/issues"), # libclc runtime targets (mirrors configure.py libclc_enabled path) self.define("LLVM_RUNTIME_TARGETS", ";".join(runtime_targets)), + # Explicitly set the host compiler used to BUILD llvm/clang itself. + # Without this, CMake falls back to whatever /usr/bin/c++ resolves to + # (GCC 7.5 on SLES 15), which lacks the C++17 CTAD support required + # by recent intel/llvm sycl code (e.g. FactsGenerator.cpp uses + # `ArrayRef Args = {ptr, size}` deduction that needs GCC >= 9). + self.define("CMAKE_C_COMPILER", self.compiler.cc), + self.define("CMAKE_CXX_COMPILER", self.compiler.cxx), ] # Add per-runtime libclc enablement (configure.py pattern) From f94d2ab986f0a4609bfce4b75160a5402b29c288 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 09:44:38 +0200 Subject: [PATCH 07/13] Trying to fix build failures --- recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml | 5 ++++- .../25.11/amdgpu/repo/packages/llvmdpcpp/package.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml index afb791898..04bc406ba 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml @@ -65,7 +65,10 @@ gcc-env: - hipsparse - hipfft - hipblas-common - - hipdnn + # hipdnn excluded: MiopenLegacyPlugin.hpp uses #pragma once which is treated + # as an error by amdclang++ (-Werror=portability-avoid-pragma-once). + # miopen-hip is similarly excluded in prgenv-gnu/7.2.0/amdgpu. + # - hipdnn # networking - rccl # commits pinned for reproducibility, not bugs; update when updating recipe diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index 36fefafad..aa8c3c1bf 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -164,8 +164,8 @@ def cmake_args(self): # (GCC 7.5 on SLES 15), which lacks the C++17 CTAD support required # by recent intel/llvm sycl code (e.g. FactsGenerator.cpp uses # `ArrayRef Args = {ptr, size}` deduction that needs GCC >= 9). - self.define("CMAKE_C_COMPILER", self.compiler.cc), - self.define("CMAKE_CXX_COMPILER", self.compiler.cxx), + self.define("CMAKE_C_COMPILER", spack_cc), + self.define("CMAKE_CXX_COMPILER", spack_cxx), ] # Add per-runtime libclc enablement (configure.py pattern) From 22f105f64ca6dcc45cbd275e5fe363cad00b638f Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 10:26:57 +0200 Subject: [PATCH 08/13] Try with the spack env variables --- .../amdgpu/repo/packages/llvmdpcpp/package.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index aa8c3c1bf..96f755d53 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -159,15 +159,22 @@ def cmake_args(self): self.define("BUG_REPORT_URL", "https://github.com/intel/llvm/issues"), # libclc runtime targets (mirrors configure.py libclc_enabled path) self.define("LLVM_RUNTIME_TARGETS", ";".join(runtime_targets)), - # Explicitly set the host compiler used to BUILD llvm/clang itself. - # Without this, CMake falls back to whatever /usr/bin/c++ resolves to - # (GCC 7.5 on SLES 15), which lacks the C++17 CTAD support required - # by recent intel/llvm sycl code (e.g. FactsGenerator.cpp uses - # `ArrayRef Args = {ptr, size}` deduction that needs GCC >= 9). - self.define("CMAKE_C_COMPILER", spack_cc), - self.define("CMAKE_CXX_COMPILER", spack_cxx), ] + # Explicitly set the host compiler used to BUILD llvm/clang itself. + # Without this, CMake falls back to whatever /usr/bin/c++ resolves to + # (GCC 7.5 on SLES 15), which lacks the C++17 CTAD support required + # by recent intel/llvm sycl code (e.g. FactsGenerator.cpp uses + # `ArrayRef Args = {ptr, size}` deduction that needs GCC >= 9). + # self.compiler is NOT accessible in the Spack 1.x builder context; + # Spack sets SPACK_CC/SPACK_CXX to actual compiler paths before cmake. + spack_cc = os.environ.get("SPACK_CC") + spack_cxx = os.environ.get("SPACK_CXX") + if spack_cc: + args.append(self.define("CMAKE_C_COMPILER", spack_cc)) + if spack_cxx: + args.append(self.define("CMAKE_CXX_COMPILER", spack_cxx)) + # Add per-runtime libclc enablement (configure.py pattern) for target in runtime_targets: if target != "default": From 73b26f7f1b2d7846d4bd973c62ae05578852d069 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 11:12:27 +0200 Subject: [PATCH 09/13] Try setting as cxx gcc explicitly --- recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml index 04bc406ba..d5251b31f 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml @@ -7,7 +7,7 @@ gcc-env: strategy: full specs: # Intel DPC++ SYCL compiler with HIP/ROCm backend - - llvmdpcpp@sycl +clang +hip + - llvmdpcpp@sycl +clang +hip %cxx=gcc # Base development tools (from prgenv-gnu-dpcpp/25.11) - boost@1.88.0 +chrono +filesystem +iostreams +mpi +python +regex +serialization +shared +system +timer - cmake From 2eb4a53aa01950cfdcf165aaa86aa0b8b4c0a5a1 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 11:46:18 +0200 Subject: [PATCH 10/13] Trying to build intel dpcpp with the llvmamdgpu clang --- .../25.11/amdgpu/environments.yaml | 2 +- .../amdgpu/repo/packages/llvmdpcpp/package.py | 28 ++++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml index d5251b31f..04bc406ba 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/environments.yaml @@ -7,7 +7,7 @@ gcc-env: strategy: full specs: # Intel DPC++ SYCL compiler with HIP/ROCm backend - - llvmdpcpp@sycl +clang +hip %cxx=gcc + - llvmdpcpp@sycl +clang +hip # Base development tools (from prgenv-gnu-dpcpp/25.11) - boost@1.88.0 +chrono +filesystem +iostreams +mpi +python +regex +serialization +shared +system +timer - cmake diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index 96f755d53..a840cf275 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -161,19 +161,21 @@ def cmake_args(self): self.define("LLVM_RUNTIME_TARGETS", ";".join(runtime_targets)), ] - # Explicitly set the host compiler used to BUILD llvm/clang itself. - # Without this, CMake falls back to whatever /usr/bin/c++ resolves to - # (GCC 7.5 on SLES 15), which lacks the C++17 CTAD support required - # by recent intel/llvm sycl code (e.g. FactsGenerator.cpp uses - # `ArrayRef Args = {ptr, size}` deduction that needs GCC >= 9). - # self.compiler is NOT accessible in the Spack 1.x builder context; - # Spack sets SPACK_CC/SPACK_CXX to actual compiler paths before cmake. - spack_cc = os.environ.get("SPACK_CC") - spack_cxx = os.environ.get("SPACK_CXX") - if spack_cc: - args.append(self.define("CMAKE_C_COMPILER", spack_cc)) - if spack_cxx: - args.append(self.define("CMAKE_CXX_COMPILER", spack_cxx)) + # Use llvm-amdgpu clang/clang++ as the host compiler to build intel/llvm. + # This avoids the system GCC 7.5 fallback on SLES 15 and is more + # consistent with a clang-based build environment. + amdgpu_bin = os.path.join(spec["llvm-amdgpu"].prefix, "bin") + args.append(self.define("CMAKE_C_COMPILER", os.path.join(amdgpu_bin, "clang"))) + args.append(self.define("CMAKE_CXX_COMPILER", os.path.join(amdgpu_bin, "clang++"))) + + # Suppress pragma-once warnings-as-errors from AMD clang headers / third-party + # headers that use #pragma once (e.g. hipdnn's MiopenLegacyPlugin.hpp). + # -Wno-error=pragma-once-outside-header turns the promotion to error off + # while keeping any warning visible; -Wno-pragma-once-outside-header + # silences it entirely. + no_pragma_once_err = "-Wno-error=pragma-once-outside-header" + args.append(self.define("CMAKE_C_FLAGS", no_pragma_once_err)) + args.append(self.define("CMAKE_CXX_FLAGS", no_pragma_once_err)) # Add per-runtime libclc enablement (configure.py pattern) for target in runtime_targets: From dc270456ead72fa7f1e78026f81fc58dc0208efa Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 14:42:06 +0200 Subject: [PATCH 11/13] Add -fPIC flags as well --- .../25.11/amdgpu/repo/packages/llvmdpcpp/package.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index a840cf275..0a1e10ee2 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -173,9 +173,9 @@ def cmake_args(self): # -Wno-error=pragma-once-outside-header turns the promotion to error off # while keeping any warning visible; -Wno-pragma-once-outside-header # silences it entirely. - no_pragma_once_err = "-Wno-error=pragma-once-outside-header" - args.append(self.define("CMAKE_C_FLAGS", no_pragma_once_err)) - args.append(self.define("CMAKE_CXX_FLAGS", no_pragma_once_err)) + extra_flags = "-fPIC -Wno-error=pragma-once-outside-header" + args.append(self.define("CMAKE_C_FLAGS", extra_flags)) + args.append(self.define("CMAKE_CXX_FLAGS", extra_flags)) # Add per-runtime libclc enablement (configure.py pattern) for target in runtime_targets: From 247ba80ca2d176fea0468298c0c049d33c8d4572 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 15:45:54 +0200 Subject: [PATCH 12/13] Try static zstd --- .../25.11/amdgpu/repo/packages/llvmdpcpp/package.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index 0a1e10ee2..3d172831c 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -148,7 +148,10 @@ def cmake_args(self): self.define("LLVM_ENABLE_PROJECTS", llvm_projects), self.define("LLVM_BUILD_TOOLS", True), self.define("LLVM_ENABLE_ZSTD", True), - self.define("LLVM_USE_STATIC_ZSTD", True), + # Use shared libzstd.so — the Spack-built libzstd.a is not compiled + # with -fPIC, so ld.lld rejects it when linking shared libraries + # (e.g. libur_loader.so) with R_X86_64_PC32 relocation errors. + self.define("LLVM_USE_STATIC_ZSTD", False), self.define("SYCL_ENABLE_WERROR", False), self.define("SYCL_INCLUDE_TESTS", False), self.define("BUILD_SHARED_LIBS", False), From 00d7275dfad7feefcc782f23d2db8732c70d1140 Mon Sep 17 00:00:00 2001 From: Ioannis Magkanaris Date: Fri, 15 May 2026 16:42:13 +0200 Subject: [PATCH 13/13] Try disabling zstd --- .../25.11/amdgpu/repo/packages/llvmdpcpp/package.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py index 3d172831c..b2892c325 100644 --- a/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py +++ b/recipes/prgenv-gnu-dpcpp/25.11/amdgpu/repo/packages/llvmdpcpp/package.py @@ -147,11 +147,7 @@ def cmake_args(self): self.define("LLVM_EXTERNAL_SYCL_JIT_SOURCE_DIR", jit_dir), self.define("LLVM_ENABLE_PROJECTS", llvm_projects), self.define("LLVM_BUILD_TOOLS", True), - self.define("LLVM_ENABLE_ZSTD", True), - # Use shared libzstd.so — the Spack-built libzstd.a is not compiled - # with -fPIC, so ld.lld rejects it when linking shared libraries - # (e.g. libur_loader.so) with R_X86_64_PC32 relocation errors. - self.define("LLVM_USE_STATIC_ZSTD", False), + self.define("LLVM_ENABLE_ZSTD", False), self.define("SYCL_ENABLE_WERROR", False), self.define("SYCL_INCLUDE_TESTS", False), self.define("BUILD_SHARED_LIBS", False),