Compare commits

...

1 Commits

Author SHA1 Message Date
Harmen Stoppels
8c8d54db5d archspec: bump 2025-05-21 11:30:30 +02:00
7 changed files with 759 additions and 618 deletions

View File

@ -9,8 +9,8 @@
import argparse import argparse
import typing import typing
import _vendoring.archspec from . import __version__ as archspec_version
import _vendoring.archspec.cpu from .cpu import host
def _make_parser() -> argparse.ArgumentParser: def _make_parser() -> argparse.ArgumentParser:
@ -24,7 +24,7 @@ def _make_parser() -> argparse.ArgumentParser:
"-V", "-V",
help="Show the version and exit.", help="Show the version and exit.",
action="version", action="version",
version=f"archspec, version {_vendoring.archspec.__version__}", version=f"archspec, version {archspec_version}",
) )
parser.add_argument("--help", "-h", help="Show the help and exit.", action="help") parser.add_argument("--help", "-h", help="Show the help and exit.", action="help")
@ -45,9 +45,9 @@ def _make_parser() -> argparse.ArgumentParser:
def cpu() -> int: def cpu() -> int:
"""Run the `_vendoring.archspec.cpu` subcommand.""" """Run the `archspec cpu` subcommand."""
try: try:
print(_vendoring.archspec.cpu.host()) print(host())
except FileNotFoundError as exc: except FileNotFoundError as exc:
print(exc) print(exc)
return 1 return 1

View File

@ -6,12 +6,11 @@
import functools import functools
import platform import platform
import re import re
import sys
import warnings import warnings
from typing import IO, List, Set, Tuple
import _vendoring.archspec from . import schema
import _vendoring.archspec.cpu.alias
import _vendoring.archspec.cpu.schema
from .alias import FEATURE_ALIASES from .alias import FEATURE_ALIASES
from .schema import LazyDictionary from .schema import LazyDictionary
@ -67,7 +66,7 @@ class Microarchitecture:
cpu_part (str): cpu part of the architecture, if relevant. cpu_part (str): cpu part of the architecture, if relevant.
""" """
# pylint: disable=too-many-arguments,too-many-instance-attributes # pylint: disable=too-many-arguments,too-many-positional-arguments,too-many-instance-attributes
#: Aliases for micro-architecture's features #: Aliases for micro-architecture's features
feature_aliases = FEATURE_ALIASES feature_aliases = FEATURE_ALIASES
@ -150,17 +149,25 @@ def __ge__(self, other):
return (self == other) or (self > other) return (self == other) or (self > other)
def __repr__(self): def __repr__(self):
cls_name = self.__class__.__name__ return f"{self.__class__.__name__}({self.name!r})"
fmt = (
cls_name + "({0.name!r}, {0.parents!r}, {0.vendor!r}, "
"{0.features!r}, {0.compilers!r}, generation={0.generation!r}, "
"cpu_part={0.cpu_part!r})"
)
return fmt.format(self)
def __str__(self): def __str__(self):
return self.name return self.name
def tree(self, fp: IO[str] = sys.stdout, indent: int = 4) -> None:
"""Format the partial order of ancestors of this microarchitecture as a tree."""
seen: Set[str] = set()
stack: List[Tuple[int, Microarchitecture]] = [(0, self)]
while stack:
level, current = stack.pop()
print(f"{'':>{level}}{current.name}", file=fp)
if current.name in seen:
continue
for parent in reversed(current.parents):
stack.append((level + indent, parent))
def __contains__(self, feature): def __contains__(self, feature):
# Feature must be of a string type, so be defensive about that # Feature must be of a string type, so be defensive about that
if not isinstance(feature, str): if not isinstance(feature, str):
@ -384,7 +391,7 @@ def fill_target_from_dict(name, data, targets):
) )
known_targets = {} known_targets = {}
data = _vendoring.archspec.cpu.schema.TARGETS_JSON["microarchitectures"] data = schema.TARGETS_JSON["microarchitectures"]
for name in data: for name in data:
if name in known_targets: if name in known_targets:
# name was already brought in as ancestor to a target # name was already brought in as ancestor to a target

