archspec: update version, translate renamed uarchs (#33556)

* Update archspec version

* Add a translation table from old names
This commit is contained in:
Massimiliano Culpo
2022-11-07 13:50:38 +01:00
committed by GitHub
parent f8e4ad5209
commit e045dabb3a
4 changed files with 288 additions and 24 deletions

View File

@@ -3,6 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import functools
import warnings
import six
@@ -34,6 +35,14 @@ def _impl(self, other):
return _impl
#: Translation table from archspec deprecated names
_DEPRECATED_ARCHSPEC_NAMES = {
"graviton": "cortex_a72",
"graviton2": "neoverse_n1",
"graviton3": "neoverse_v1",
}
class Target(object):
def __init__(self, name, module_name=None):
"""Target models microarchitectures and their compatibility.
@@ -45,6 +54,10 @@ def __init__(self, name, module_name=None):
like Cray (e.g. craype-compiler)
"""
if not isinstance(name, archspec.cpu.Microarchitecture):
if name in _DEPRECATED_ARCHSPEC_NAMES:
msg = "'target={}' is deprecated, use 'target={}' instead"
name, old_name = _DEPRECATED_ARCHSPEC_NAMES[name], name
warnings.warn(msg.format(old_name, name))
name = archspec.cpu.TARGETS.get(name, archspec.cpu.generic_microarchitecture(name))
self.microarchitecture = name
self.module_name = module_name