[Mlir-commits] [mlir] [mlir][tosa] Add assembly format for CONST (PR #225668)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 23 03:23:05 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Yuvaraj Venkatesh (Yuvaraj-Venkatesh)

<details>
<summary>Changes</summary>

This commit adds an assembly format for the TOSA CONST operation. Previously, the generic assembly format was used while all other operations had a custom format. It takes advantage of the incoming textual format changes in #<!-- -->217291, to minimise impact to downstream consumers.


---

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


15 Files Affected:

- (modified) mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td (+4) 
- (modified) mlir/test/Conversion/TosaToSPIRVTosa/graph-constant-mark.mlir (+3-3) 
- (modified) mlir/test/Dialect/Tosa/canonicalize.mlir (+9-9) 
- (modified) mlir/test/Dialect/Tosa/constant_folding.mlir (+2-2) 
- (modified) mlir/test/Dialect/Tosa/ops.mlir (+1-1) 
- (modified) mlir/test/Dialect/Tosa/tosa-arith-const-to-tosa-const.mlir (+8-8) 
- (modified) mlir/test/Dialect/Tosa/tosa-convert-integer-type-to-signless.mlir (+6-6) 
- (modified) mlir/test/Dialect/Tosa/tosa-decompose-depthwise.mlir (+1-1) 
- (modified) mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir (+5-5) 
- (modified) mlir/test/Dialect/Tosa/tosa-layerwise-constant-fold.mlir (+2-2) 
- (modified) mlir/test/Dialect/Tosa/tosa-narrow-f64-to-f32-aggressive.mlir (+2-2) 
- (modified) mlir/test/Dialect/Tosa/tosa-narrow-f64-to-f32.mlir (+2-2) 
- (modified) mlir/test/Dialect/Tosa/tosa-narrow-i64-to-i32-aggressive.mlir (+2-2) 
- (modified) mlir/test/Dialect/Tosa/tosa-narrow-i64-to-i32.mlir (+2-2) 
- (modified) mlir/test/Dialect/Tosa/tosa-reduce-transposes.mlir (+11-11) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
index 7cbe8e0b6c70e7..01ef662cc4f71e 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TosaOps.td
@@ -2700,6 +2700,10 @@ def Tosa_ConstOp : Tosa_Op<"const", [ConstantLike, Pure,
 
   let hasFolder = 1;
   let hasVerifier = 1;
+
+  let assemblyFormat =
+      "operands `values` `(` $values `)` attr-dict `:` "
+      "functional-type(operands, results)";
 }
 
 //===----------------------------------------------------------------------===//
diff --git a/mlir/test/Conversion/TosaToSPIRVTosa/graph-constant-mark.mlir b/mlir/test/Conversion/TosaToSPIRVTosa/graph-constant-mark.mlir
index ceab987ab08b57..11a128f2b3b6e6 100644
--- a/mlir/test/Conversion/TosaToSPIRVTosa/graph-constant-mark.mlir
+++ b/mlir/test/Conversion/TosaToSPIRVTosa/graph-constant-mark.mlir
@@ -2,7 +2,7 @@
 
 // CHECK-LABEL: func.func @large_const
 func.func @large_const() -> tensor<17xi32> {
-  // CHECK: "tosa.const"() <{values = {{.*}}> {grapharm.graph_constant_id = 0 : i32} : () -> tensor<17xi32>
+  // CHECK: tosa.const values({{.*}}) {grapharm.graph_constant_id = 0 : i32} : () -> tensor<17xi32>
   %res = "tosa.const"() <{values = dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : tensor<17xi32>}> : () -> tensor<17xi32>
   return %res : tensor<17xi32>
 }
@@ -38,9 +38,9 @@ func.func @small_const_shape() -> !tosa.shape<32> {
 
 // CHECK-LABEL: func.func @mixed_large_constants
 func.func @mixed_large_constants() -> (tensor<17xi32>, tensor<18xi32>, !tosa.shape<33>) {
-  // CHECK: "tosa.const"() <{values = {{.*}}> {grapharm.graph_constant_id = 0 : i32} : () -> tensor<17xi32>
+  // CHECK: tosa.const values({{.*}}) {grapharm.graph_constant_id = 0 : i32} : () -> tensor<17xi32>
   %const0 = "tosa.const"() <{values = dense<[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]> : tensor<17xi32>}> : () -> tensor<17xi32>
-  // CHECK: "tosa.const"() <{values = {{.*}}> {grapharm.graph_constant_id = 1 : i32} : () -> tensor<18xi32>
+  // CHECK: tosa.const values({{.*}}) {grapharm.graph_constant_id = 1 : i32} : () -> tensor<18xi32>
   %const1 = "tosa.const"() <{values = dense<[20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37]> : tensor<18xi32>}> : () -> tensor<18xi32>
   // CHECK: tosa.const_shape values({{.*}}) {grapharm.graph_constant_id = 2 : i32} : () -> !tosa.shape<33>
   %shape = "tosa.const_shape"() <{values = dense<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]> : tensor<33xindex>}> : () -> !tosa.shape<33>
diff --git a/mlir/test/Dialect/Tosa/canonicalize.mlir b/mlir/test/Dialect/Tosa/canonicalize.mlir
index 22353d1a756565..4ce983d11252f7 100644
--- a/mlir/test/Dialect/Tosa/canonicalize.mlir
+++ b/mlir/test/Dialect/Tosa/canonicalize.mlir
@@ -1077,7 +1077,7 @@ func.func @canonicalize_concat_slice_on_non_concat_axis(%arg0 : tensor<1x12x12xf
 // -----
 
 // CHECK-LABEL: @canonicalize_pad_slice_overlap
-// CHECK-DAG: %[[PAD_CONST:.*]] = "tosa.const"() <{values = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32>
+// CHECK-DAG: %[[PAD_CONST:.*]] = tosa.const values(dense<0.000000e+00> : tensor<1xf32>) : () -> tensor<1xf32>
 // CHECK-DAG: %[[ZERO:.*]] = tosa.const_shape values(dense<0> : tensor<4xindex>) : () -> !tosa.shape<4>
 // CHECK-DAG: %[[PADDING:.*]] = tosa.const_shape values(dense<[0, 0, 0, 0, 1, 1, 0, 0]> : tensor<8xindex>)
 // CHECK-DAG: %[[SLICE_SIZE:.*]] = tosa.const_shape values(dense<[-1, 14, 18, 3]> : tensor<4xindex>)
@@ -1113,7 +1113,7 @@ func.func @canonicalize_pad_slice_inside(%arg0: tensor<1x16x16x3xf32>) -> tensor
 // -----
 
 // CHECK-LABEL: func @canonicalize_pad_slice_exact
-// CHECK-DAG: %[[PAD_CONST:.*]] = "tosa.const"() <{values = dense<0.000000e+00> : tensor<1xf32>}> : () -> tensor<1xf32>
+// CHECK-DAG: %[[PAD_CONST:.*]] = tosa.const values(dense<0.000000e+00> : tensor<1xf32>) : () -> tensor<1xf32>
 // CHECK-DAG: %[[ZERO:.*]] = tosa.const_shape values(dense<0> : tensor<4xindex>) : () -> !tosa.shape<4>
 // CHECK-DAG: %[[PADDING:.*]] = tosa.const_shape values(dense<[0, 0, 0, 0, 2, 2, 0, 0]> : tensor<8xindex>)
 // CHECK-DAG: %[[SLICE_SIZE:.*]] = tosa.const_shape values(dense<[1, 16, 20, 2]> : tensor<4xindex>)
@@ -1403,7 +1403,7 @@ func.func @slice_dynamic_size_static_output_canonicalize(%arg0: tensor<2x60x59x?
 // -----
 
 // CHECK-LABEL: @fold_mul_shift
-// CHECK-DAG: "tosa.const"() <{values = dense<1> : tensor<i32>}> : () -> tensor<i32>
+// CHECK-DAG: tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
 func.func @fold_mul_shift() -> tensor<i32> {
     %0 = "tosa.const"() <{values = dense<-23661> : tensor<i32>}> : () -> tensor<i32>
     %1 = "tosa.const"() <{values = dense<-33022> : tensor<i32>}> : () -> tensor<i32>
@@ -1415,7 +1415,7 @@ func.func @fold_mul_shift() -> tensor<i32> {
 // -----
 
 // CHECK-LABEL: @fold_mul_no_shift
-// CHECK-DAG: "tosa.const"() <{values = dense<781333542> : tensor<i32>}> : () -> tensor<i32>
+// CHECK-DAG: tosa.const values(dense<781333542> : tensor<i32>) : () -> tensor<i32>
 func.func @fold_mul_no_shift() -> tensor<i32> {
     %0 = "tosa.const"() <{values = dense<-23661> : tensor<i32>}> : () -> tensor<i32>
     %1 = "tosa.const"() <{values = dense<-33022> : tensor<i32>}> : () -> tensor<i32>
@@ -1427,9 +1427,9 @@ func.func @fold_mul_no_shift() -> tensor<i32> {
 // -----
 
 // CHECK-LABEL: @no_fold_mul_result_exceeds_i32
-// CHECK-DAG: %[[LHS:.*]] = "tosa.const"() <{values = dense<23661> : tensor<i32>}> : () -> tensor<i32>
-// CHECK-DAG: %[[RHS:.*]] = "tosa.const"() <{values = dense<330222> : tensor<i32>}> : () -> tensor<i32>
-// CHECK-DAG: %[[SHIFT:.*]] = "tosa.const"() <{values = dense<1> : tensor<1xi8>}> : () -> tensor<1xi8>
+// CHECK-DAG: %[[LHS:.*]] = tosa.const values(dense<23661> : tensor<i32>) : () -> tensor<i32>
+// CHECK-DAG: %[[RHS:.*]] = tosa.const values(dense<330222> : tensor<i32>) : () -> tensor<i32>
+// CHECK-DAG: %[[SHIFT:.*]] = tosa.const values(dense<1> : tensor<1xi8>) : () -> tensor<1xi8>
 // CHECK: tosa.mul %[[LHS]], %[[RHS]], %[[SHIFT]] : (tensor<i32>, tensor<i32>, tensor<1xi8>) -> tensor<i32>
 func.func @no_fold_mul_result_exceeds_i32() -> tensor<i32> {
     %0 = "tosa.const"() <{values = dense<23661> : tensor<i32>}> : () -> tensor<i32>
@@ -1467,7 +1467,7 @@ func.func @no_fold_intdiv_dynamic_result() -> tensor<?xi32> {
 // -----
 
 // CHECK-LABEL: @test_fold_i1_to_i32_cast
-// CHECK: %[[OUT:.*]] = "tosa.const"() <{values = dense<1> : tensor<i32>}> : () -> tensor<i32>
+// CHECK: %[[OUT:.*]] = tosa.const values(dense<1> : tensor<i32>) : () -> tensor<i32>
 // CHECK: return %[[OUT]] : tensor<i32>
 func.func @test_fold_i1_to_i32_cast() -> tensor<i32> {
   %0 = "tosa.const"() <{values = dense<1> : tensor<i1>}> : () -> tensor<i1>
@@ -1478,7 +1478,7 @@ func.func @test_fold_i1_to_i32_cast() -> tensor<i32> {
 // -----
 
 // CHECK-LABEL: @test_fold_i32_to_i1_cast
-// CHECK: %[[OUT:.*]] = "tosa.const"() <{values = dense<true> : tensor<i1>}> : () -> tensor<i1>
+// CHECK: %[[OUT:.*]] = tosa.const values(dense<true> : tensor<i1>) : () -> tensor<i1>
 // CHECK: return %[[OUT]] : tensor<i1>
 func.func @test_fold_i32_to_i1_cast() -> tensor<i1> {
   %0 = "tosa.const"() <{values = dense<10> : tensor<i32>}> : () -> tensor<i32>
diff --git a/mlir/test/Dialect/Tosa/constant_folding.mlir b/mlir/test/Dialect/Tosa/constant_folding.mlir
index eb339d09d77d84..2778360289d8a2 100644
--- a/mlir/test/Dialect/Tosa/constant_folding.mlir
+++ b/mlir/test/Dialect/Tosa/constant_folding.mlir
@@ -556,8 +556,8 @@ func.func @fold_mul_zero_broadcast(%arg0: tensor<2x3xf32>) -> (tensor<2x3xf32>,
 
 // CHECK-LABEL: @fold_mul_zero_dynamic_nofold
 // CHECK-SAME:                    %[[ARG0:.*]]: tensor<?x17xf32>) -> tensor<?x17xf32> {
-// CHECK:           %[[ZERO:.*]] = "tosa.const"() <{values = dense<0.000000e+00> : tensor<1x1xf32>}> : () -> tensor<1x1xf32>
-// CHECK:           %[[SHIFT:.*]] = "tosa.const"() <{values = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
+// CHECK:           %[[ZERO:.*]] = tosa.const values(dense<0.000000e+00> : tensor<1x1xf32>) : () -> tensor<1x1xf32>
+// CHECK:           %[[SHIFT:.*]] = tosa.const values(dense<0> : tensor<1xi8>) : () -> tensor<1xi8>
 // CHECK:           %[[MUL:.*]] = tosa.mul %[[ARG0]], %[[ZERO]], %[[SHIFT]] : (tensor<?x17xf32>, tensor<1x1xf32>, tensor<1xi8>) -> tensor<?x17xf32>
 // CHECK:           return %[[MUL]]
 func.func @fold_mul_zero_dynamic_nofold(%arg0: tensor<?x17xf32>) -> tensor<?x17xf32> {
diff --git a/mlir/test/Dialect/Tosa/ops.mlir b/mlir/test/Dialect/Tosa/ops.mlir
index 2c61d9c0dc3769..12afad7a9276fa 100644
--- a/mlir/test/Dialect/Tosa/ops.mlir
+++ b/mlir/test/Dialect/Tosa/ops.mlir
@@ -1336,7 +1336,7 @@ func.func @test_rescale_i16_rounding_mode(%arg0 : tensor<2xi8>) -> tensor<2xi16>
 // -----
 // CHECK-LABEL: const
 func.func @test_const(%arg0 : index) -> tensor<4xi32> {
-    %0 = "tosa.const"() <{values = dense<[3, 0, 1, 2]> : tensor<4xi32>}> : () -> tensor<4xi32>
+    %0 = tosa.const values(dense<[3, 0, 1, 2]> : tensor<4xi32>) : () -> tensor<4xi32>
     return %0 : tensor<4xi32>
 }
 
diff --git a/mlir/test/Dialect/Tosa/tosa-arith-const-to-tosa-const.mlir b/mlir/test/Dialect/Tosa/tosa-arith-const-to-tosa-const.mlir
index 79219510a239fa..7f6dfed92a57fa 100644
--- a/mlir/test/Dialect/Tosa/tosa-arith-const-to-tosa-const.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-arith-const-to-tosa-const.mlir
@@ -1,7 +1,7 @@
 // RUN: mlir-opt %s --tosa-arith-const-to-tosa-const --split-input-file | FileCheck %s
 
 // CHECK-LABEL: func.func @rewrite_f32_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<[1.000000e+00, 2.000000e+00]> : tensor<2xf32>}> : () -> tensor<2xf32>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<[1.000000e+00, 2.000000e+00]> : tensor<2xf32>) : () -> tensor<2xf32>
 // CHECK: return %[[CST]]
 func.func @rewrite_f32_tensor() -> tensor<2xf32> {
   %c = arith.constant dense<[1.000000e+00, 2.000000e+00]> : tensor<2xf32>
@@ -11,7 +11,7 @@ func.func @rewrite_f32_tensor() -> tensor<2xf32> {
 // -----
 
 // CHECK-LABEL: func.func @rewrite_i32_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<[1, 0, -1]> : tensor<3xi32>}> : () -> tensor<3xi32>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<[1, 0, -1]> : tensor<3xi32>) : () -> tensor<3xi32>
 // CHECK: return %[[CST]]
 func.func @rewrite_i32_tensor() -> tensor<3xi32> {
   %c = arith.constant dense<[1, 0, -1]> : tensor<3xi32>
@@ -21,7 +21,7 @@ func.func @rewrite_i32_tensor() -> tensor<3xi32> {
 // -----
 
 // CHECK-LABEL: func.func @rewrite_i1_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<[true, false]> : tensor<2xi1>}> : () -> tensor<2xi1>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<[true, false]> : tensor<2xi1>) : () -> tensor<2xi1>
 func.func @rewrite_i1_tensor() -> tensor<2xi1> {
   %c = arith.constant dense<[true, false]> : tensor<2xi1>
   return %c : tensor<2xi1>
@@ -30,7 +30,7 @@ func.func @rewrite_i1_tensor() -> tensor<2xi1> {
 // -----
 
 // CHECK-LABEL: func.func @rewrite_rank0_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<1.234500e+00> : tensor<f32>}> : () -> tensor<f32>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<1.234500e+00> : tensor<f32>) : () -> tensor<f32>
 func.func @rewrite_rank0_tensor() -> tensor<f32> {
   %c = arith.constant dense<1.234500e+00> : tensor<f32>
   return %c : tensor<f32>
@@ -57,7 +57,7 @@ func.func @preserve_index_tensor() -> tensor<2xindex> {
 // -----
 
 // CHECK-LABEL: func.func @rewrite_resource_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense_resource<blob1> : tensor<4xf32>}> : () -> tensor<4xf32>
+// CHECK: %[[CST:.*]] = tosa.const values(dense_resource<blob1> : tensor<4xf32>) : () -> tensor<4xf32>
 func.func @rewrite_resource_tensor() -> tensor<4xf32> {
   %c = arith.constant dense_resource<"blob1"> : tensor<4xf32>
   return %c : tensor<4xf32>
@@ -67,7 +67,7 @@ func.func @rewrite_resource_tensor() -> tensor<4xf32> {
 
 
 // CHECK-LABEL: func.func @rewrite_quant_uniform_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<["10", "20"]> : tensor<2x!quant.uniform<i8:f32, 5.000000e-01>>}> : () -> tensor<2x!quant.uniform<i8:f32, 5.000000e-01>>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<["10", "20"]> : tensor<2x!quant.uniform<i8:f32, 5.000000e-01>>) : () -> tensor<2x!quant.uniform<i8:f32, 5.000000e-01>>
 func.func @rewrite_quant_uniform_tensor() -> tensor<2x!quant.uniform<i8:f32, 0.5:0>> {
   %c = arith.constant dense<["10", "20"]> : tensor<2x!quant.uniform<i8:f32, 0.5:0>>
   return %c : tensor<2x!quant.uniform<i8:f32, 0.5:0>>
@@ -76,7 +76,7 @@ func.func @rewrite_quant_uniform_tensor() -> tensor<2x!quant.uniform<i8:f32, 0.5
 // -----
 
 // CHECK-LABEL: func.func @rewrite_fp8_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<[1.000000e+00, -5.000000e-01]> : tensor<2xf8E4M3FN>}> : () -> tensor<2xf8E4M3FN>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<[1.000000e+00, -5.000000e-01]> : tensor<2xf8E4M3FN>) : () -> tensor<2xf8E4M3FN>
 func.func @rewrite_fp8_tensor() -> tensor<2xf8E4M3FN> {
   %c = arith.constant dense<[1.0, -0.5]> : tensor<2xf8E4M3FN>
   return %c : tensor<2xf8E4M3FN>
@@ -85,7 +85,7 @@ func.func @rewrite_fp8_tensor() -> tensor<2xf8E4M3FN> {
 // -----
 
 // CHECK-LABEL: func.func @rewrite_mxint8_tensor
-// CHECK: %[[CST:.*]] = "tosa.const"() <{values = dense<["0x00", "0x7F"]> : tensor<2x!tosa.mxint8>}> : () -> tensor<2x!tosa.mxint8>
+// CHECK: %[[CST:.*]] = tosa.const values(dense<["0x00", "0x7F"]> : tensor<2x!tosa.mxint8>) : () -> tensor<2x!tosa.mxint8>
 func.func @rewrite_mxint8_tensor() -> tensor<2x!tosa.mxint8> {
   %c = arith.constant dense<["0x00", "0x7F"]> : tensor<2x!tosa.mxint8>
   return %c : tensor<2x!tosa.mxint8>
diff --git a/mlir/test/Dialect/Tosa/tosa-convert-integer-type-to-signless.mlir b/mlir/test/Dialect/Tosa/tosa-convert-integer-type-to-signless.mlir
index f89bd577dd82e8..e6054aa9e4b9fe 100644
--- a/mlir/test/Dialect/Tosa/tosa-convert-integer-type-to-signless.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-convert-integer-type-to-signless.mlir
@@ -33,8 +33,8 @@ func.func @test_rescale_input_unsigned(%arg0: tensor<1x1xui16>) -> (tensor<1x1xi
 // -----
 
 // CHECK-LABEL: test_rescale_unsigned_zp
-// CHECK: %[[ZP_IN:.*]] = "tosa.const"() <{values = dense<-2> : tensor<1xi8>}> : () -> tensor<1xi8>
-// CHECK: %[[ZP_OUT:.*]] = "tosa.const"() <{values = dense<2> : tensor<1xi8>}> : () -> tensor<1xi8>
+// CHECK: %[[ZP_IN:.*]] = tosa.const values(dense<-2> : tensor<1xi8>) : () -> tensor<1xi8>
+// CHECK: %[[ZP_OUT:.*]] = tosa.const values(dense<2> : tensor<1xi8>) : () -> tensor<1xi8>
 // CHECK: tosa.rescale %arg0, %0, %1, %[[ZP_IN]], %[[ZP_OUT]] scale32(true) rounding_mode<SINGLE_ROUND> per_channel(false) input_unsigned(true) output_unsigned(false) : (tensor<1x1xi8>, tensor<1xi32>, tensor<1xi8>, tensor<1xi8>, tensor<1xi8>)
 func.func @test_rescale_unsigned_zp(%arg0: tensor<1x1xui8>) -> tensor<1x1xi8> {
   %0 = "tosa.const"() <{values = dense<2> : tensor<1xi32>}> : () -> tensor<1xi32>
@@ -57,7 +57,7 @@ func.func @test_unsigned_function_signature(%arg0: tensor<1xui8>, %arg1: tensor<
 // -----
 
 // CHECK-LABEL: test_unsigned_const_data
-// CHECK: "tosa.const"() <{values = dense<[-1, -2, 0, 1, -128]> : tensor<5xi8>}> : () -> tensor<5xi8>
+// CHECK: tosa.const values(dense<[-1, -2, 0, 1, -128]> : tensor<5xi8>) : () -> tensor<5xi8>
 func.func @test_unsigned_const_data() -> tensor<5xui8> {
   %0 = "tosa.const"() <{values = dense<[255, 254, 0, 1, 128]> : tensor<5xui8>}> : () -> tensor<5xui8>
   return %0 : tensor<5xui8>
@@ -66,7 +66,7 @@ func.func @test_unsigned_const_data() -> tensor<5xui8> {
 // -----
 
 // CHECK-LABEL: test_unsigned_const_data_i16
-// CHECK: "tosa.const"() <{values = dense<[-1, -2, 0, 1, -32768]> : tensor<5xi16>}> : () -> tensor<5xi16>
+// CHECK: tosa.const values(dense<[-1, -2, 0, 1, -32768]> : tensor<5xi16>) : () -> tensor<5xi16>
 func.func @test_unsigned_const_data_i16() -> tensor<5xui16> {
   %0 = "tosa.const"() <{values = dense<[65535, 65534, 0, 1, 32768]> : tensor<5xui16>}> : () -> tensor<5xui16>
   return %0 : tensor<5xui16>
@@ -75,7 +75,7 @@ func.func @test_unsigned_const_data_i16() -> tensor<5xui16> {
 // -----
 
 // CHECK-LABEL: test_unsigned_const_data_i32
-// CHECK: "tosa.const"() <{values = dense<[-1, -2, 0, 1, -2147483648]> : tensor<5xi32>}> : () -> tensor<5xi32>
+// CHECK: tosa.const values(dense<[-1, -2, 0, 1, -2147483648]> : tensor<5xi32>) : () -> tensor<5xi32>
 func.func @test_unsigned_const_data_i32() -> tensor<5xui32> {
   %0 = "tosa.const"() <{values = dense<[4294967295, 4294967294, 0, 1, 2147483648]> : tensor<5xui32>}> : () -> tensor<5xui32>
   return %0 : tensor<5xui32>
@@ -84,7 +84,7 @@ func.func @test_unsigned_const_data_i32() -> tensor<5xui32> {
 // -----
 
 // CHECK-LABEL: test_unsigned_const_data_i48
-// CHECK: "tosa.const"() <{values = dense<[-1, -2, 0, 1, -140737488355328]> : tensor<5xi48>}> : () -> tensor<5xi48>
+// CHECK: tosa.const values(dense<[-1, -2, 0, 1, -140737488355328]> : tensor<5xi48>) : () -> tensor<5xi48>
 func.func @test_unsigned_const_data_i48() -> tensor<5xui48> {
   %0 = "tosa.const"() <{values = dense<[281474976710655, 281474976710654, 0, 1, 140737488355328]> : tensor<5xui48>}> : () -> tensor<5xui48>
   return %0 : tensor<5xui48>
diff --git a/mlir/test/Dialect/Tosa/tosa-decompose-depthwise.mlir b/mlir/test/Dialect/Tosa/tosa-decompose-depthwise.mlir
index 941e23061611ff..d11b0f394551e1 100644
--- a/mlir/test/Dialect/Tosa/tosa-decompose-depthwise.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-decompose-depthwise.mlir
@@ -106,7 +106,7 @@ func.func @depthwise_conv2d_no_const_zero_point(%arg0: tensor<4x10x10x2xi8>, %ar
 // CHECK-SAME:      %[[BIAS:.*]]: tensor<?xf32>) -> tensor<?x10x10x6xf32> {
 // CHECK:           %[[BIAS_EXPANDED_SHAPE:.*]] = tosa.const_shape values(dense<[1, 1, 1, -1]> : tensor<4xindex>) : () -> !tosa.shape<4>
 // CHECK:           %[[RES_EXPANDED_SHAPE:.*]] = tosa.const_shape values(dense<[-1, 10, 10, 6]> : tensor<4xindex>) : () -> !tosa.shape<4>
-// CHECK:           %[[MUL_SHIFT:.*]] = "tosa.const"() <{values = dense<0> : tensor<1xi8>}> : () -> tensor<1xi8>
+// CHECK:           %[[MUL_SHIFT:.*]] = tosa.const values(dense<0> : tensor<1xi8>) : () -> tensor<1xi8>
 // CHECK:           %[[WTS_EXPANDED_SHAPE:.*]] = tosa.const_shape values(dense<[1, 1, 1, 2, 3]> : tensor<5xindex>) : () -> !tosa.shape<5>
 // CHECK:           %[[INP_EXPANDED_SHAPE:.*]] = tosa.const_shape values(dense<[-1, 10, 10, 2, 1]> : tensor<5xindex>) : () -> !tosa.shape<5>
 // CHECK:           %[[INP_RESHAPED:.*]] = tosa.reshape %[[INP]], %[[INP_EXPANDED_SHAPE]] : (tensor<?x10x10x2xf32>, !tosa.shape<5>) -> tensor<?x10x10x2x1xf32>
diff --git a/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir b/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
index 3cd1b964a8a1c4..38488160d8a458 100644
--- a/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
+++ b/mlir/test/Dialect/Tosa/tosa-infer-shapes.mlir
@@ -100,10 +100,10 @@ func.func @test_unary_i32(%arg0 : tensor<4xi32>, %arg1 : tensor<2xi8>) -> () {
   // CHECK: tosa.reverse %arg0 axis(0) : (tensor<4xi32>) -> tensor<4xi32>
   %5 = tosa.reverse %arg0 axis(0) : (tensor<4xi32>) -> tensor<?xi32>
 
-  // CHECK-DAG: %[[MULT:.+]] = "tosa.const"() <{values = dense<[42, 43]> : tensor<2xi16>}> : () -> tensor<2xi16>
-  // CHECK-DAG: %[[SHIFT:.+]] = "tosa.const"() <{values = dense<[14, 15]> : tensor<2xi8>}> : () -> tensor<2xi8>
-  // CHECK-DAG: %[[INPUTZP:.+]] = "tosa.const"() <{values = dense<43> : tensor<1xi8>}> : () -> tensor<1xi8>
-  // CHECK-DAG: %[[OUTPUTZP:.+]] = "tosa.const"() <{values = dense<52> : tensor<1xi8>}> : () -> tensor<1xi8>
+  // CHECK-DAG: %[[MULT:.+]] = tosa.const values(dense<[42, 43]> : tensor<2xi16>) : () -> tensor<2xi16>
+  // CHECK-DAG: %[[SHIFT:.+]] = tosa.const values(dense<[14, 15]> : tensor<2xi8>) : () -> tensor<2xi8>
+  // CHECK-DAG: %[[INPUTZP:.+]] = tosa.const values(dense<43> : tensor<1xi8>) : () -> tensor<1xi8>
+  // CHECK-DAG: %[[OUTPUTZP:.+]] = tosa.const values(dense<52> : tensor<1xi8>) : () -> tensor<1xi8>
   // CHECK: tosa.rescale %arg1, %[[MULT]], %[[SHIFT]], %[[INPUTZP]], %[[OUTPUTZP]] {{.+}} : (tensor<2xi8>, tensor<2xi16>, tensor<2xi8>, tensor<1xi8>, tensor<1xi8>) -> tensor<2xi8>
   %multiplier = "tosa.const"() <{values = dense<[42, 43]> : tensor<2xi16>}> : () -> tensor<2xi16>
   %shift = "tosa.const"() <{values = dense<[14, 15]> : tensor<2xi8>}> : () -> tensor<2xi8>
@...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/225668


More information about the Mlir-commits mailing list