Add allowed profiles for each extension

Each extension can contain a list of profiles that it works with.

Signed-off-by: Eric Kunze <eric.kunze@arm.com>
Change-Id: I7cf2ad0c57fc8a36500212b7d554a8153fc2efe5
diff --git a/tools/genspec.py b/tools/genspec.py
index bae11cc..7710c07 100755
--- a/tools/genspec.py
+++ b/tools/genspec.py
@@ -137,10 +137,11 @@
         # Generate profile table
         with open(os.path.join(outdir, "profile_extensions.adoc"), "w") as f:
             f.write("|===\n")
-            f.write("|Name|Description|Specification Status\n\n")
+            f.write("|Name|Description|Allowed profiles|Specification Status\n\n")
             for profile_extension in self.spec.profile_extensions:
                 f.write(
                     f"|{profile_extension.name}|{profile_extension.description}"
+                    f"|{','.join(profile_extension.profiles)}"
                     f"|{profile_extension.status}\n"
                 )
             f.write("|===\n")
@@ -199,7 +200,8 @@
             for pext in self.spec.profile_extensions:
                 f.write(f"==== {pext.name} extension\n")
                 f.write(f"{pext.description}\n\n")
-                f.write(f"Status: {pext.status}\n")
+                f.write(f"Status: {pext.status}\n\n")
+                f.write(f"Compatible profiles: {', '.join(pext.profiles)}\n\n")
                 f.write("|===\n")
                 f.write("|Operator|mode|note\n\n")
                 for op in sorted(all_operators, key=lambda o: o.name):
diff --git a/tools/tosa.py b/tools/tosa.py
index e70b297..016aba6 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -41,10 +41,11 @@
 
 
 class TOSAProfileExtension:
-    def __init__(self, name, description, status):
+    def __init__(self, name, description, status, profiles):
         self.name = name
         self.description = description
         self.status = status
+        self.profiles = profiles
         self.ops = []
 
 
@@ -155,7 +156,8 @@
         name = ext.get("name")
         description = ext.get("description")
         status = ext.get("status")
-        return TOSAProfileExtension(name, description, status)
+        profiles = [x.text for x in ext]
+        return TOSAProfileExtension(name, description, status, profiles)
 
     def __load_level(self, level):
         name = level.get("name")
diff --git a/tosa.xml b/tosa.xml
index be25eca..f95b09c 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -7,13 +7,28 @@
     <profile profile="Main Inference" name="MI" status="Complete" description="FP16 and FP32 operations"/>
   </profiles>
   <profile_extensions>
-    <profile_extension name="EXT-INT16" description="16-bit integer operations" status="Complete"/>
-    <profile_extension name="EXT-INT4" description="4-bit integer weights" status="Complete"/>
-    <profile_extension name="EXT-BF16" description="BFloat16 operations" status="Complete"/>
-    <profile_extension name="EXT-FP8E4M3" description="8-bit floating-point operations E4M3" status="Complete"/>
-    <profile_extension name="EXT-FP8E5M2" description="8-bit floating-point operations E5M2" status="Complete"/>
-    <profile_extension name="EXT-FFT" description="Fast Fourier Transform operations" status="Complete"/>
-    <profile_extension name="EXT-VARIABLE" description="Stateful variable operations" status="Complete"/>
+    <profile_extension name="EXT-INT16" description="16-bit integer operations" status="Complete">
+      <profile_supported>BI</profile_supported>
+    </profile_extension>
+    <profile_extension name="EXT-INT4" description="4-bit integer weights" status="Complete">
+      <profile_supported>BI</profile_supported>
+    </profile_extension>
+    <profile_extension name="EXT-BF16" description="BFloat16 operations" status="Complete">
+      <profile_supported>MI</profile_supported>
+    </profile_extension>
+    <profile_extension name="EXT-FP8E4M3" description="8-bit floating-point operations E4M3" status="Complete">
+      <profile_supported>MI</profile_supported>
+    </profile_extension>
+    <profile_extension name="EXT-FP8E5M2" description="8-bit floating-point operations E5M2" status="Complete">
+      <profile_supported>MI</profile_supported>
+    </profile_extension>
+    <profile_extension name="EXT-FFT" description="Fast Fourier Transform operations" status="Complete">
+      <profile_supported>MI</profile_supported>
+    </profile_extension>
+    <profile_extension name="EXT-VARIABLE" description="Stateful variable operations" status="Complete">
+      <profile_supported>BI</profile_supported>
+      <profile_supported>MI</profile_supported>
+    </profile_extension>
   </profile_extensions>
   <levels>
     <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048" max_log2_size="63" max_nesting="256">No level</level>
diff --git a/tosa.xsd b/tosa.xsd
index dec20eb..d5d7dca 100644
--- a/tosa.xsd
+++ b/tosa.xsd
@@ -147,6 +147,9 @@
 
 <xs:element name="profile_extension">
   <xs:complexType>
+    <xs:sequence>
+      <xs:element name="profile_supported" type="profile_ext_name" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
     <xs:attribute name="name" type="xs:string" use="required"/>
     <xs:attribute name="status" type="xs:string" use="required"/>
     <xs:attribute name="description" type="xs:string" use="required"/>