Skip to content

Commit

Permalink
Move subbyte e2e tests to another folder
Browse files Browse the repository at this point in the history
  • Loading branch information
lialan committed Nov 6, 2024
1 parent b8b912d commit ba8c833
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
7 changes: 0 additions & 7 deletions tests/e2e/linalg/subbyte_types.mlir

This file was deleted.

28 changes: 28 additions & 0 deletions tests/e2e/subbyte_types/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
################################################################################
# Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from #
# tests/e2e/linalg/BUILD.bazel #
# #
# Use iree_cmake_extra_content from iree/build_defs.oss.bzl to add arbitrary #
# CMake-only content. #
# #
# To disable autogeneration for this file entirely, delete this header. #
################################################################################

iree_add_all_subdirs()

iree_check_single_backend_test_suite(
NAME
check_llvm-cpu_subbyte_emulation
SRCS
"subbyte_types.mlir"
TARGET_BACKEND
"llvm-cpu"
DRIVER
"local-task"
COMPILER_FLAGS
"--iree-llvmcpu-target-cpu=generic"
LABELS
"nowasm"
)

### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###
24 changes: 24 additions & 0 deletions tests/e2e/subbyte_types/subbyte_types.mlir
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
func.func @i4_type() {
%input1 = util.unfoldable_constant dense<[0, 1, 2, 3, 3, 2, 1, 0]> : tensor<8xi4>
%input2 = util.unfoldable_constant dense<[1, 2, 3, 4, 4, 3, 2, 1]> : tensor<8xi4>
%res = arith.addi %input1, %input2 : tensor<8xi4>
check.expect_eq_const(%res, dense<[1, 3, 5, 7, 7, 5, 3, 1]> : tensor<8xi4>) : tensor<8xi4>
return
}

func.func @i1_type() {
%input1 = util.unfoldable_constant dense<[0, 1, 0, 1, 0, 1, 0, 1]> : tensor<8xi1>
%input2 = util.unfoldable_constant dense<[1, 0, 1, 0, 1, 0, 1, 0]> : tensor<8xi1>
%res = arith.xori %input1, %input2 : tensor<8xi1>
check.expect_eq_const(%res, dense<[1, 1, 1, 1, 1, 1, 1, 1]> : tensor<8xi1>) : tensor<8xi1>
return
}

func.func @i1_type_2d() {
%lhs = util.unfoldable_constant dense<[[0, 1, 0], [1, 0, 1], [0, 1, 0]]> : tensor<3x3xi1>
%rhs = util.unfoldable_constant dense<[[1, 0, 1], [0, 1, 0], [1, 0, 1]]> : tensor<3x3xi1>
%acc = util.unfoldable_constant dense<[[0, 0, 0], [0, 0, 0], [0, 0, 0]]> : tensor<3x3xi1>
%result = linalg.matmul ins(%lhs, %rhs : tensor<3x3xi1>, tensor<3x3xi1>) outs(%acc : tensor<3x3xi1>) -> tensor<3x3xi1>
check.expect_eq_const(%result, dense<[[0, 1, 0], [0, 0, 0], [0, 1, 0]]> : tensor<3x3xi1>) : tensor<3x3xi1>
return
}

0 comments on commit ba8c833

Please sign in to comment.