From 47bff7ee381ae13743b7d082508a473db1768050 Mon Sep 17 00:00:00 2001 From: sdjukicTT Date: Fri, 29 Nov 2024 14:16:17 +0000 Subject: [PATCH 1/3] adding simple op patterns and corresponding tests --- .../TosaToTTIR/TosaToTTIRPatterns.cpp | 32 +++++++++++++++++++ .../Conversion/TosaToTTIR/compare/equal.mlir | 9 ++++++ .../TosaToTTIR/compare/greater.mlir | 9 ++++++ .../TosaToTTIR/compare/greater_equal.mlir | 9 ++++++ .../TosaToTTIR/elementwise_binary/add.mlir | 9 ++++++ .../TosaToTTIR/elementwise_binary/mul.mlir} | 5 ++- .../TosaToTTIR/elementwise_unary/abs.mlir | 9 ++++++ .../TosaToTTIR/elementwise_unary/cast.mlir | 9 ++++++ .../TosaToTTIR/elementwise_unary/ceil.mlir | 9 ++++++ .../TosaToTTIR/elementwise_unary/cos.mlir | 9 ++++++ .../TosaToTTIR/elementwise_unary/exp.mlir | 9 ++++++ .../TosaToTTIR/elementwise_unary/floor.mlir | 9 ++++++ .../TosaToTTIR/logical/logical_and.mlir | 9 ++++++ .../TosaToTTIR/logical/logical_not.mlir | 9 ++++++ .../TosaToTTIR/logical/logical_or.mlir | 9 ++++++ .../TosaToTTIR/logical/logical_xor.mlir | 9 ++++++ 16 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir rename test/ttmlir/{Dialect/TTIR/tosa_to_ttir_multiply.mlir => Conversion/TosaToTTIR/elementwise_binary/mul.mlir} (64%) create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir create mode 100644 test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir diff --git a/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp b/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp index 46eadb7899..d4d92cce3a 100644 --- a/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp +++ b/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp @@ -88,6 +88,19 @@ void addElementwiseUnaryOpsConversionPatterns(MLIRContext *ctx, patterns.add>( typeConverter, ctx); + patterns.add>(typeConverter, ctx); + patterns.add>( + typeConverter, ctx); + patterns.add>( + typeConverter, ctx); + patterns.add>( + typeConverter, ctx); + patterns.add>(typeConverter, ctx); patterns.add>( typeConverter, ctx); @@ -104,12 +117,29 @@ void addElementwiseBinaryOpsConversionPatterns(MLIRContext *ctx, tosa::SubOp, mlir::tt::ttir::SubtractOp>>(typeConverter, ctx); } +void addLogicalOpConversionPattern(MLIRContext *ctx, + RewritePatternSet &patterns, + TypeConverter &typeConverter) { + patterns.add>(typeConverter, ctx); + patterns.add>(typeConverter, ctx); + patterns.add>(typeConverter, ctx); + patterns.add>(typeConverter, ctx); +} + void addCompareOpsConversionPatterns(MLIRContext *ctx, RewritePatternSet &patterns, TypeConverter &typeConverter) { + patterns.add>(typeConverter, ctx); patterns.add>(typeConverter, ctx); + patterns.add>(typeConverter, ctx); } } // namespace @@ -120,6 +150,8 @@ void populateTosaToTTIRPatterns(MLIRContext *ctx, RewritePatternSet &patterns, TypeConverter &typeConverter) { addElementwiseUnaryOpsConversionPatterns(ctx, patterns, typeConverter); addElementwiseBinaryOpsConversionPatterns(ctx, patterns, typeConverter); + addLogicalOpConversionPattern(ctx, patterns, typeConverter); + addLogicalOpConversionPattern(ctx, patterns, typeConverter); addCompareOpsConversionPatterns(ctx, patterns, typeConverter); } diff --git a/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir b/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir new file mode 100644 index 0000000000..43cc834b15 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_equal(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { + %0 = tosa.equal %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> + // CHECK: %[[EQ_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1 + // CHECK: %{{[0-9]+}} = "ttir.eq"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[EQ_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir b/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir new file mode 100644 index 0000000000..26b3f735bb --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_greater(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { + %0 = tosa.greater %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> + // CHECK: %[[GT_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1 + // CHECK: %{{[0-9]+}} = "ttir.gt"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[GT_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir b/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir new file mode 100644 index 0000000000..757a3b82eb --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_greater_equal(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { + %0 = tosa.greater_equal %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> + // CHECK: %[[GE_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1 + // CHECK: %{{[0-9]+}} = "ttir.ge"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[GE_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir new file mode 100644 index 0000000000..37d9fb3b17 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_add(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { + %0 = tosa.add %arg0, %arg1 {shift = 0 : i8} : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> + // CHECK: %[[ADD_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.add"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[ADD_OUT]]){{.+}} -> tensor<13x21x3xf32> + return %0 : tensor<13x21x3xf32> + } +} diff --git a/test/ttmlir/Dialect/TTIR/tosa_to_ttir_multiply.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir similarity index 64% rename from test/ttmlir/Dialect/TTIR/tosa_to_ttir_multiply.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir index fd35f0cd10..ee9543654f 100644 --- a/test/ttmlir/Dialect/TTIR/tosa_to_ttir_multiply.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir @@ -1,10 +1,9 @@ // RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s -#any_device = #tt.operand_constraint module attributes {} { func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.mul %arg0, %arg1 {shift = 0 : i8} : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[C:.*]] = tensor.empty[[C:.*]] - // CHECK: %[[C:.*]] = "ttir.multiply"[[C:.*]] + // CHECK: %[[MUL_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.multiply"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[MUL_OUT]]){{.+}} -> tensor<13x21x3xf32> return %0 : tensor<13x21x3xf32> } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir new file mode 100644 index 0000000000..7aa4404301 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_abs(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { + %0 = tosa.abs %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> + // CHECK: %[[ABS_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.abs"(%arg{{[0-9]+}}, %[[ABS_OUT]]){{.+}}-> tensor<13x21x3xf32> + return %0 : tensor<13x21x3xf32> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir new file mode 100644 index 0000000000..f8205a97a9 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_cast(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xbf16> { + %0 = tosa.cast %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xbf16> + // CHECK: %[[CAST_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xbf16> + // CHECK: %{{[0-9]+}} = "ttir.typecast"(%arg{{[0-9]+}}, %[[CAST_OUT]]){{.+}} : (tensor<13x21x3xf32>, tensor<13x21x3xbf16>) -> tensor<13x21x3xbf16> + return %0 : tensor<13x21x3xbf16> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir new file mode 100644 index 0000000000..a9dddfd572 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_ceil(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { + %0 = tosa.ceil %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> + // CHECK: %[[CEIL_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.ceil"(%arg{{[0-9]+}}, %[[CEIL_OUT]]){{.+}}-> tensor<13x21x3xf32> + return %0 : tensor<13x21x3xf32> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir new file mode 100644 index 0000000000..6fa9df6622 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_cos(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { + %0 = tosa.cos %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> + // CHECK: %[[COS_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.cos"(%arg{{[0-9]+}}, %[[COS_OUT]]){{.+}}-> tensor<13x21x3xf32> + return %0 : tensor<13x21x3xf32> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir new file mode 100644 index 0000000000..2164439caf --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_exp(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { + %0 = tosa.exp %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> + // CHECK: %[[EXP_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.exp"(%arg{{[0-9]+}}, %[[EXP_OUT]]){{.+}}-> tensor<13x21x3xf32> + return %0 : tensor<13x21x3xf32> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir new file mode 100644 index 0000000000..81a2fc8e05 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_floor(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { + %0 = tosa.floor %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> + // CHECK: %[[FLOOR_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> + // CHECK: %{{[0-9]+}} = "ttir.floor"(%arg{{[0-9]+}}, %[[FLOOR_OUT]]){{.+}}-> tensor<13x21x3xf32> + return %0 : tensor<13x21x3xf32> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir new file mode 100644 index 0000000000..8111ffb070 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_logical_and(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { + %0 = tosa.logical_and %arg0, %arg1 : (tensor<13x21x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> + // CHECK: %[[LOGICAL_AND_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> + // CHECK: %{{[0-9]+}} = "ttir.logical_and"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[LOGICAL_AND_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir new file mode 100644 index 0000000000..e6843be38a --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_logical_not(%arg0: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { + %0 = tosa.logical_not %arg0 : (tensor<13x21x3xi1>) -> tensor<13x21x3xi1> + // CHECK: %[[LOGICAL_NOT_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> + // CHECK: %{{[0-9]+}} = "ttir.logical_not"(%arg{{[0-9]+}}, %[[LOGICAL_NOT_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir new file mode 100644 index 0000000000..2e80853b59 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_logical_or(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { + %0 = tosa.logical_or %arg0, %arg1 : (tensor<13x21x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> + // CHECK: %[[LOGICAL_OR_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> + // CHECK: %{{[0-9]+}} = "ttir.logical_or"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[LOGICAL_OR_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir new file mode 100644 index 0000000000..592b331725 --- /dev/null +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir @@ -0,0 +1,9 @@ +// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s +module attributes {} { + func.func @test_logical_xor(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { + %0 = tosa.logical_xor %arg0, %arg1 : (tensor<13x21x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> + // CHECK: %[[LOGICAL_XOR_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> + // CHECK: %{{[0-9]+}} = "ttir.logical_xor"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[LOGICAL_XOR_OUT]]){{.+}} -> tensor<13x21x3xi1> + return %0 : tensor<13x21x3xi1> + } +} From 8dc87523de09c49bb575de98be3d40e9c07c3203 Mon Sep 17 00:00:00 2001 From: sdjukicTT Date: Mon, 2 Dec 2024 21:14:37 +0000 Subject: [PATCH 2/3] made test checks more consistent, added return check to tests, removed duplicate line in TOSAToTTIRPatterns.cpp --- lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp | 1 - test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir | 5 +++-- .../ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir | 5 +++-- .../ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir | 5 +++-- .../ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir | 5 +++-- .../ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir | 5 +++-- .../Conversion/TosaToTTIR/elementwise_unary/floor.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir | 5 +++-- test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir | 5 +++-- 16 files changed, 45 insertions(+), 31 deletions(-) diff --git a/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp b/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp index d4d92cce3a..4ed74d0062 100644 --- a/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp +++ b/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp @@ -151,7 +151,6 @@ void populateTosaToTTIRPatterns(MLIRContext *ctx, RewritePatternSet &patterns, addElementwiseUnaryOpsConversionPatterns(ctx, patterns, typeConverter); addElementwiseBinaryOpsConversionPatterns(ctx, patterns, typeConverter); addLogicalOpConversionPattern(ctx, patterns, typeConverter); - addLogicalOpConversionPattern(ctx, patterns, typeConverter); addCompareOpsConversionPatterns(ctx, patterns, typeConverter); } diff --git a/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir b/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir index 43cc834b15..20387a6f1a 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/compare/equal.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_equal(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = tosa.equal %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> - // CHECK: %[[EQ_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1 - // CHECK: %{{[0-9]+}} = "ttir.eq"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[EQ_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.eq"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: (tensor<13x21x3xf32>, tensor<13x21x3xf32>, [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir b/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir index 26b3f735bb..7487492997 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/compare/greater.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_greater(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = tosa.greater %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> - // CHECK: %[[GT_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1 - // CHECK: %{{[0-9]+}} = "ttir.gt"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[GT_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.gt"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: (tensor<13x21x3xf32>, tensor<13x21x3xf32>, [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir b/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir index 757a3b82eb..479af38156 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/compare/greater_equal.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_greater_equal(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xi1> { %0 = tosa.greater_equal %arg0, %arg1 : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xi1> - // CHECK: %[[GE_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1 - // CHECK: %{{[0-9]+}} = "ttir.ge"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[GE_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.ge"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: (tensor<13x21x3xf32>, tensor<13x21x3xf32>, [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir index 37d9fb3b17..b16e8e40ce 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/add.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_add(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.add %arg0, %arg1 {shift = 0 : i8} : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[ADD_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.add"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[ADD_OUT]]){{.+}} -> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.add"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir index ee9543654f..137939fcf8 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/mul.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_mul(%arg0: tensor<13x21x3xf32>, %arg1: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.mul %arg0, %arg1 {shift = 0 : i8} : (tensor<13x21x3xf32>, tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[MUL_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.multiply"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[MUL_OUT]]){{.+}} -> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.multiply"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir index 7aa4404301..9df5a2828b 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/abs.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_abs(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.abs %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[ABS_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.abs"(%arg{{[0-9]+}}, %[[ABS_OUT]]){{.+}}-> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.abs"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir index f8205a97a9..4ee3a742b6 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cast.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_cast(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xbf16> { %0 = tosa.cast %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xbf16> - // CHECK: %[[CAST_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xbf16> - // CHECK: %{{[0-9]+}} = "ttir.typecast"(%arg{{[0-9]+}}, %[[CAST_OUT]]){{.+}} : (tensor<13x21x3xf32>, tensor<13x21x3xbf16>) -> tensor<13x21x3xbf16> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xbf16>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.typecast"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: (tensor<13x21x3xf32>, [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xbf16> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir index a9dddfd572..77dc60dc30 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/ceil.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_ceil(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.ceil %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[CEIL_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.ceil"(%arg{{[0-9]+}}, %[[CEIL_OUT]]){{.+}}-> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.ceil"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir index 6fa9df6622..1a8aafd6b0 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/cos.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_cos(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.cos %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[COS_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.cos"(%arg{{[0-9]+}}, %[[COS_OUT]]){{.+}}-> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.cos"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir index 2164439caf..9575640211 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/exp.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_exp(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.exp %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[EXP_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.exp"(%arg{{[0-9]+}}, %[[EXP_OUT]]){{.+}}-> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.exp"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir index 81a2fc8e05..4653bfd3ee 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/floor.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_floor(%arg0: tensor<13x21x3xf32>) -> tensor<13x21x3xf32> { %0 = tosa.floor %arg0 : (tensor<13x21x3xf32>) -> tensor<13x21x3xf32> - // CHECK: %[[FLOOR_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xf32> - // CHECK: %{{[0-9]+}} = "ttir.floor"(%arg{{[0-9]+}}, %[[FLOOR_OUT]]){{.+}}-> tensor<13x21x3xf32> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xf32>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.floor"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xf32> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir index 8111ffb070..adab66f3a2 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_and.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_logical_and(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = tosa.logical_and %arg0, %arg1 : (tensor<13x21x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> - // CHECK: %[[LOGICAL_AND_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> - // CHECK: %{{[0-9]+}} = "ttir.logical_and"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[LOGICAL_AND_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.logical_and"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir index e6843be38a..ca74f1ab91 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_not.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_logical_not(%arg0: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = tosa.logical_not %arg0 : (tensor<13x21x3xi1>) -> tensor<13x21x3xi1> - // CHECK: %[[LOGICAL_NOT_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> - // CHECK: %{{[0-9]+}} = "ttir.logical_not"(%arg{{[0-9]+}}, %[[LOGICAL_NOT_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.logical_not"(%arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir index 2e80853b59..4a4ab6eaef 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_or.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_logical_or(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = tosa.logical_or %arg0, %arg1 : (tensor<13x21x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> - // CHECK: %[[LOGICAL_OR_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> - // CHECK: %{{[0-9]+}} = "ttir.logical_or"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[LOGICAL_OR_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.logical_or"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}: ([[TENSOR_SIZE]], [[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } diff --git a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir index 592b331725..6492691566 100644 --- a/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir +++ b/test/ttmlir/Conversion/TosaToTTIR/logical/logical_xor.mlir @@ -2,8 +2,9 @@ module attributes {} { func.func @test_logical_xor(%arg0: tensor<13x21x3xi1>, %arg1: tensor<13x21x3xi1>) -> tensor<13x21x3xi1> { %0 = tosa.logical_xor %arg0, %arg1 : (tensor<13x21x3xi1>, tensor<13x21x3xi1>) -> tensor<13x21x3xi1> - // CHECK: %[[LOGICAL_XOR_OUT:[0-9]+]] = tensor.empty() : tensor<13x21x3xi1> - // CHECK: %{{[0-9]+}} = "ttir.logical_xor"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, %[[LOGICAL_XOR_OUT]]){{.+}} -> tensor<13x21x3xi1> + // CHECK: [[VAL0:%[0-9]+]] = tensor.empty() : [[TENSOR_SIZE:tensor<13x21x3xi1>]] + // CHECK: [[VAL1:%[0-9]+]] = "ttir.logical_xor"(%arg{{[0-9]+}}, %arg{{[0-9]+}}, [[VAL0]]){{.+}}([[TENSOR_SIZE]], [[TENSOR_SIZE]], [[TENSOR_SIZE]]) -> [[TENSOR_SIZE]] return %0 : tensor<13x21x3xi1> + // CHECK: return [[VAL1]] : [[TENSOR_SIZE]] } } From 3cf25641507c72c6a9064796ae817eb56a8957d6 Mon Sep 17 00:00:00 2001 From: sdjukicTT Date: Tue, 3 Dec 2024 14:46:14 +0000 Subject: [PATCH 3/3] made test names consistent --- lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp | 8 ++++---- .../elementwise_binary/{maximum_op.mlir => maximum.mlir} | 0 .../elementwise_binary/{minimum_op.mlir => minimum.mlir} | 0 .../elementwise_binary/{subtract_op.mlir => sub.mlir} | 0 .../elementwise_ternary/{select_op.mlir => select.mlir} | 0 .../elementwise_unary/{negate_op.mlir => negate.mlir} | 0 .../{reciprocal_op.mlir => reciprocal.mlir} | 0 .../elementwise_unary/{rsqrt_op.mlir => rsqrt.mlir} | 0 .../elementwise_unary/{sigmoid_op.mlir => sigmoid.mlir} | 0 .../elementwise_unary/{sin_op.mlir => sin.mlir} | 0 10 files changed, 4 insertions(+), 4 deletions(-) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/{maximum_op.mlir => maximum.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/{minimum_op.mlir => minimum.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/{subtract_op.mlir => sub.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_ternary/{select_op.mlir => select.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/{negate_op.mlir => negate.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/{reciprocal_op.mlir => reciprocal.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/{rsqrt_op.mlir => rsqrt.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/{sigmoid_op.mlir => sigmoid.mlir} (100%) rename test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/{sin_op.mlir => sin.mlir} (100%) diff --git a/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp b/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp index 3221945e27..7ab3ed5d27 100644 --- a/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp +++ b/lib/Conversion/TosaToTTIR/TosaToTTIRPatterns.cpp @@ -129,7 +129,7 @@ void addElementwiseBinaryOpsConversionPatterns(MLIRContext *ctx, patterns.add>(typeConverter, ctx); } - + void addElementwiseTernaryOpsConversionPatterns(MLIRContext *ctx, RewritePatternSet &patterns, TypeConverter &typeConverter) { @@ -138,8 +138,8 @@ void addElementwiseTernaryOpsConversionPatterns(MLIRContext *ctx, } void addLogicalOpsConversionPatterns(MLIRContext *ctx, - RewritePatternSet &patterns, - TypeConverter &typeConverter) { + RewritePatternSet &patterns, + TypeConverter &typeConverter) { patterns.add>(typeConverter, ctx); patterns.add>(typeConverter, ctx); } - + } // namespace namespace mlir::tt { diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/maximum_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/maximum.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/maximum_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/maximum.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/minimum_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/minimum.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/minimum_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/minimum.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/subtract_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/sub.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/subtract_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_binary/sub.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_ternary/select_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_ternary/select.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_ternary/select_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_ternary/select.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/negate_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/negate.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/negate_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/negate.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/reciprocal_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/reciprocal.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/reciprocal_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/reciprocal.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/rsqrt_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/rsqrt.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/rsqrt_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/rsqrt.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sigmoid_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sigmoid.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sigmoid_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sigmoid.mlir diff --git a/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sin_op.mlir b/test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sin.mlir similarity index 100% rename from test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sin_op.mlir rename to test/ttmlir/Conversion/TosaToTTIR/elementwise_unary/sin.mlir