From cac44b9e157866f720becd6843ad5df1a1ba8b1d Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Fri, 21 Apr 2023 11:01:37 +0200 Subject: [PATCH] Update archspec to latest release (#37070) Fix -mcpu flags for gcc on neoverse-v1 Add support for NVHPC flags --- lib/spack/external/__init__.py | 2 +- lib/spack/external/archspec/__main__.py | 8 + .../archspec/cpu/microarchitecture.py | 15 +- .../archspec/json/cpu/microarchitectures.json | 207 ++++++++++++++++-- 4 files changed, 209 insertions(+), 23 deletions(-) create mode 100644 lib/spack/external/archspec/__main__.py diff --git a/lib/spack/external/__init__.py b/lib/spack/external/__init__.py index 7f083ba5d2..b30ecca8d4 100644 --- a/lib/spack/external/__init__.py +++ b/lib/spack/external/__init__.py @@ -18,7 +18,7 @@ * Homepage: https://pypi.python.org/pypi/archspec * Usage: Labeling, comparison and detection of microarchitectures -* Version: 0.2.0-dev (commit f3667f95030c6573842fb5f6df0d647285597509) +* Version: 0.2.0-dev (commit d02dadbac4fa8f3a60293c4fbfd59feadaf546dc) astunparse ---------------- diff --git a/lib/spack/external/archspec/__main__.py b/lib/spack/external/archspec/__main__.py new file mode 100644 index 0000000000..2321fb06a6 --- /dev/null +++ b/lib/spack/external/archspec/__main__.py @@ -0,0 +1,8 @@ +""" +Run the `archspec` CLI as a module. +""" + +import sys +from .cli import main + +sys.exit(main()) diff --git a/lib/spack/external/archspec/cpu/microarchitecture.py b/lib/spack/external/archspec/cpu/microarchitecture.py index 471c6f2074..fdc7707fda 100644 --- a/lib/spack/external/archspec/cpu/microarchitecture.py +++ b/lib/spack/external/archspec/cpu/microarchitecture.py @@ -268,15 +268,14 @@ def tuplify(ver): return flags msg = ( - "cannot produce optimized binary for micro-architecture '{0}'" - " with {1}@{2} [supported compiler versions are {3}]" - ) - msg = msg.format( - self.name, - compiler, - version, - ", ".join([x["versions"] for x in compiler_info]), + "cannot produce optimized binary for micro-architecture '{0}' with {1}@{2}" ) + if compiler_info: + versions = [x["versions"] for x in compiler_info] + msg += f' [supported compiler versions are {", ".join(versions)}]' + else: + msg += " [no supported compiler versions]" + msg = msg.format(self.name, compiler, version) raise UnsupportedMicroarchitecture(msg) diff --git a/lib/spack/external/archspec/json/cpu/microarchitectures.json b/lib/spack/external/archspec/json/cpu/microarchitectures.json index a2f6790ffc..786278f729 100644 --- a/lib/spack/external/archspec/json/cpu/microarchitectures.json +++ b/lib/spack/external/archspec/json/cpu/microarchitectures.json @@ -102,7 +102,8 @@ "name": "x86-64", "flags": "-march={name} -mtune=generic" } - ] + ], + "nvhpc": [] } }, "x86_64_v2": { @@ -157,7 +158,8 @@ "name": "x86-64-v2", "flags": "-march={name} -mtune=generic" } - ] + ], + "nvhpc": [] } }, "x86_64_v3": { @@ -228,6 +230,13 @@ "name": "x86-64-v3", "flags": "-march={name} -mtune=generic" } + ], + "nvhpc" : [ + { + "versions": ":", + "name": "px", + "flags": "-tp {name} -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mxsave" + } ] } }, @@ -304,6 +313,13 @@ "name": "x86-64-v4", "flags": "-march={name} -mtune=generic" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "px", + "flags": "-tp {name} -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl" + } ] } }, @@ -358,7 +374,8 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } - ] + ], + "nvhpc": [] } }, "core2": { @@ -412,7 +429,8 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } - ] + ], + "nvhpc": [] } }, "nehalem": { @@ -477,7 +495,8 @@ "name": "corei7", "flags": "-march={name} -mtune={name}" } - ] + ], + "nvhpc": [] } }, "westmere": { @@ -539,7 +558,8 @@ "name": "corei7", "flags": "-march={name} -mtune={name}" } - ] + ], + "nvhpc": [] } }, "sandybridge": { @@ -609,6 +629,12 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } ] } }, @@ -681,6 +707,12 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } ] } }, @@ -758,6 +790,12 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } ] } }, @@ -827,6 +865,13 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "haswell", + "flags": "-tp {name}" + } ] } }, @@ -899,6 +944,13 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "haswell", + "flags": "-tp {name}" + } ] } }, @@ -1063,6 +1115,13 @@ "name": "skylake-avx512", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } ] } }, @@ -1143,6 +1202,13 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } ] } }, @@ -1222,6 +1288,13 @@ "versions": ":", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } ] } }, @@ -1329,6 +1402,13 @@ "name": "icelake-client", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "skylake", + "flags": "-tp {name}" + } ] } }, @@ -1387,7 +1467,8 @@ "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", "flags": "-msse2" } - ] + ], + "nvhpc": [] } }, "bulldozer": { @@ -1451,6 +1532,12 @@ "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", "flags": "-msse3" } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } ] } }, @@ -1519,6 +1606,12 @@ "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", "flags": "-msse3" } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } ] } }, @@ -1588,6 +1681,13 @@ "warnings": "Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors", "flags": "-msse4.2" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "piledriver", + "flags": "-tp {name}" + } ] } }, @@ -1663,6 +1763,13 @@ "name": "core-avx2", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "piledriver", + "flags": "-tp {name}" + } ] } }, @@ -1741,6 +1848,12 @@ "name": "core-avx2", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "flags": "-tp {name}" + } ] } }, @@ -1820,6 +1933,12 @@ "name": "core-avx2", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": "20.5:", + "flags": "-tp {name}" + } ] } }, @@ -1902,6 +2021,12 @@ "name": "core-avx2", "flags": "-march={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": "21.11:", + "flags": "-tp {name}" + } ] } }, @@ -1982,7 +2107,15 @@ "name": "znver4", "flags": "-march={name} -mtune={name}" } - ] + ], + "nvhpc": [ + { + "versions": "21.11:", + "name": "zen3", + "flags": "-tp {name}", + "warnings": "zen4 is not fully supported by nvhpc yet, falling back to zen3" + } + ] } }, "ppc64": { @@ -2087,7 +2220,8 @@ "versions": ":", "flags": "-mcpu={name} -mtune={name}" } - ] + ], + "nvhpc": [] } }, "power8le": { @@ -2116,6 +2250,13 @@ "name": "power8", "flags": "-mcpu={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "pwr8", + "flags": "-tp {name}" + } ] } }, @@ -2139,6 +2280,13 @@ "name": "power9", "flags": "-mcpu={name} -mtune={name}" } + ], + "nvhpc": [ + { + "versions": ":", + "name": "pwr9", + "flags": "-tp {name}" + } ] } }, @@ -2170,7 +2318,8 @@ "versions": ":", "flags": "-march=armv8-a -mtune=generic" } - ] + ], + "nvhpc": [] } }, "armv8.1a": { @@ -2552,6 +2701,13 @@ "versions": "20:", "flags" : "-march=armv8.2-a+fp16+rcpc+dotprod+crypto" } + ], + "nvhpc" : [ + { + "versions": "22.5:", + "name": "neoverse-n1", + "flags": "-tp {name}" + } ] } }, @@ -2617,15 +2773,31 @@ "flags" : "-march=armv8.2-a+crypto+fp16 -mtune=cortex-a72" }, { - "versions": "8.0:8.9", + "versions": "8.0:8.4", "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" }, { - "versions": "9.0:9.9", + "versions": "8.5:8.9", "flags" : "-mcpu=neoverse-v1" }, - { - "versions": "10.0:", + { + "versions": "9.0:9.3", + "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "9.4:9.9", + "flags" : "-mcpu=neoverse-v1" + }, + { + "versions": "10.0:10.1", + "flags" : "-march=armv8.2-a+fp16+dotprod+crypto -mtune=cortex-a72" + }, + { + "versions": "10.2", + "flags" : "-mcpu=zeus" + }, + { + "versions": "10.3:", "flags" : "-mcpu=neoverse-v1" } @@ -2657,6 +2829,13 @@ "versions": "22:", "flags" : "-march=armv8.4-a+sve+ssbs+fp16+bf16+crypto+i8mm+rng" } + ], + "nvhpc" : [ + { + "versions": "22.5:", + "name": "neoverse-n1", + "flags": "-tp {name}" + } ] } },