nvptx-tools: add v2023-09-13 (#40897)

New changes have been made to nvptx-tools that address dropping support
for sm_30 in later CUDA versions (12.0+).

Also refactor gcc to make nvptx-tools a dependency instead of a resource.

Co-authored-by: Tamara Dahlgren <35777542+tldahlgren@users.noreply.github.com>
This commit is contained in:
Pranav Sivaraman 2024-03-05 16:51:40 -05:00 committed by GitHub
parent f35ff441f2
commit fa8fb7903b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 13 deletions

View file

@ -12,6 +12,7 @@
import llnl.util.tty as tty import llnl.util.tty as tty
from llnl.util.lang import classproperty from llnl.util.lang import classproperty
from llnl.util.symlink import readlink
import spack.platforms import spack.platforms
import spack.util.executable import spack.util.executable
@ -309,14 +310,10 @@ class Gcc(AutotoolsPackage, GNUMirrorPackage):
destination="newlibsource", destination="newlibsource",
fetch_options=timeout, fetch_options=timeout,
) )
# nvptx-tools does not seem to work as a dependency,
# but does fine when the source is inside the gcc build directory nvptx_tools_ver = "2023-09-13"
# nvptx-tools doesn't have any releases, so grabbing the last commit depends_on("nvptx-tools@" + nvptx_tools_ver, type="build")
resource(
name="nvptx-tools",
git="https://github.com/MentorEmbedded/nvptx-tools",
commit="d0524fbdc86dfca068db5a21cc78ac255b335be5",
)
# NVPTX offloading supported in 7 and later by limited languages # NVPTX offloading supported in 7 and later by limited languages
conflicts("@:6", msg="NVPTX only supported in gcc 7 and above") conflicts("@:6", msg="NVPTX only supported in gcc 7 and above")
conflicts("languages=ada") conflicts("languages=ada")
@ -860,6 +857,28 @@ def configure_args(self):
return options return options
# Copy nvptx-tools into the GCC install prefix
def copy_nvptx_tools(self):
nvptx_tools_bin_path = self.spec["nvptx-tools"].prefix.bin
gcc_bin_path = self.prefix.bin
mkdirp(gcc_bin_path)
copy_list = ["as", "ld", "nm", "run", "run-single"]
for file in copy_list:
fullname = f"nvptx-none-{file}"
copy(join_path(nvptx_tools_bin_path, fullname), join_path(gcc_bin_path, fullname))
link_list = ["ar", "ranlib"]
for file in link_list:
fullname = f"nvptx-none-{file}"
orig_target = readlink(join_path(nvptx_tools_bin_path, fullname))
symlink(orig_target, join_path(gcc_bin_path, fullname))
util_dir_path = join_path(self.prefix, "nvptx-none", "bin")
mkdirp(util_dir_path)
util_list = ["ar", "as", "ld", "nm", "ranlib"]
for file in util_list:
rel_target = join_path("..", "..", "bin", f"nvptx-none-{file}")
dest_link = join_path(util_dir_path, file)
symlink(rel_target, dest_link)
# run configure/make/make(install) for the nvptx-none target # run configure/make/make(install) for the nvptx-none target
# before running the host compiler phases # before running the host compiler phases
@run_before("configure") @run_before("configure")
@ -882,11 +901,7 @@ def nvptx_install(self):
"--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]), "--with-cuda-driver-lib={0}".format(spec["cuda"].libs.directories[0]),
] ]
with working_dir("nvptx-tools"): self.copy_nvptx_tools()
configure = Executable("./configure")
configure(*options)
make()
make("install")
pattern = join_path(self.stage.source_path, "newlibsource", "*") pattern = join_path(self.stage.source_path, "newlibsource", "*")
files = glob.glob(pattern) files = glob.glob(pattern)

View file

@ -15,6 +15,7 @@ class NvptxTools(AutotoolsPackage):
homepage = "https://github.com/MentorEmbedded/nvptx-tools" homepage = "https://github.com/MentorEmbedded/nvptx-tools"
git = "https://github.com/MentorEmbedded/nvptx-tools" git = "https://github.com/MentorEmbedded/nvptx-tools"
version("2023-09-13", commit="c321f1a3573dd89a12e3291d690207685a34df6e")
version("2021-05-21", commit="d0524fbdc86dfca068db5a21cc78ac255b335be5") version("2021-05-21", commit="d0524fbdc86dfca068db5a21cc78ac255b335be5")
version("2018-03-01", commit="5f6f343a302d620b0868edab376c00b15741e39e") version("2018-03-01", commit="5f6f343a302d620b0868edab376c00b15741e39e")