diff options
author | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2023-02-02 14:02:05 +0000 |
---|---|---|
committer | Benjamin Klimczak <benjamin.klimczak@arm.com> | 2023-02-10 13:45:18 +0000 |
commit | 7a661257b6adad0c8f53e32b42ced56a1e7d952f (patch) | |
tree | 938ad8578c5b9edc0573e810ce64ce0a5bda3d8c /src/mlia/backend/corstone | |
parent | 50271dee0a84bfc481ce798184f07b5b0b4bc64d (diff) | |
download | mlia-7a661257b6adad0c8f53e32b42ced56a1e7d952f.tar.gz |
MLIA-769 Expand use of target/backend registries
- Use the target/backend registries to avoid hard-coded names.
- Cache target profiles to avoid re-loading them
Change-Id: I474b7c9ef23894e1d8a3ea06d13a37652054c62e
Diffstat (limited to 'src/mlia/backend/corstone')
-rw-r--r-- | src/mlia/backend/corstone/__init__.py | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/src/mlia/backend/corstone/__init__.py b/src/mlia/backend/corstone/__init__.py index 36f74ee..b59ab65 100644 --- a/src/mlia/backend/corstone/__init__.py +++ b/src/mlia/backend/corstone/__init__.py @@ -7,24 +7,20 @@ from mlia.backend.config import System from mlia.backend.registry import registry from mlia.core.common import AdviceCategory -registry.register( - "Corstone-300", - BackendConfiguration( - supported_advice=[AdviceCategory.PERFORMANCE, AdviceCategory.OPTIMIZATION], - supported_systems=[System.LINUX_AMD64], - backend_type=BackendType.CUSTOM, - ), -) -registry.register( - "Corstone-310", - BackendConfiguration( - supported_advice=[AdviceCategory.PERFORMANCE, AdviceCategory.OPTIMIZATION], - supported_systems=[System.LINUX_AMD64], - backend_type=BackendType.CUSTOM, - ), -) +# List of mutually exclusive Corstone backends ordered by priority +CORSTONE_PRIORITY = ("Corstone-310", "Corstone-300") + +for corstone_name in CORSTONE_PRIORITY: + registry.register( + corstone_name, + BackendConfiguration( + supported_advice=[AdviceCategory.PERFORMANCE, AdviceCategory.OPTIMIZATION], + supported_systems=[System.LINUX_AMD64], + backend_type=BackendType.CUSTOM, + ), + ) def is_corstone_backend(backend_name: str) -> bool: """Check if backend belongs to Corstone.""" - return backend_name in ["Corstone-300", "Corstone-310"] + return backend_name in CORSTONE_PRIORITY |