-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add TOSA to TTIR conversions for sum and max reductions (#1480)
* Add TOSA to TTIR conversions for sum and max reductions * Add return checks to tests * replace auto with concrete types
- Loading branch information
1 parent
8a6151b
commit 8fabbbd
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s | ||
module attributes {} { | ||
func.func @test_max(%arg0: tensor<13x21x3xf32>) -> tensor<13x1x3xf32> { | ||
// CHECK: func.func {{.+}} [[IN_SIZE:tensor<[0-9]+x[0-9]+x[0-9]+xf32>]]{{.*}} -> | ||
%0 = tosa.reduce_max %arg0 {axis = 1 : i32} : (tensor<13x21x3xf32>) -> tensor<13x1x3xf32> | ||
// CHECK: %[[OP_OUT:[0-9]+]] = tensor.empty() : [[OUT_SIZE:tensor<[0-9]+x[0-9]+x[0-9]+xf32>]] | ||
// CHECK: %[[VAL:[0-9]+]] = "ttir.max"(%arg{{[0-9]+}}, %[[OP_OUT]]){{.+}} ([[IN_SIZE]], [[OUT_SIZE]]) -> [[OUT_SIZE]] | ||
// CHECK: return %[[VAL]] : [[OUT_SIZE]] | ||
return %0 : tensor<13x1x3xf32> | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// RUN: ttmlir-opt --convert-tosa-to-ttir %s | FileCheck %s | ||
module attributes {} { | ||
func.func @test_sum(%arg0: tensor<13x21x3xf32>) -> tensor<13x1x3xf32> { | ||
// CHECK: func.func {{.+}} [[IN_SIZE:tensor<[0-9]+x[0-9]+x[0-9]+xf32>]]{{.*}} -> | ||
%0 = tosa.reduce_sum %arg0 {axis = 1 : i32} : (tensor<13x21x3xf32>) -> tensor<13x1x3xf32> | ||
// CHECK: %[[OP_OUT:[0-9]+]] = tensor.empty() : [[OUT_SIZE:tensor<[0-9]+x[0-9]+x[0-9]+xf32>]] | ||
// CHECK: %[[VAL:[0-9]+]] = "ttir.sum"(%arg{{[0-9]+}}, %[[OP_OUT]]){{.+}} ([[IN_SIZE]], [[OUT_SIZE]]) -> [[OUT_SIZE]] | ||
// CHECK: return %[[VAL]] : [[OUT_SIZE]] | ||
return %0 : tensor<13x1x3xf32> | ||
} | ||
} |