Skip to content

Commit

Permalink
add trivial test
Browse files Browse the repository at this point in the history
  • Loading branch information
j2kun committed Jan 14, 2025
1 parent fc2a6de commit f3fb651
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/Transforms/layout_propagation/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("//bazel:lit.bzl", "glob_lit_tests")

package(default_applicable_licenses = ["@heir//:license"])

glob_lit_tests(
name = "all_tests",
data = ["@heir//tests:test_utilities"],
driver = "@heir//tests:run_lit.sh",
test_file_exts = ["mlir"],
)
16 changes: 16 additions & 0 deletions tests/Transforms/layout_propagation/elementwise_add.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// RUN: heir-opt --layout-propagation %s | FileCheck %s

!stensor = !secret.secret<tensor<32x32xi16>>
#row_major = affine_map<(i, j) -> (32*i + j)>

// Just test that the layout propagation pass runs, even though no layout
// conversion ops are inserted.
// CHECK-LABEL: elementwise_sum
func.func @elementwise_sum(%arg0: !stensor, %arg1: !stensor) -> !stensor {
%0 = secret.generic ins(%arg0, %arg1: !stensor, !stensor) {
^body(%pt_arg0: tensor<32x32xi16>, %pt_arg1: tensor<32x32xi16>):
%3 = arith.addi %pt_arg0, %pt_arg1: tensor<32x32xi16>
secret.yield %3 : tensor<32x32xi16>
} -> !stensor
return %0 : !stensor
}

0 comments on commit f3fb651

Please sign in to comment.