archspec: revert f2c8cdd1bc532f6e55209ef8112f79c5565f082d

This commit is contained in:
Harmen Stoppels 2024-10-02 15:21:36 +02:00 committed by Harmen Stoppels
parent 80fbef84bd
commit 71fc3e74bd
2 changed files with 4 additions and 29 deletions

View file

@ -8,7 +8,6 @@
from .detect import brand_string, host from .detect import brand_string, host
from .microarchitecture import ( from .microarchitecture import (
TARGETS, TARGETS,
InvalidCompilerVersion,
Microarchitecture, Microarchitecture,
UnsupportedMicroarchitecture, UnsupportedMicroarchitecture,
generic_microarchitecture, generic_microarchitecture,
@ -16,12 +15,11 @@
) )
__all__ = [ __all__ = [
"brand_string",
"host",
"TARGETS",
"InvalidCompilerVersion",
"Microarchitecture", "Microarchitecture",
"UnsupportedMicroarchitecture", "UnsupportedMicroarchitecture",
"TARGETS",
"generic_microarchitecture", "generic_microarchitecture",
"host",
"version_components", "version_components",
"brand_string",
] ]

View file

@ -213,8 +213,6 @@ def optimization_flags(self, compiler, version):
"""Returns a string containing the optimization flags that needs """Returns a string containing the optimization flags that needs
to be used to produce code optimized for this micro-architecture. to be used to produce code optimized for this micro-architecture.
The version is expected to be a string of dot separated digits.
If there is no information on the compiler passed as argument the If there is no information on the compiler passed as argument the
function returns an empty string. If it is known that the compiler function returns an empty string. If it is known that the compiler
version we want to use does not support this architecture the function version we want to use does not support this architecture the function
@ -223,11 +221,6 @@ def optimization_flags(self, compiler, version):
Args: Args:
compiler (str): name of the compiler to be used compiler (str): name of the compiler to be used
version (str): version of the compiler to be used version (str): version of the compiler to be used
Raises:
UnsupportedMicroarchitecture: if the requested compiler does not support
this micro-architecture.
ValueError: if the version doesn't match the expected format
""" """
# If we don't have information on compiler at all return an empty string # If we don't have information on compiler at all return an empty string
if compiler not in self.family.compilers: if compiler not in self.family.compilers:
@ -244,14 +237,6 @@ def optimization_flags(self, compiler, version):
msg = msg.format(compiler, best_target, best_target.family) msg = msg.format(compiler, best_target, best_target.family)
raise UnsupportedMicroarchitecture(msg) raise UnsupportedMicroarchitecture(msg)
# Check that the version matches the expected format
if not re.match(r"^(?:\d+\.)*\d+$", version):
msg = (
"invalid format for the compiler version argument. "
"Only dot separated digits are allowed."
)
raise InvalidCompilerVersion(msg)
# If we have information on this compiler we need to check the # If we have information on this compiler we need to check the
# version being used # version being used
compiler_info = self.compilers[compiler] compiler_info = self.compilers[compiler]
@ -390,15 +375,7 @@ def fill_target_from_dict(name, data, targets):
TARGETS = LazyDictionary(_known_microarchitectures) TARGETS = LazyDictionary(_known_microarchitectures)
class ArchspecError(Exception): class UnsupportedMicroarchitecture(ValueError):
"""Base class for errors within archspec"""
class UnsupportedMicroarchitecture(ArchspecError, ValueError):
"""Raised if a compiler version does not support optimization for a given """Raised if a compiler version does not support optimization for a given
micro-architecture. micro-architecture.
""" """
class InvalidCompilerVersion(ArchspecError, ValueError):
"""Raised when an invalid format is used for compiler versions in archspec."""