On 9/30/26 11:38 AM, Trevor Gamblin wrote:
Create a new function to help match RISC-V ISA extension combinations
against recognized profile strings (e.g. 'rva22u64'), so that we can use
simpler patterns for naming things like sstate/build paths.

Signed-off-by: Trevor Gamblin <[email protected]>
---
  meta/lib/oe/tune.py | 29 +++++++++++++++++++++++++++++
  1 file changed, 29 insertions(+)

diff --git a/meta/lib/oe/tune.py b/meta/lib/oe/tune.py
index 7296f39e66..0d8e4417e7 100644
--- a/meta/lib/oe/tune.py
+++ b/meta/lib/oe/tune.py
@@ -90,3 +90,32 @@ def riscv_isa_to_tune(isa):
      # Eliminate duplicates, but preserve the order
      feature = list(dict.fromkeys(feature))
      return ' '.join(feature)
+
+# riscv_pkgarch(features, exact_pkgarch)
+#
+# Prefer a RISCV_PROFILES name (plus any extensions enabled on top of it) as 
the
+# package arch fragment, since otherwise the full ISA extension list will 
exceed
+# what the sstate class can handle. When several profiles match, the one with
+# the most extensions is preferred, as it is the more specific/clearer match.
+# If there's no clear profile matching the extension list, then fall back to
+# exact_pkgarch.
+def riscv_pkgarch(features, exact_pkgarch):
+    if not features:
+        return exact_pkgarch
+
+    current = set(features.split())
+
+    best_match = None
+    best_features = None
+    for name in RISCV_PROFILES:

Where is 'RISCV_PROFILES' defined?

As long as someone is willing to keep this up to date with all of the new profiles, I don't have a concern with it.

On my AMD platforms, we have dynamic (user defined) ISA for our parts, the users don't really use 'profiles', but select individual isa components. I would LIKE (but only because it's easier for me) a way to see the ISA and not have it converted back to a profile. However, if profiles are the risc-v ISA standard, I'm fine without a way to disable the translation.

--Mark

+        profile_features = set(riscv_isa_to_tune(name).split())
+        if profile_features.issubset(current):
+            if best_features is None or len(profile_features) > 
len(best_features):
+                best_match = name
+                best_features = profile_features
+
+    if best_match is None:
+        return exact_pkgarch
+
+    extra = sorted(current - best_features)
+    return '_'.join([best_match] + extra)

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#247434): 
https://lists.openembedded.org/g/openembedded-core/message/247434
Mute This Topic: https://lists.openembedded.org/mt/121511785/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to