View File

@ -6,19 +6,25 @@
"features": [] "features": []
}, },
"i686": { "i686": {
"from": ["x86"], "from": [
"x86"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [] "features": []
}, },
"pentium2": { "pentium2": {
"from": ["i686"], "from": [
"i686"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx" "mmx"
] ]
}, },
"pentium3": { "pentium3": {
"from": ["pentium2"], "from": [
"pentium2"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -26,7 +32,9 @@
] ]
}, },
"pentium4": { "pentium4": {
"from": ["pentium3"], "from": [
"pentium3"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -35,7 +43,9 @@
] ]
}, },
"prescott": { "prescott": {
"from": ["pentium4"], "from": [
"pentium4"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -107,7 +117,9 @@
} }
}, },
"x86_64_v2": { "x86_64_v2": {
"from": ["x86_64"], "from": [
"x86_64"
],
"vendor": "generic", "vendor": "generic",
"features": [ "features": [
"cx16", "cx16",
@ -145,6 +157,13 @@
"flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3" "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3"
} }
], ],
"aocc": [
{
"versions": "2.2:",
"name": "x86-64-v2",
"flags": "-march={name} -mtune=generic"
}
],
"intel": [ "intel": [
{ {
"versions": "16.0:", "versions": "16.0:",
@ -170,7 +189,9 @@
} }
}, },
"x86_64_v3": { "x86_64_v3": {
"from": ["x86_64_v2"], "from": [
"x86_64_v2"
],
"vendor": "generic", "vendor": "generic",
"features": [ "features": [
"cx16", "cx16",
@ -217,6 +238,13 @@
"flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave" "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave"
} }
], ],
"aocc": [
{
"versions": "2.2:",
"name": "x86-64-v3",
"flags": "-march={name} -mtune=generic"
}
],
"apple-clang": [ "apple-clang": [
{ {
"versions": "8.0:", "versions": "8.0:",
@ -255,7 +283,9 @@
} }
}, },
"x86_64_v4": { "x86_64_v4": {
"from": ["x86_64_v3"], "from": [
"x86_64_v3"
],
"vendor": "generic", "vendor": "generic",
"features": [ "features": [
"cx16", "cx16",
@ -307,6 +337,13 @@
"flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl" "flags": "-march={name} -mtune=generic -mcx16 -msahf -mpopcnt -msse3 -msse4.1 -msse4.2 -mssse3 -mavx -mavx2 -mbmi -mbmi2 -mf16c -mfma -mlzcnt -mmovbe -mxsave -mavx512f -mavx512bw -mavx512cd -mavx512dq -mavx512vl"
} }
], ],
"aocc": [
{
"versions": "4:",
"name": "x86-64-v4",
"flags": "-march={name} -mtune=generic"
}
],
"apple-clang": [ "apple-clang": [
{ {
"versions": "8.0:", "versions": "8.0:",
@ -345,7 +382,9 @@
} }
}, },
"nocona": { "nocona": {
"from": ["x86_64"], "from": [
"x86_64"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -400,7 +439,9 @@
} }
}, },
"core2": { "core2": {
"from": ["nocona"], "from": [
"nocona"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -455,7 +496,10 @@
} }
}, },
"nehalem": { "nehalem": {
"from": ["core2", "x86_64_v2"], "from": [
"core2",
"x86_64_v2"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -521,7 +565,9 @@
} }
}, },
"westmere": { "westmere": {
"from": ["nehalem"], "from": [
"nehalem"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -584,7 +630,9 @@
} }
}, },
"sandybridge": { "sandybridge": {
"from": ["westmere"], "from": [
"westmere"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -660,7 +708,9 @@
} }
}, },
"ivybridge": { "ivybridge": {
"from": ["sandybridge"], "from": [
"sandybridge"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -738,7 +788,10 @@
} }
}, },
"haswell": { "haswell": {
"from": ["ivybridge", "x86_64_v3"], "from": [
"ivybridge",
"x86_64_v3"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -821,7 +874,9 @@
} }
}, },
"broadwell": { "broadwell": {
"from": ["haswell"], "from": [
"haswell"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -897,7 +952,9 @@
} }
}, },
"skylake": { "skylake": {
"from": ["broadwell"], "from": [
"broadwell"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -976,7 +1033,9 @@
} }
}, },
"mic_knl": { "mic_knl": {
"from": ["broadwell"], "from": [
"broadwell"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -1056,7 +1115,10 @@
} }
}, },
"skylake_avx512": { "skylake_avx512": {
"from": ["skylake", "x86_64_v4"], "from": [
"skylake",
"x86_64_v4"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -1147,7 +1209,9 @@
} }
}, },
"cannonlake": { "cannonlake": {
"from": ["skylake"], "from": [
"skylake"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -1234,7 +1298,9 @@
} }
}, },
"cascadelake": { "cascadelake": {
"from": ["skylake_avx512"], "from": [
"skylake_avx512"
],
"vendor": "GenuineIntel", "vendor": "GenuineIntel",
"features": [ "features": [
"mmx", "mmx",
@ -1483,7 +1549,10 @@
"movdir64b", "movdir64b",
"movdiri", "movdiri",
"serialize", "serialize",
"waitpkg" "waitpkg",
"amx_bf16",
"amx_tile",
"amx_int8"
], ],
"compilers": { "compilers": {
"gcc": [ "gcc": [
@ -1519,7 +1588,9 @@
} }
}, },
"k10": { "k10": {
"from": ["x86_64"], "from": [
"x86_64"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"mmx", "mmx",
@ -1578,7 +1649,9 @@
} }
}, },
"bulldozer": { "bulldozer": {
"from": ["x86_64_v2"], "from": [
"x86_64_v2"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"mmx", "mmx",
@ -1648,7 +1721,9 @@
} }
}, },
"piledriver": { "piledriver": {
"from": ["bulldozer"], "from": [
"bulldozer"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"mmx", "mmx",
@ -1722,7 +1797,9 @@
} }
}, },
"steamroller": { "steamroller": {
"from": ["piledriver"], "from": [
"piledriver"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"mmx", "mmx",
@ -1798,7 +1875,10 @@
} }
}, },
"excavator": { "excavator": {
"from": ["steamroller", "x86_64_v3"], "from": [
"steamroller",
"x86_64_v3"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"mmx", "mmx",
@ -1880,7 +1960,9 @@
} }
}, },
"zen": { "zen": {
"from": ["x86_64_v3"], "from": [
"x86_64_v3"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"bmi1", "bmi1",
@ -1964,7 +2046,9 @@
} }
}, },
"zen2": { "zen2": {
"from": ["zen"], "from": [
"zen"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"bmi1", "bmi1",
@ -2049,7 +2133,9 @@
} }
}, },
"zen3": { "zen3": {
"from": ["zen2"], "from": [
"zen2"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"bmi1", "bmi1",
@ -2137,7 +2223,10 @@
} }
}, },
"zen4": { "zen4": {
"from": ["zen3", "x86_64_v4"], "from": [
"zen3",
"x86_64_v4"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"bmi1", "bmi1",
@ -2237,7 +2326,9 @@
} }
}, },
"zen5": { "zen5": {
"from": ["zen4"], "from": [
"zen4"
],
"vendor": "AuthenticAMD", "vendor": "AuthenticAMD",
"features": [ "features": [
"abm", "abm",
@ -2335,7 +2426,9 @@
} }
}, },
"power7": { "power7": {
"from": ["ppc64"], "from": [
"ppc64"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 7, "generation": 7,
"features": [], "features": [],
@ -2355,7 +2448,9 @@
} }
}, },
"power8": { "power8": {
"from": ["power7"], "from": [
"power7"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 8, "generation": 8,
"features": [], "features": [],
@ -2380,7 +2475,9 @@
} }
}, },
"power9": { "power9": {
"from": ["power8"], "from": [
"power8"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 9, "generation": 9,
"features": [], "features": [],
@ -2400,7 +2497,9 @@
} }
}, },
"power10": { "power10": {
"from": ["power9"], "from": [
"power9"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 10, "generation": 10,
"features": [], "features": [],
@ -2441,7 +2540,9 @@
} }
}, },
"power8le": { "power8le": {
"from": ["ppc64le"], "from": [
"ppc64le"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 8, "generation": 8,
"features": [], "features": [],
@ -2477,7 +2578,9 @@
} }
}, },
"power9le": { "power9le": {
"from": ["power8le"], "from": [
"power8le"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 9, "generation": 9,
"features": [], "features": [],
@ -2507,7 +2610,9 @@
} }
}, },
"power10le": { "power10le": {
"from": ["power9le"], "from": [
"power9le"
],
"vendor": "IBM", "vendor": "IBM",
"generation": 10, "generation": 10,
"features": [], "features": [],
@ -2562,7 +2667,9 @@
} }
}, },
"armv8.1a": { "armv8.1a": {
"from": ["aarch64"], "from": [
"aarch64"
],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {
@ -2593,7 +2700,9 @@
} }
}, },
"armv8.2a": { "armv8.2a": {
"from": ["armv8.1a"], "from": [
"armv8.1a"
],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {
@ -2624,7 +2733,9 @@
} }
}, },
"armv8.3a": { "armv8.3a": {
"from": ["armv8.2a"], "from": [
"armv8.2a"
],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {
@ -2655,7 +2766,9 @@
} }
}, },
"armv8.4a": { "armv8.4a": {
"from": ["armv8.3a"], "from": [
"armv8.3a"
],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {
@ -2686,7 +2799,9 @@
} }
}, },
"armv8.5a": { "armv8.5a": {
"from": ["armv8.4a"], "from": [
"armv8.4a"
],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {
@ -2717,7 +2832,9 @@
} }
}, },
"armv9.0a": { "armv9.0a": {
"from": ["armv8.5a"], "from": [
"armv8.5a"
],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {
@ -2748,7 +2865,9 @@
} }
}, },
"thunderx2": { "thunderx2": {
"from": ["armv8.1a"], "from": [
"armv8.1a"
],
"vendor": "Cavium", "vendor": "Cavium",
"features": [ "features": [
"fp", "fp",
@ -2796,7 +2915,9 @@
"cpupart": "0x0af" "cpupart": "0x0af"
}, },
"a64fx": { "a64fx": {
"from": ["armv8.2a"], "from": [
"armv8.2a"
],
"vendor": "Fujitsu", "vendor": "Fujitsu",
"features": [ "features": [
"fp", "fp",
@ -2865,7 +2986,9 @@
"cpupart": "0x001" "cpupart": "0x001"
}, },
"cortex_a72": { "cortex_a72": {
"from": ["aarch64"], "from": [
"aarch64"
],
"vendor": "ARM", "vendor": "ARM",
"features": [ "features": [
"fp", "fp",
@ -2903,7 +3026,10 @@
"cpupart": "0xd08" "cpupart": "0xd08"
}, },
"neoverse_n1": { "neoverse_n1": {
"from": ["cortex_a72", "armv8.2a"], "from": [
"cortex_a72",
"armv8.2a"
],
"vendor": "ARM", "vendor": "ARM",
"features": [ "features": [
"fp", "fp",
@ -2989,7 +3115,10 @@
"cpupart": "0xd0c" "cpupart": "0xd0c"
}, },
"neoverse_v1": { "neoverse_v1": {
"from": ["neoverse_n1", "armv8.4a"], "from": [
"neoverse_n1",
"armv8.4a"
],
"vendor": "ARM", "vendor": "ARM",
"features": [ "features": [
"fp", "fp",
@ -3072,7 +3201,6 @@
"versions": "10.3:", "versions": "10.3:",
"flags": "-mcpu=neoverse-v1" "flags": "-mcpu=neoverse-v1"
} }
], ],
"clang": [ "clang": [
{ {
@ -3113,7 +3241,10 @@
"cpupart": "0xd40" "cpupart": "0xd40"
}, },
"neoverse_v2": { "neoverse_v2": {
"from": ["neoverse_n1", "armv9.0a"], "from": [
"neoverse_n1",
"armv9.0a"
],
"vendor": "ARM", "vendor": "ARM",
"features": [ "features": [
"fp", "fp",
@ -3225,7 +3356,10 @@
"cpupart": "0xd4f" "cpupart": "0xd4f"
}, },
"neoverse_n2": { "neoverse_n2": {
"from": ["neoverse_n1", "armv9.0a"], "from": [
"neoverse_n1",
"armv9.0a"
],
"vendor": "ARM", "vendor": "ARM",
"features": [ "features": [
"fp", "fp",
@ -3329,7 +3463,9 @@
"cpupart": "0xd49" "cpupart": "0xd49"
}, },
"m1": { "m1": {
"from": ["armv8.4a"], "from": [
"armv8.4a"
],
"vendor": "Apple", "vendor": "Apple",
"features": [ "features": [
"fp", "fp",
@ -3396,7 +3532,10 @@
"cpupart": "0x022" "cpupart": "0x022"
}, },
"m2": { "m2": {
"from": ["m1", "armv8.5a"], "from": [
"m1",
"armv8.5a"
],
"vendor": "Apple", "vendor": "Apple",
"features": [ "features": [
"fp", "fp",
@ -3492,29 +3631,25 @@
"from": [], "from": [],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {}
}
}, },
"ppcle": { "ppcle": {
"from": [], "from": [],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {}
}
}, },
"sparc": { "sparc": {
"from": [], "from": [],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {}
}
}, },
"sparc64": { "sparc64": {
"from": [], "from": [],
"vendor": "generic", "vendor": "generic",
"features": [], "features": [],
"compilers": { "compilers": {}
}
}, },
"riscv64": { "riscv64": {
"from": [], "from": [],
@ -3536,7 +3671,9 @@
} }
}, },
"u74mc": { "u74mc": {
"from": ["riscv64"], "from": [
"riscv64"
],
"vendor": "SiFive", "vendor": "SiFive",
"features": [], "features": [],
"compilers": { "compilers": {

View File

@ -9,4 +9,4 @@ macholib==1.16.2
altgraph==0.17.3 altgraph==0.17.3
ruamel.yaml==0.17.21 ruamel.yaml==0.17.21
typing_extensions==4.1.1 typing_extensions==4.1.1
archspec @ git+https://github.com/archspec/archspec.git@38ce485258ffc4fc6dd6688f8dc90cb269478c47 archspec @ git+https://github.com/archspec/archspec.git@77f3f81df3dd80b7e538e2e41bc4485fbec2dbaa

View File

@ -260,9 +260,6 @@ substitute = [
{ match = "from attr", replace = "from _vendoring.attr" }, { match = "from attr", replace = "from _vendoring.attr" },
{ match = "import jsonschema", replace = "import _vendoring.jsonschema" }, { match = "import jsonschema", replace = "import _vendoring.jsonschema" },
{ match = "from jsonschema", replace = "from _vendoring.jsonschema" }, { match = "from jsonschema", replace = "from _vendoring.jsonschema" },
{ match = "archspec.cpu", replace = "_vendoring.archspec.cpu" },
{ match = "archspec.__version__", replace = "_vendoring.archspec.__version__" },
{ match = "import archspec", replace = "import _vendoring.archspec" },
] ]
drop = [ drop = [
# contains unnecessary scripts # contains unnecessary scripts