diff options
author | Kevin Pedretti <ktpedre@users.noreply.github.com> | 2021-10-05 13:22:55 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 19:22:55 +0000 |
commit | 47607dcac5928432be8abad1360c4c357809e363 (patch) | |
tree | c5e60fac2e9486dceacc99e8040d58ea5cb3f616 /lib | |
parent | d998ea1bd41b4cf7f47caa734b7c7df86178ef0c (diff) | |
download | spack-47607dcac5928432be8abad1360c4c357809e363.tar.gz spack-47607dcac5928432be8abad1360c4c357809e363.tar.bz2 spack-47607dcac5928432be8abad1360c4c357809e363.tar.xz spack-47607dcac5928432be8abad1360c4c357809e363.zip |
Use gnuconfig package for config file replacement for RISC-V. (#26364)
* Use gnuconfig package for config file replacement for RISC-V.
This extends the changes in #26035 to handle RISC-V. Before this change,
many packages fail to configure on riscv64 due to config.guess being too
old to know about RISC-V. This is seen out of the box when clingo fails
to build from source due to pkgconfig failing to configure, throwing
error: "configure: error: cannot guess build type; you must specify one".
* Add riscv64 architecture
* Update vendored archspec from upstream project.
These archspec updates include changes needed to support riscv64.
* Update archspec's __init__.py to reflect the commit hash of archspec being used.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/external/__init__.py | 2 | ||||
-rw-r--r-- | lib/spack/external/archspec/README.md | 13 | ||||
-rw-r--r-- | lib/spack/external/archspec/cpu/detect.py | 19 | ||||
-rw-r--r-- | lib/spack/external/archspec/json/cpu/microarchitectures.json | 38 | ||||
-rw-r--r-- | lib/spack/spack/build_systems/autotools.py | 24 |
5 files changed, 86 insertions, 10 deletions
diff --git a/lib/spack/external/__init__.py b/lib/spack/external/__init__.py index 112ad9e9af..b2acccd8cc 100644 --- a/lib/spack/external/__init__.py +++ b/lib/spack/external/__init__.py @@ -11,7 +11,7 @@ archspec * Homepage: https://pypi.python.org/pypi/archspec * Usage: Labeling, comparison and detection of microarchitectures -* Version: 0.1.2 (commit 8940a8b099a54ded21f8cf4314c4b83b558bb6d1) +* Version: 0.1.2 (commit 85757b6666422fca86aa882a769bf78b0f992f54) argparse -------- diff --git a/lib/spack/external/archspec/README.md b/lib/spack/external/archspec/README.md index 015eb684b5..fb1eaebda3 100644 --- a/lib/spack/external/archspec/README.md +++ b/lib/spack/external/archspec/README.md @@ -49,6 +49,19 @@ $ tox congratulations :) ``` +## Citing Archspec + +If you are referencing `archspec` in a publication, please cite the following +paper: + + * Massimiliano Culpo, Gregory Becker, Carlos Eduardo Arango Gutierrez, Kenneth + Hoste, and Todd Gamblin. + [**`archspec`: A library for detecting, labeling, and reasoning about + microarchitectures**](https://tgamblin.github.io/pubs/archspec-canopie-hpc-2020.pdf). + In *2nd International Workshop on Containers and New Orchestration Paradigms + for Isolated Environments in HPC (CANOPIE-HPC'20)*, Online Event, November + 12, 2020. + ## License Archspec is distributed under the terms of both the MIT license and the diff --git a/lib/spack/external/archspec/cpu/detect.py b/lib/spack/external/archspec/cpu/detect.py index 56b73b3a75..31cde2af6d 100644 --- a/lib/spack/external/archspec/cpu/detect.py +++ b/lib/spack/external/archspec/cpu/detect.py @@ -306,3 +306,22 @@ def compatibility_check_for_aarch64(info, target): and (target.vendor == vendor or target.vendor == "generic") and target.features.issubset(features) ) + + +@compatibility_check(architecture_family="riscv64") +def compatibility_check_for_riscv64(info, target): + """Compatibility check for riscv64 architectures.""" + basename = "riscv64" + uarch = info.get("uarch") + + # sifive unmatched board + if uarch == "sifive,u74-mc": + uarch = "u74mc" + # catch-all for unknown uarchs + else: + uarch = "riscv64" + + arch_root = TARGETS[basename] + return (target == arch_root or arch_root in target.ancestors) and ( + target == uarch or target.vendor == "generic" + ) diff --git a/lib/spack/external/archspec/json/cpu/microarchitectures.json b/lib/spack/external/archspec/json/cpu/microarchitectures.json index 40f59bfd9e..0be30c25e0 100644 --- a/lib/spack/external/archspec/json/cpu/microarchitectures.json +++ b/lib/spack/external/archspec/json/cpu/microarchitectures.json @@ -2017,6 +2017,44 @@ "features": [], "compilers": { } + }, + "riscv64": { + "from": [], + "vendor": "generic", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "7.1:", + "flags" : "-march=rv64gc" + } + ], + "clang": [ + { + "versions": "9.0:", + "flags" : "-march=rv64gc" + } + ] + } + }, + "u74mc": { + "from": ["riscv64"], + "vendor": "SiFive", + "features": [], + "compilers": { + "gcc": [ + { + "versions": "10.2:", + "flags" : "-march=rv64gc -mtune=sifive-7-series" + } + ], + "clang" : [ + { + "versions": "12.0:", + "flags" : "-march=rv64gc -mtune=sifive-7-series" + } + ] + } } }, "feature_aliases": { diff --git a/lib/spack/spack/build_systems/autotools.py b/lib/spack/spack/build_systems/autotools.py index 9a00764e22..f6ac0b3821 100644 --- a/lib/spack/spack/build_systems/autotools.py +++ b/lib/spack/spack/build_systems/autotools.py @@ -60,16 +60,18 @@ class AutotoolsPackage(PackageBase): def patch_config_files(self): """ Whether or not to update old ``config.guess`` and ``config.sub`` files - distributed with the tarball. This currently only applies to ``ppc64le:`` - and ``aarch64:`` target architectures. The substitutes are taken from the - ``gnuconfig`` package, which is automatically added as a build dependency - for these architectures. In case system versions of these config files are - required, the ``gnuconfig`` package can be marked external with a prefix - pointing to the directory containing the system ``config.guess`` and - ``config.sub`` files. + distributed with the tarball. This currently only applies to + ``ppc64le:``, ``aarch64:``, and ``riscv64`` target architectures. The + substitutes are taken from the ``gnuconfig`` package, which is + automatically added as a build dependency for these architectures. In + case system versions of these config files are required, the + ``gnuconfig`` package can be marked external with a prefix pointing to + the directory containing the system ``config.guess`` and ``config.sub`` + files. """ return (self.spec.satisfies('target=ppc64le:') - or self.spec.satisfies('target=aarch64:')) + or self.spec.satisfies('target=aarch64:') + or self.spec.satisfies('target=riscv64:')) #: Whether or not to update ``libtool`` #: (currently only for Arm/Clang/Fujitsu compilers) @@ -99,6 +101,7 @@ class AutotoolsPackage(PackageBase): depends_on('gnuconfig', type='build', when='target=ppc64le:') depends_on('gnuconfig', type='build', when='target=aarch64:') + depends_on('gnuconfig', type='build', when='target=riscv64:') @property def _removed_la_files_log(self): @@ -121,7 +124,8 @@ class AutotoolsPackage(PackageBase): """Some packages ship with older config.guess/config.sub files and need to have these updated when installed on a newer architecture. In particular, config.guess fails for PPC64LE for version prior - to a 2013-06-10 build date (automake 1.13.4) and for ARM (aarch64). + to a 2013-06-10 build date (automake 1.13.4) and for ARM (aarch64) and + RISC-V (riscv64). """ if not self.patch_config_files: return @@ -133,6 +137,8 @@ class AutotoolsPackage(PackageBase): config_arch = 'ppc64le' elif self.spec.satisfies('target=aarch64:'): config_arch = 'aarch64' + elif self.spec.satisfies('target=riscv64:'): + config_arch = 'riscv64' else: config_arch = 'local' |