Skip to content

[WIP] hip-lang support - #4411

Open
scheibelp wants to merge 73 commits into
spack:developfrom
scheibelp:hip-lang
Open

scheibelp wants to merge 73 commits into
spack:developfrom
scheibelp:hip-lang

Conversation

@scheibelp

@scheibelp scheibelp commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

Apply changes from spack/spack#49673 that apply to spack-packages.

Needs

Interacts with:

Notes:

  • HIP language support spack#49673 changed SPACK_TEST_COMMAND=dump-env to dump-var, but that would be harder to change (the tests that use this are in spack-core ) and it didn't look essential
  • I edited a few cases of requires("%[virtuals=c,cxx] llvm-amdgpu") to include when='%c' to accommodate externals that do not specify a compiler (and in a couple cases I swapped requires for depends_on for the same reason)

Other than that this should be a copy of spack/spack#49673

@spackbot-triage spackbot-triage Bot added dependencies Modifications with a `depends_on()` directive virtual-dependencies Modifications to virtual package dependencies update-package Modifications to packages in the repository labels Apr 20, 2026
Apply changes from spack/spack#49673 that apply to
spack-packages.

Co-authored-by: Peter Scheibel <scheibel1@llnl.gov>
Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
@scheibelp

Copy link
Copy Markdown
Member Author

This will have to update the Spack commit used in .ci/env to use at least a5b4056 (from March 27) to pass the package audit (Currently pinned to a commit from March 20)

@haampie

haampie commented Apr 21, 2026

Copy link
Copy Markdown
Member

You have to bump the package api

Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
…rom spack core

Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
@scheibelp
scheibelp requested a review from a team as a code owner April 21, 2026 18:28
… as of March 26, preceding new commit that is used)

Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
@spackbot-triage spackbot-triage Bot added the tests General test capability(ies) label Apr 21, 2026
Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
Comment thread repos/spack_repo/builtin/build_systems/rocm.py Outdated
Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
@spackbot-triage
spackbot-triage Bot requested a review from haampie April 21, 2026 22:51
depends_on("zlib-api", type="link")
depends_on("z3", type="link")
depends_on("ncurses", type="link")
requires("%[virtuals=c,cxx] llvm-amdgpu", when="%c")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The when=%c can be dropped here and elsewhere, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to be able to create a comgr external without having to specify %llvm-amdgpu on the spec

@alalazo alalazo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the comment, we may want to delay merging this, so that the next release of the repository is still readable by Spack v1.1

Comment thread repos/spack_repo/builtin/repo.yaml Outdated
Signed-off-by: Peter Josef Scheibel <scheibel1@llnl.gov>
@spackbot-triage
spackbot-triage Bot requested a review from haampie August 13, 2026 02:16
rbberger pushed a commit that referenced this pull request Aug 19, 2026
* extract legion changes for rocm build from #4411

* this issue has been fixed for legion after 26.06
Comment on lines +145 to +148
needs: [hip-compiler]
- group: hip-compiler
specs:
- llvm-amdgpu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Language dependents (i.e. things that need compilers), need those providers to be available "before" they concretize, either as an installed package, an external, or as a spec group.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, so this is still a holdover from when compilers were not dependencies? Hopefully we can bootstrap compilers someday as well, I know Harmen is working on that. Is this something that should also be done for things like rust and cuda? Or are they different because they can be bootstrapped (kinda)?

I'm fine with these changes. Wonder if we should use require instead of prefer, but I defer to you on that.

@adrienbernede

Copy link
Copy Markdown
Collaborator

@scheibelp it looks like CachedCMakePackages should be updated too.

I also created this branch in radiuss-spack-configs to trigger tests of the present PR:
llnl/radiuss-spack-configs#200

It currently fails building camp in our setup.

-- BLT HIP support is ON
-- Creating BLT HIP targets...
-- The HIP compiler identification is unknown
/usr/workspace/radiuss/rsc-ci/shared-ci/corona/zen/ref-woptim-test-spack-packages-pr-4411/install/[padded-to-128-chars]/linux-rhel8-zen/none-none/compiler-wrapper-1.2.0-u3zmgx5lweuq63gqi5macchrxwqy5ibp/libexec/spack/rocmcc/spackhip: line 213: exec: None: not found
CMake Error at /opt/rocm-6.4.3/lib/cmake/hip-lang/hip-lang-config.cmake:139 (message):
  hip-lang Error:127 - clangrt builtins lib could not be found.
Call Stack (most recent call first):
  /usr/tce/backend/installations/linux-rhel8-x86_64/gcc-10.3.1/cmake-3.25.2-2p7loskhisrpohhvpwdmse2nadqgzqcb/share/cmake-3.25/Modules/CMakeHIPInformation.cmake:146 (find_package)
  /usr/workspace/radiuss/rsc-ci/shared-ci/corona/zen/ref-woptim-test-spack-packages-pr-4411/install/[padded-to-128-chars]/linux-rhel8-zen/none-none/blt-0.7.2-kl55lhkpwul6ozj6bovps4ccjug4iogl/cmake/thirdparty/BLTSetupHIP.cmake:14 (enable_language)
  /usr/workspace/radiuss/rsc-ci/shared-ci/corona/zen/ref-woptim-test-spack-packages-pr-4411/install/[padded-to-128-chars]/linux-rhel8-zen/none-none/blt-0.7.2-kl55lhkpwul6ozj6bovps4ccjug4iogl/cmake/BLTSetupTargets.cmake:118 (include)
  /usr/workspace/radiuss/rsc-ci/shared-ci/corona/zen/ref-woptim-test-spack-packages-pr-4411/install/[padded-to-128-chars]/linux-rhel8-zen/none-none/blt-0.7.2-kl55lhkpwul6ozj6bovps4ccjug4iogl/cmake/SetupThirdParty.cmake:6 (include)
  /usr/workspace/radiuss/rsc-ci/shared-ci/corona/zen/ref-woptim-test-spack-packages-pr-4411/install/[padded-to-128-chars]/linux-rhel8-zen/none-none/blt-0.7.2-kl55lhkpwul6ozj6bovps4ccjug4iogl/SetupBLT.cmake:129 (include)
  cmake/load_blt.cmake:27 (include)
  CMakeLists.txt:48 (include)
-- Configuring incomplete, errors occurred!

I may need to update the hip config, or does this suppose an update of Spack itself ?

@scheibelp

Copy link
Copy Markdown
Member Author

@adrienbernede thanks for trying that. I'm wondering if you haven't added hip: to the compilers: extra attribute for llvm-amdgpu

    llvm-amdgpu:
      buildable: false
      externals:
      - spec: llvm-amdgpu@7.2.1
        prefix: /opt/rocm...
        extra_attributes:
          compilers:
            c: ...
            cxx: ...
            fortran: ...
            hip: (same thing as cxx, usually) <-------

I see in your pipeline concretization that it's choosing an external llvm-amdgpu, but didn't see a change to packages.yaml in your PR

I'm able to build camp+rocm with this PR (example config for llvm-amdgpu is in stacks/e4s-rocm-external/spack.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-systems Related to package build systems dependencies Modifications with a `depends_on()` directive don't-merge-yet new-version Modifications to packages' `depends_on()` directives update-package Modifications to packages in the repository virtual-dependencies Modifications to virtual package dependencies

Projects

None yet

Development

Successfully merging this pull request may close these issues.