add hip-lang as a language virtual

This commit is contained in:
Harmen Stoppels 2025-03-21 09:58:06 +01:00
parent 1a57df46f6
commit d17c118a78
3 changed files with 20 additions and 0 deletions

View File

@ -33,6 +33,7 @@ packages:
glu: [mesa-glu, openglu]
golang: [go, gcc]
go-or-gccgo-bootstrap: [go-bootstrap, gcc]
hip-lang: [llvm-amdgpu]
iconv: [libiconv]
ipp: [intel-oneapi-ipp]
java: [openjdk, jdk]

View File

@ -1421,6 +1421,7 @@ compiler(Compiler) :- compiler_supports_target(Compiler, _, _).
language("c").
language("cxx").
language("fortran").
language("hip-lang").
language_runtime("fortran-rt").
error(10, "Only external, or concrete, compilers are allowed for the {0} language", Language)

View File

@ -59,6 +59,7 @@ class LlvmAmdgpu(CMakePackage, LlvmDetection, CompilerPackage):
version("5.3.0", sha256="4e3fcddb5b8ea8dcaa4417e0e31a9c2bbdc9e7d4ac3401635a636df32905c93e")
provides("c", "cxx")
provides("hip-lang")
provides("fortran")
variant(
@ -372,3 +373,20 @@ def _cxx_path(self):
def _fortran_path(self):
return os.path.join(self.spec.prefix.bin, "amdflang")
@classmethod
def runtime_constraints(cls, *, spec, pkg):
"""Callback function to inject runtime-related rules into the solver.
Rule-injection is obtained through method calls of the ``pkg`` argument.
Args:
spec: spec that will inject runtime dependencies
pkg: object used to forward information to the solver
"""
pkg("*").depends_on(
"hip +rocm",
when="%[virtuals=hip-lang] llvm-amdgpu",
type="link",
description="If any package uses %llvm-amdgpu for hip-lang, it depends on hip",
)