Skip to content

[mlir][tosa] Finalize profile-based validation for TOSA v1.0 #131208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2025

Conversation

tatwaichong
Copy link
Contributor

@tatwaichong tatwaichong commented Mar 13, 2025

  • When the operand type of an operation changes to a profile-dependent type, the compliance metadata must be updated. Update compliance check for the following:
    • CONV2D, CONV3D, DEPTHWISE_CONV2D, and TRANSPOSE_CONV2D, as zero points have changed to variable inputs.
    • PAD, because pad_const has been changed to a variable input.
    • GATHER and SCATTER, as indices has changed to index_t.
  • Add an int16 extension check for CONCAT.
  • Add a compliance check for COND_IF, WHILE_LOOP, VARIABLE, VARIABLE_READ, and VARIABLE_WRITE.
  • Correct the profile requirements for IDENTITY, TABLE, MATMUL and LOGICAL-like operations.
  • Remove unnecessary checks for non-v1.0 operations.
  • Add condition requirements (anyOf and allOf) to the type mode of metadata for modes that have multiple profile/extension considerations.

@llvmbot
Copy link
Member

llvmbot commented Mar 13, 2025

@llvm/pr-subscribers-mlir-tosa

@llvm/pr-subscribers-mlir

Author: TatWai Chong (tatwaichong)

Changes
  • When the operand type of an operation changes to a profile-dependent type, the compliance metadata must be updated. Update compliance check for the following:
    • CONV2D, CONV3D, DEPTHWISE_CONV2D, and TRANSPOSE_CONV2D, as zero points have changed to variable inputs.
    • PAD, because pad_const has been changed to a variable input.
    • GATHER and SCATTER, as indices has changed to index_t.
  • Add an int16 extension check for CONCAT.
  • Add a compliance check for VARIABLE, VARIABLE_READ, and VARIABLE_WRITE.
  • Correct the profile requirements for IDENTITY, TABLE, MATMUL and LOGICAL-like operations.
  • Remove unnecessary checks for non-v1.0 operations.
  • Add condition requirements (anyOf and allOf) to the type mode of metadata for modes that have multiple profile/extension considerations.
  • The last extension - DYNAMIC will be submitted separately in another PR.

Patch is 39.89 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/131208.diff

