forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tosa.reduce_sum: Support any rank (#85)
- Loading branch information
1 parent
83d5a86
commit 8330ba1
Showing
2 changed files
with
56 additions
and
12 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,44 @@ | ||
// RUN: mlir-opt %s | mlir-opt | FileCheck %s | ||
// AMD extention to allow any rank in tosa reduction operations | ||
|
||
// ----- | ||
// CHECK-LABEL: reduce_all | ||
func.func @test_reduce_all(%arg0: tensor<13x21x3x5x9xi1>) -> tensor<1x21x3x5x9xi1> { | ||
%0 = "tosa.reduce_all"(%arg0) {axis = 0 : i64} : (tensor<13x21x3x5x9xi1>) -> tensor<1x21x3x5x9xi1> | ||
return %0 : tensor<1x21x3x5x9xi1> | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: reduce_any | ||
func.func @test_reduce_any(%arg0: tensor<13x21x3x5x9xi1>) -> tensor<1x21x3x5x9xi1> { | ||
%0 = "tosa.reduce_any"(%arg0) {axis = 0 : i64} : (tensor<13x21x3x5x9xi1>) -> tensor<1x21x3x5x9xi1> | ||
return %0 : tensor<1x21x3x5x9xi1> | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: reduce_max | ||
func.func @test_reduce_max(%arg0: tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> { | ||
%0 = "tosa.reduce_max"(%arg0) {axis = 0 : i64} : (tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> | ||
return %0 : tensor<1x21x3x5x9xf32> | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: reduce_min | ||
func.func @test_reduce_min(%arg0: tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> { | ||
%0 = "tosa.reduce_min"(%arg0) {axis = 0 : i64} : (tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> | ||
return %0 : tensor<1x21x3x5x9xf32> | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: reduce_product | ||
func.func @test_reduce_product(%arg0: tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> { | ||
%0 = "tosa.reduce_prod"(%arg0) {axis = 0 : i64} : (tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> | ||
return %0 : tensor<1x21x3x5x9xf32> | ||
} | ||
|
||
// ----- | ||
// CHECK-LABEL: reduce_sum | ||
func.func @test_reduce_sum(%arg0: tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> { | ||
%0 = "tosa.reduce_sum"(%arg0) {axis = 0 : i64} : (tensor<13x21x3x5x9xf32>) -> tensor<1x21x3x5x9xf32> | ||
return %0 : tensor<1x21x3x5x9xf32> | ||
} |