-
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.
- Loading branch information
1 parent
0c49bea
commit 3cfbbcc
Showing
41 changed files
with
240 additions
and
24 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
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
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
test/ttmlir/Dialect/TTIR/data_movement/repeat/repeat_tests_negative.mlir
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,36 @@ | ||
// RUN: not ttmlir-opt --split-input-file %s 2>&1 | FileCheck %s | ||
// Negative tests for repeat operation | ||
|
||
// Verify that the parsing fails if the input tensor and repeat_dimensions attribute doesn't have the same rank | ||
module { | ||
func.func @repeat_not_valid_repeat_dimension_attribute(%arg0: tensor<32x32xf32>) -> tensor<32x64xf32> { | ||
// CHECK: 'ttir.repeat' op Input tensor rank 2 doesn't match the number of repeat dimensions 1. | ||
%0 = tensor.empty() : tensor<32x64xf32> | ||
%1 = "ttir.repeat"(%arg0, %0) {repeat_dimensions = array<i32 : 2>} : (tensor<32x32xf32>, tensor<32x64xf32>) -> tensor<32x64xf32> | ||
return %1 : tensor<32x64xf32> | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
// Verify that the parsing fails if the input tensor and repeat_dimensions attribute doesn't have the same rank | ||
module { | ||
func.func @repeat_not_valid_input_output(%arg0: tensor<32x32xf32>) -> tensor<1x32x64xf32> { | ||
// CHECK: 'ttir.repeat' op Input tensor rank 2 doesn't match the output tensor rank 3. | ||
%0 = tensor.empty() : tensor<1x32x64xf32> | ||
%1 = "ttir.repeat"(%arg0, %0) {repeat_dimensions = array<i32 : 1, 2>} : (tensor<32x32xf32>, tensor<1x32x64xf32>) -> tensor<1x32x64xf32> | ||
return %1 : tensor<1x32x64xf32> | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
// Verify that the parsing fails if the output tensor dimensions are not expected | ||
module { | ||
func.func @repeat_not_valid_input_output(%arg0: tensor<32x32xf32>) -> tensor<32x128xf32> { | ||
// CHECK: 'ttir.repeat' op Input tensor shape (32,32) at index 1 does not repeat to output (32,128) using repeat value 2. | ||
%0 = tensor.empty() : tensor<32x128xf32> | ||
%1 = "ttir.repeat"(%arg0, %0) {repeat_dimensions = array<i32 : 1, 2>} : (tensor<32x32xf32>, tensor<32x128xf32>) -> tensor<32x128xf32> | ||
return %1 : tensor<32x128xf32> | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions
33
test/ttmlir/Dialect/TTNN/data_movement/repeat/repeat_tests_negative.mlir
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,33 @@ | ||
// RUN: not ttmlir-opt --split-input-file %s 2>&1 | FileCheck %s | ||
// Negative tests for repeat operation | ||
|
||
// Verify that the parsing fails if the input tensor and repeat_dimensions attribute doesn't have the same rank | ||
module { | ||
func.func @repeat_not_valid_repeat_dimension_attribute(%arg0: tensor<32x32xf32>) -> tensor<32x64xf32> { | ||
// CHECK: 'ttnn.repeat' op Input tensor rank 2 doesn't match the number of repeat dimensions 1. | ||
%0 = "ttnn.repeat"(%arg0) {repeat_dims = [2 : i32]} : (tensor<32x32xf32>) -> tensor<32x64xf32> | ||
return %0 : tensor<32x64xf32> | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
// Verify that the parsing fails if the input tensor and repeat_dimensions attribute doesn't have the same rank | ||
module { | ||
func.func @repeat_not_valid_input_output(%arg0: tensor<32x32xf32>) -> tensor<1x32x64xf32> { | ||
// CHECK: 'ttnn.repeat' op Input tensor rank 2 doesn't match the output tensor rank 3. | ||
%0 = "ttnn.repeat"(%arg0) {repeat_dims = [1 : i32, 2 : i32]} : (tensor<32x32xf32>) -> tensor<1x32x64xf32> | ||
return %0 : tensor<1x32x64xf32> | ||
} | ||
} | ||
|
||
// ----- | ||
|
||
// Verify that the parsing fails if the output tensor dimensions are not expected | ||
module { | ||
func.func @repeat_not_valid_input_output(%arg0: tensor<32x32xf32>) -> tensor<32x128xf32> { | ||
// CHECK: 'ttnn.repeat' op Input tensor shape (32,32) at index 1 does not repeat to output (32,128) using repeat value 2. | ||
%0 = "ttnn.repeat"(%arg0) {repeat_dims = [1 : i32, 2 : i32]} : (tensor<32x32xf32>) -> tensor<32x128xf32> | ||
return %0 : tensor<32x128xf32> | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
test/ttmlir/Dialect/TTNN/data_movement/repeat/repeat_tests_positive.mlir
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,19 @@ | ||
// RUN: ttmlir-opt --ttir-to-ttnn-backend-pipeline %s | FileCheck %s | ||
|
||
module { | ||
func.func @repeat_on_one_dim(%arg0: tensor<1x32x32xf32>) -> tensor<32x32x32xf32> { | ||
// CHECK: "ttnn.repeat" | ||
// CHECK-SAME: repeat_dims = [32 : i32, 1 : i32, 1 : i32] | ||
%0 = tensor.empty() : tensor<32x32x32xf32> | ||
%1 = "ttir.repeat"(%arg0, %0) {repeat_dimensions = array<i32: 32, 1, 1>} : (tensor<1x32x32xf32>, tensor<32x32x32xf32>) -> tensor<32x32x32xf32> | ||
return %1 : tensor<32x32x32xf32> | ||
} | ||
|
||
func.func @repeat_on_all_dims(%arg0: tensor<1x1x32xf32>) -> tensor<32x32x64xf32> { | ||
// CHECK: "ttnn.repeat" | ||
// CHECK-SAME: repeat_dims = [32 : i32, 32 : i32, 2 : i32] | ||
%0 = tensor.empty() : tensor<32x32x64xf32> | ||
%1 = "ttir.repeat"(%arg0, %0) {repeat_dimensions = array<i32: 32, 32, 2>} : (tensor<1x1x32xf32>, tensor<32x32x64xf32>) -> tensor<32x32x64xf32> | ||
return %1 : tensor<32x32x64xf32> | ||
} | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
12 changes: 12 additions & 0 deletions
12
test/ttmlir/Silicon/TTNN/data_movement/repeat/simple_repeat.mlir
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,12 @@ | ||
// RUN: ttmlir-opt --ttir-to-ttnn-backend-pipeline="system-desc-path=%system_desc_path%" %s > %t.mlir | ||
// RUN: FileCheck %s --input-file=%t.mlir | ||
// RUN: ttmlir-translate --ttnn-to-flatbuffer %t.mlir > %t.ttnn | ||
module { | ||
func.func @repeat(%arg0: tensor<1x32x32xf32>) -> tensor<32x32x32xf32> { | ||
// CHECK: "ttnn.repeat" | ||
// CHECK-SAME: repeat_dims = [32 : i32, 1 : i32, 1 : i32] | ||
%0 = tensor.empty() : tensor<32x32x32xf32> | ||
%1 = "ttir.repeat"(%arg0, %0) {repeat_dimensions = array<i32: 32, 1, 1>} : (tensor<1x32x32xf32>, tensor<32x32x32xf32>) -> tensor<32x32x32xf32> | ||
return %1 : tensor<32x32x32xf32> | ||
} | ||
} |
File renamed without changes.
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
Oops, something went wrong.