7 Files Affected:

  • (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc (+126-101)
  • (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td (+10-10)
  • (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaProfileCompliance.h (+3-3)
  • (modified) mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp (+15-7)
  • (modified) mlir/test/Dialect/Tosa/availability.mlir (+6-6)
  • (modified) mlir/test/Dialect/Tosa/profile_all_unsupported.mlir (+123-1)
  • (modified) mlir/test/Dialect/Tosa/profile_pro_int_unsupported.mlir (-4)
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc b/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
index f06b156c1e41a..d921879a466e6 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaComplianceData.h.inc
@@ -11,29 +11,23 @@ profileComplianceMap = {
         {fp16T, fp16T, fp16T, fp32T, fp16T},
         {fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
     {"tosa.conv2d",
-     {{{Profile::pro_int}, {{i8T, i8T, i32T, i32T, i32T}}},
+     {{{Profile::pro_int}, {{i8T, i8T, i32T, i8T, i8T, i32T, i32T}}},
       {{Profile::pro_fp},
-       {{fp16T, fp16T, fp16T, fp16T, fp16T},
-        {fp16T, fp16T, fp16T, fp32T, fp16T},
-        {fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
+       {{fp16T, fp16T, fp16T, fp16T, fp16T, fp16T, fp16T},
+        {fp16T, fp16T, fp16T, fp16T, fp16T, fp32T, fp16T},
+        {fp32T, fp32T, fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
     {"tosa.conv3d",
-     {{{Profile::pro_int}, {{i8T, i8T, i32T, i32T, i32T}}},
+     {{{Profile::pro_int}, {{i8T, i8T, i32T, i8T, i8T, i32T, i32T}}},
       {{Profile::pro_fp},
-       {{fp16T, fp16T, fp16T, fp16T, fp16T},
-        {fp16T, fp16T, fp16T, fp32T, fp16T},
-        {fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
+       {{fp16T, fp16T, fp16T, fp16T, fp16T, fp16T, fp16T},
+        {fp16T, fp16T, fp16T, fp16T, fp16T, fp32T, fp16T},
+        {fp32T, fp32T, fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
     {"tosa.depthwise_conv2d",
-     {{{Profile::pro_int}, {{i8T, i8T, i32T, i32T, i32T}}},
+     {{{Profile::pro_int}, {{i8T, i8T, i32T, i8T, i8T, i32T, i32T}}},
       {{Profile::pro_fp},
-       {{fp16T, fp16T, fp16T, fp16T, fp16T},
-        {fp16T, fp16T, fp16T, fp32T, fp16T},
-        {fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
-    {"tosa.fully_connected",
-     {{{Profile::pro_int}, {{i8T, i8T, i32T, i32T}}},
-      {{Profile::pro_fp},
-       {{fp16T, fp16T, fp16T, fp16T},
-        {fp16T, fp16T, fp32T, fp32T},
-        {fp32T, fp32T, fp32T, fp32T}}}}},
+       {{fp16T, fp16T, fp16T, fp16T, fp16T, fp16T, fp16T},
+        {fp16T, fp16T, fp16T, fp16T, fp16T, fp32T, fp16T},
+        {fp32T, fp32T, fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
     {"tosa.matmul",
      {{{Profile::pro_int}, {{i8T, i8T, i8T, i8T, i32T}}},
       {{Profile::pro_fp},
@@ -44,11 +38,11 @@ profileComplianceMap = {
      {{{Profile::pro_int}, {{i8T, i8T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.transpose_conv2d",
-     {{{Profile::pro_int}, {{i8T, i8T, i32T, i32T, i32T}}},
+     {{{Profile::pro_int}, {{i8T, i8T, i32T, i8T, i8T, i32T, i32T}}},
       {{Profile::pro_fp},
-       {{fp16T, fp16T, fp16T, fp16T, fp16T},
-        {fp16T, fp16T, fp16T, fp32T, fp16T},
-        {fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
+       {{fp16T, fp16T, fp16T, fp16T, fp16T, fp16T, fp16T},
+        {fp16T, fp16T, fp16T, fp16T, fp16T, fp32T, fp16T},
+        {fp32T, fp32T, fp32T, fp32T, fp32T, fp32T, fp32T}}}}},
     {"tosa.clamp",
      {{{Profile::pro_int}, {{i8T, i8T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
@@ -56,7 +50,7 @@ profileComplianceMap = {
     {"tosa.sigmoid", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.tanh", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.add",
-     {{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}, anyOf},
       {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
     {"tosa.arithmetic_right_shift",
      {{{Profile::pro_int},
@@ -70,20 +64,22 @@ profileComplianceMap = {
     {"tosa.bitwise_xor",
      {{{Profile::pro_int},
        {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}}}},
-    {"tosa.intdiv",
-     {{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}}}},
+    {"tosa.int_div",
+     {{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}, anyOf}}},
     {"tosa.logical_and",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}, anyOf}}},
     {"tosa.logical_left_shift",
      {{{Profile::pro_int, Profile::pro_fp},
-       {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}}}},
+       {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}},
+       anyOf}}},
     {"tosa.logical_right_shift",
      {{{Profile::pro_int, Profile::pro_fp},
-       {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}}}},
+       {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}},
+       anyOf}}},
     {"tosa.logical_or",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}, anyOf}}},
     {"tosa.logical_xor",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}, anyOf}}},
     {"tosa.maximum",
      {{{Profile::pro_int}, {{i32T, i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
@@ -92,12 +88,12 @@ profileComplianceMap = {
       {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
     {"tosa.mul",
      {{{Profile::pro_int}, {{i8T, i8T, i32T}, {i16T, i16T, i32T}}},
-      {{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}},
+      {{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}, anyOf},
       {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
     {"tosa.pow",
      {{{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
     {"tosa.sub",
-     {{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{i32T, i32T, i32T}}, anyOf},
       {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
     {"tosa.table", {{{Profile::pro_int}, {{i8T, i8T, i8T}}}}},
     {"tosa.abs",
@@ -112,7 +108,7 @@ profileComplianceMap = {
     {"tosa.floor", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.log", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.logical_not",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf}}},
     {"tosa.negate",
      {{{Profile::pro_int},
        {{i8T, i8T, i8T, i8T},
@@ -123,12 +119,12 @@ profileComplianceMap = {
     {"tosa.reciprocal",
      {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.rsqrt", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
+    {"tosa.sin", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.select",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}, anyOf},
       {{Profile::pro_int},
        {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
-    {"tosa.sin", {{{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.equal",
      {{{Profile::pro_int}, {{i32T, i32T, boolT}}},
       {{Profile::pro_fp}, {{fp16T, fp16T, boolT}, {fp32T, fp32T, boolT}}}}},
@@ -139,9 +135,9 @@ profileComplianceMap = {
      {{{Profile::pro_int}, {{i32T, i32T, boolT}}},
       {{Profile::pro_fp}, {{fp16T, fp16T, boolT}, {fp32T, fp32T, boolT}}}}},
     {"tosa.reduce_all",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf}}},
     {"tosa.reduce_any",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf}}},
     {"tosa.reduce_max",
      {{{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
@@ -154,40 +150,45 @@ profileComplianceMap = {
      {{{Profile::pro_int}, {{i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.concat",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
-      {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf},
+      {{Profile::pro_int}, {{i8T, i8T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.pad",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
-      {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
-      {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT, boolT}}, anyOf},
+      {{Profile::pro_int},
+       {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}},
+      {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
     {"tosa.reshape",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf},
       {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.reverse",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf},
       {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.slice",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf},
       {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.tile",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf},
       {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.transpose",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}},
+     {{{Profile::pro_int, Profile::pro_fp}, {{boolT, boolT}}, anyOf},
       {{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
     {"tosa.gather",
-     {{{Profile::pro_int}, {{i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
-      {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
+     {{{Profile::pro_int},
+       {{i8T, i32T, i8T}, {i16T, i32T, i16T}, {i32T, i32T, i32T}}},
+      {{Profile::pro_fp}, {{fp16T, i32T, fp16T}, {fp32T, i32T, fp32T}}}}},
     {"tosa.scatter",
      {{{Profile::pro_int},
-       {{i8T, i8T, i8T}, {i16T, i16T, i16T}, {i32T, i32T, i32T}}},
-      {{Profile::pro_fp}, {{fp16T, fp16T, fp16T}, {fp32T, fp32T, fp32T}}}}},
+       {{i8T, i32T, i8T, i8T},
+        {i16T, i32T, i16T, i16T},
+        {i32T, i32T, i32T, i32T}}},
+      {{Profile::pro_fp},
+       {{fp16T, i32T, fp16T, fp16T}, {fp32T, i32T, fp32T, fp32T}}}}},
     {"tosa.resize",
      {{{Profile::pro_int}, {{i8T, i32T}, {i8T, i8T}}},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
@@ -232,16 +233,19 @@ profileComplianceMap = {
         {i32T, i32T, i16T, i16T},
         {i32T, i32T, i32T, i32T}}}}},
     {"tosa.const",
-     {{{Profile::pro_int}, {{boolT}, {i8T}, {i16T}, {i32T}}},
+     {{{Profile::pro_int, Profile::pro_fp},
+       {{boolT}, {i8T}, {i16T}, {i32T}},
+       anyOf},
       {{Profile::pro_fp}, {{fp16T}, {fp32T}}}}},
     {"tosa.identity",
-     {{{Profile::pro_int},
-       {{boolT, boolT}, {i8T, i8T}, {i16T, i16T}, {i32T, i32T}}},
+     {{{Profile::pro_int, Profile::pro_fp},
+       {{boolT, boolT}, {i8T, i8T}, {i16T, i16T}, {i32T, i32T}},
+       anyOf},
       {{Profile::pro_fp}, {{fp16T, fp16T}, {fp32T, fp32T}}}}},
-    {"tosa.dim",
-     {{{Profile::pro_int, Profile::pro_fp}, {{boolT}}},
-      {{Profile::pro_int}, {{i8T}, {i16T}, {i32T}}},
-      {{Profile::pro_fp}, {{fp16T}, {fp32T}}}}},
+    {"tosa.variable_write",
+     {{{Profile::pro_int}, {{i8T}}}, {{Profile::pro_fp}, {{fp16T}, {fp32T}}}}},
+    {"tosa.variable_read",
+     {{{Profile::pro_int}, {{i8T}}}, {{Profile::pro_fp}, {{fp16T}, {fp32T}}}}},
 };
 
 extensionComplianceMap = {
@@ -256,32 +260,47 @@ extensionComplianceMap = {
       {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp8e5m2T, fp16T, fp8e5m2T}}},
       {{Extension::bf16}, {{bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
     {"tosa.conv2d",
-     {{{Extension::int4}, {{i8T, i4T, i32T, i32T, i32T}}},
-      {{Extension::int16}, {{i16T, i8T, i48T, i48T, i48T}}},
-      {{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp16T, fp16T, fp16T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp16T, fp16T, fp16T}}},
-      {{Extension::bf16}, {{bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
+     {{{Extension::int4}, {{i8T, i4T, i32T, i8T, i4T, i32T, i32T}}},
+      {{Extension::int16}, {{i16T, i8T, i48T, i16T, i8T, i48T, i48T}}},
+      {{Extension::fp8e4m3},
+       {{fp8e4m3T, fp8e4m3T, fp16T, fp8e4m3T, fp8e4m3T, fp16T, fp16T}}},
+      {{Extension::fp8e5m2},
+       {{fp8e5m2T, fp8e5m2T, fp16T, fp8e5m2T, fp8e5m2T, fp16T, fp16T}}},
+      {{Extension::bf16},
+       {{bf16T, bf16T, bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
     {"tosa.conv3d",
-     {{{Extension::int4}, {{i8T, i4T, i32T, i32T, i32T}}},
-      {{Extension::int16}, {{i16T, i8T, i48T, i48T, i48T}}},
-      {{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp16T, fp16T, fp16T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp16T, fp16T, fp16T}}},
-      {{Extension::bf16}, {{bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
+     {{{Extension::int4}, {{i8T, i4T, i32T, i8T, i4T, i32T, i32T}}},
+      {{Extension::int16}, {{i16T, i8T, i48T, i16T, i8T, i48T, i48T}}},
+      {{Extension::fp8e4m3},
+       {{fp8e4m3T, fp8e4m3T, fp16T, fp8e4m3T, fp8e4m3T, fp16T, fp16T}}},
+      {{Extension::fp8e5m2},
+       {{fp8e5m2T, fp8e5m2T, fp16T, fp8e5m2T, fp8e5m2T, fp16T, fp16T}}},
+      {{Extension::bf16},
+       {{bf16T, bf16T, bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
     {"tosa.depthwise_conv2d",
-     {{{Extension::int4}, {{i8T, i4T, i32T, i32T, i32T}}},
-      {{Extension::int16}, {{i16T, i8T, i48T, i48T, i48T}}},
-      {{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp16T, fp16T, fp16T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp16T, fp16T, fp16T}}},
-      {{Extension::bf16}, {{bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
+     {{{Extension::int4}, {{i8T, i4T, i32T, i8T, i4T, i32T, i32T}}},
+      {{Extension::int16}, {{i16T, i8T, i48T, i16T, i8T, i48T, i48T}}},
+      {{Extension::fp8e4m3},
+       {{fp8e4m3T, fp8e4m3T, fp16T, fp8e4m3T, fp8e4m3T, fp16T, fp16T}}},
+      {{Extension::fp8e5m2},
+       {{fp8e5m2T, fp8e5m2T, fp16T, fp8e5m2T, fp8e5m2T, fp16T, fp16T}}},
+      {{Extension::bf16},
+       {{bf16T, bf16T, bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
     {"tosa.fft2d", {{{Extension::fft}, {{fp32T, fp32T, fp32T, fp32T}}}}},
-    {"tosa.fully_connected",
-     {{{Extension::int4}, {{i8T, i4T, i32T, i32T}}},
-      {{Extension::int16}, {{i16T, i8T, i48T, i48T}}},
-      {{Extension::bf16}, {{bf16T, bf16T, fp32T, fp32T}}}}},
     {"tosa.matmul",
      {{{Extension::int16}, {{i16T, i16T, i16T, i16T, i48T}}},
-      {{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp8e4m3T, fp8e4m3T, fp16T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp8e5m2T, fp8e5m2T, fp16T}}},
+      {{Extension::fp8e4m3},
+       {{fp8e4m3T, fp8e4m3T, fp8e4m3T, fp8e4m3T, fp16T},
+        {fp8e4m3T, fp8e4m3T, fp8e4m3T, fp8e4m3T, fp32T}}},
+      {{Extension::fp8e5m2},
+       {{fp8e5m2T, fp8e5m2T, fp8e5m2T, fp8e5m2T, fp16T},
+        {fp8e5m2T, fp8e5m2T, fp8e5m2T, fp8e5m2T, fp32T}}},
+      {{Extension::fp8e4m3, Extension::fp8e5m2},
+       {{fp8e4m3T, fp8e5m2T, fp8e4m3T, fp8e5m2T, fp16T},
+        {fp8e4m3T, fp8e5m2T, fp8e4m3T, fp8e5m2T, fp32T},
+        {fp8e5m2T, fp8e4m3T, fp8e5m2T, fp8e4m3T, fp16T},
+        {fp8e5m2T, fp8e4m3T, fp8e5m2T, fp8e4m3T, fp32T}},
+       allOf},
       {{Extension::bf16}, {{bf16T, bf16T, bf16T, bf16T, fp32T}}}}},
     {"tosa.max_pool2d",
      {{{Extension::int16}, {{i16T, i16T}}},
@@ -290,11 +309,14 @@ extensionComplianceMap = {
       {{Extension::bf16}, {{bf16T, bf16T}}}}},
     {"tosa.rfft2d", {{{Extension::fft}, {{fp32T, fp32T, fp32T}}}}},
     {"tosa.transpose_conv2d",
-     {{{Extension::int4}, {{i8T, i4T, i32T, i32T, i32T}}},
-      {{Extension::int16}, {{i16T, i8T, i48T, i48T, i48T}}},
-      {{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp16T, fp16T, fp16T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp16T, fp16T, fp16T}}},
-      {{Extension::bf16}, {{bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
+     {{{Extension::int4}, {{i8T, i4T, i32T, i8T, i4T, i32T, i32T}}},
+      {{Extension::int16}, {{i16T, i8T, i48T, i16T, i8T, i48T, i48T}}},
+      {{Extension::fp8e4m3},
+       {{fp8e4m3T, fp8e4m3T, fp16T, fp8e4m3T, fp8e4m3T, fp16T, fp16T}}},
+      {{Extension::fp8e5m2},
+       {{fp8e5m2T, fp8e5m2T, fp16T, fp8e5m2T, fp8e5m2T, fp16T, fp16T}}},
+      {{Extension::bf16},
+       {{bf16T, bf16T, bf16T, bf16T, bf16T, fp32T, bf16T}}}}},
     {"tosa.clamp",
      {{{Extension::int16}, {{i16T, i16T}}},
       {{Extension::bf16}, {{bf16T, bf16T}}}}},
@@ -317,8 +339,8 @@ extensionComplianceMap = {
     {"tosa.negate", {{{Extension::bf16}, {{bf16T, bf16T, bf16T, bf16T}}}}},
     {"tosa.reciprocal", {{{Extension::bf16}, {{bf16T, bf16T}}}}},
     {"tosa.rsqrt", {{{Extension::bf16}, {{bf16T, bf16T}}}}},
-    {"tosa.select", {{{Extension::bf16}, {{bf16T, bf16T, bf16T}}}}},
     {"tosa.sin", {{{Extension::bf16}, {{bf16T, bf16T}}}}},
+    {"tosa.select", {{{Extension::bf16}, {{bf16T, bf16T, bf16T}}}}},
     {"tosa.equal", {{{Extension::bf16}, {{bf16T, bf16T, boolT}}}}},
     {"tosa.greater", {{{Extension::bf16}, {{bf16T, bf16T, boolT}}}}},
     {"tosa.greater_equal", {{{Extension::bf16}, {{bf16T, bf16T, boolT}}}}},
@@ -327,13 +349,14 @@ extensionComplianceMap = {
     {"tosa.reduce_product", {{{Extension::bf16}, {{bf16T, bf16T}}}}},
     {"tosa.reduce_sum", {{{Extension::bf16}, {{bf16T, bf16T}}}}},
     {"tosa.concat",
-     {{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
+     {{{Extension::int16}, {{i16T, i16T}}},
+      {{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
       {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
       {{Extension::bf16}, {{bf16T, bf16T}}}}},
     {"tosa.pad",
-     {{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
-      {{Extension::bf16}, {{bf16T, bf16T}}}}},
+     {{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp8e4m3T}}},
+      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp8e5m2T}}},
+      {{Extension::bf16}, {{bf16T, bf16T, bf16T}}}}},
     {"tosa.reshape",
      {{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
       {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
@@ -355,13 +378,13 @@ extensionComplianceMap = {
       {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
       {{Extension::bf16}, {{bf16T, bf16T}}}}},
     {"tosa.gather",
-     {{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T}}},
-      {{Extension::bf16}, {{bf16T, bf16T}}}}},
+     {{{Extension::fp8e4m3}, {{fp8e4m3T, i32T, fp8e4m3T}}},
+      {{Extension::fp8e5m2}, {{fp8e5m2T, i32T, fp8e5m2T}}},
+      {{Extension::bf16}, {{bf16T, i32T, bf16T}}}}},
     {"tosa.scatter",
-     {{{Extension::fp8e4m3}, {{fp8e4m3T, fp8e4m3T, fp8e4m3T}}},
-      {{Extension::fp8e5m2}, {{fp8e5m2T, fp8e5m2T, fp8e5m2T}}},
-      {{Extension::bf16}, {{bf16T, bf16T, bf16T}}}}},
+     {{{Extension::fp8e4m3}, {{fp8e4m3T, i32T, fp8e4m3T, fp8e4m3T}}},
+      {{Extension::fp8e5m2}, {{fp8e5m2T, i32T, fp8e5m2T, fp8e5m2T}}},
+      {{Extension::bf16}, {{bf16T, i32T, bf16T, bf16T}}}}},
     {"tosa.resize",
      {{{Extension::int16}, {{i16T, i48T}, {i16T, i16T}}},
       {{Extension::bf16}, {{bf16T, bf16T}}}}},
@@ -376,9 +399,11 @@ extensionComplianceMap = {
         {bf16T, fp32T},
         {fp32T, bf16T}}},
       {{Extension::bf16, Extension::fp8e4m3},
-       {{bf16T, fp8e4m3T}, {fp8e4m3T, bf16T}}},
+       {{bf16T, fp8e4m3T}, {fp8e4m3T, bf16T}},
+       allOf},
       {{Extension::bf16, Extension::fp8e5m2},
-       {{bf16T, fp8e5m2T}, {fp8e5m2T, bf16T}}},
+       {{bf16T, fp8e5m2T}, {fp8e5m2T, bf16T}},
+       allOf},
       {{Extension::fp8e4m3},
        {{fp8e4m3T, fp16T},
         ...
[truncated]

@tatwaichong
Copy link
Contributor Author

Let it wait for #131123 to be merged.

Copy link
Member

@Jerry-Ge Jerry-Ge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, will let @lhutton1 and @GeorgeARM take another look

Copy link
Contributor

@GeorgeARM GeorgeARM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

github-actions bot commented Mar 17, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

- When the operand type of an operation changes to a profile-dependent
  type, the compliance metadata must be updated. Update compliance
  check for the following:
  - CONV2D, CONV3D, DEPTHWISE_CONV2D, and TRANSPOSE_CONV2D, as zero
    points have changed to variable inputs.
  - PAD, because pad_const has been changed to a variable input.
  - GATHER and SCATTER, as indices has changed to index_t.
- Add an int16 extension check for CONCAT.
- Add a compliance check for COND_IF, WHILE_LOOP, VARIABLE, VARIABLE_READ,
  and VARIABLE_WRITE.
- Correct the profile requirements for IDENTITY, TABLE, MATMUL and
  LOGICAL-like operations.
- Remove unnecessary checks for non-v1.0 operations.
- Add condition requirements (anyOf and allOf) to the type mode of
  metadata for modes that have multiple profile/extension considerations.
@tatwaichong
Copy link
Contributor Author

Add profile validation check on the type of condition output for cond_if and while_loop.

Copy link
Contributor

@lhutton1 lhutton1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates!

@Jerry-Ge Jerry-Ge merged commit 1456eab into llvm:main Mar 19, 2025
11 checks passed
@tatwaichong tatwaichong deleted the final_v1 branch March 19, 2025 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants