Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e2e test suite for the Attention - CPU Backend #17751

Merged
merged 35 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
91f96d8
Update the induction variables as b, m, k1, k2, and n
IanNod Aug 5, 2024
02a0b61
Update the induction variables as b, m, k1, k2, and n
IanNod Aug 5, 2024
42f542b
Fix the IR generation for attention op
IanNod Aug 6, 2024
1b5660d
Formatting
erman-gurses Aug 6, 2024
cdf9aaf
Formatting Signed-off-by: Erman Gurses <[email protected]>
erman-gurses Aug 6, 2024
76dda65
Modify large and medium tests dim sizes
erman-gurses Aug 6, 2024
37c1d0f
Modify the induction variable names in the indexing maps
erman-gurses Aug 6, 2024
49b3597
Remove unnecessary functions
erman-gurses Aug 6, 2024
acaa8ee
Remote first init for the tensors
erman-gurses Aug 6, 2024
282ccef
Add formatting
erman-gurses Aug 6, 2024
5f6ad3c
Upper case BUILD.bazel file
erman-gurses Aug 7, 2024
75e223a
Change any fa2 naming to attention
erman-gurses Aug 7, 2024
ddf6b26
Formatting
erman-gurses Aug 7, 2024
d3c9597
Add ref implementation as FP32
erman-gurses Aug 7, 2024
5a6797c
Remove the unused variable
erman-gurses Aug 9, 2024
6a624c0
Convert codegen impmentation to FP16
erman-gurses Aug 12, 2024
be33c7f
Add free tensor
erman-gurses Aug 12, 2024
08d1e08
Update tensor dimensions
erman-gurses Aug 12, 2024
36cc83a
Remove unused variable
erman-gurses Aug 12, 2024
7b5e630
Fomatting
erman-gurses Aug 12, 2024
f2ffbca
Add FP32 conversion in the genereated IR
erman-gurses Aug 13, 2024
88dbcad
Update comments and change var usage
erman-gurses Aug 13, 2024
6e5a197
Formatting
erman-gurses Aug 13, 2024
71674f5
Change induction vars order
erman-gurses Aug 13, 2024
b4c09f4
Revert back the induction vars
erman-gurses Aug 14, 2024
552a53f
Refactor Attention tensor allocation
erman-gurses Aug 14, 2024
dd5c77e
Test asan for F32
erman-gurses Aug 14, 2024
f798491
Add deinit for expeted and actual results
erman-gurses Aug 14, 2024
5dac798
Test FP16 to FP32 conversion
erman-gurses Aug 15, 2024
16f38f8
Change test dims size to avoid timeout
erman-gurses Aug 15, 2024
4785d2a
Use max for eliminate unecessary exp
erman-gurses Aug 16, 2024
707526b
Change the name of MAX function to FINDMAX
erman-gurses Aug 16, 2024
fabae1b
Replace FINDMAX with iree_max
erman-gurses Aug 19, 2024
99fc4a8
Remove unnecessary header
erman-gurses Aug 19, 2024
d2a677c
Rename SSA vars
erman-gurses Aug 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions tests/e2e/attention/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2024 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# End-to-end attention tests.

load("//build_tools/bazel:iree_e2e_generated_runner_test.bzl", "iree_generated_e2e_runner_test")

package(
features = ["layering_check"],
licenses = ["notice"], # Apache 2.0
)

py_binary(
name = "generate_e2e_attention_tests",
srcs = ["generate_e2e_attention_tests.py"],
)

###########################################################################
##
## LLVMCPU backend
##
###########################################################################

# Default CPU backend.
[iree_generated_e2e_runner_test(
name = "e2e_attention_cpu_%s_%s_%s_%s" % (dtype, dtype, dtype, size),
erman-gurses marked this conversation as resolved.
Show resolved Hide resolved
generator = ":generate_e2e_attention_tests",
generator_args = [
"--query_type=%s" % dtype,
"--key_type=%s" % dtype,
"--value_type=%s" % dtype,
erman-gurses marked this conversation as resolved.
Show resolved Hide resolved
"--shapes=%s" % size,
],
tags = [
"hostonly",
"local",
],
target_backends_and_drivers = [
("llvm-cpu", "local-task"),
],
target_cpu_features_variants = ["default"],
test_runner = "//tools/testing/e2e:iree-e2e-attention-test",
test_type = "attention",
) for dtype in [
"f16",
] for size in [
"small",
"medium",
"large",
]]
88 changes: 88 additions & 0 deletions tests/e2e/attention/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
################################################################################
# Autogenerated by build_tools/bazel_to_cmake/bazel_to_cmake.py from #
# tests/e2e/attention/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_generated_e2e_runner_test(
NAME
e2e_attention_cpu_f16_f16_f16_small
TEST_TYPE
attention
GENERATOR
"generate_e2e_attention_tests.py"
GENERATOR_ARGS
"--query_type=f16"
"--key_type=f16"
"--value_type=f16"
"--shapes=small"
TEST_RUNNER
iree_tools_testing_e2e_iree-e2e-attention-test
TARGET_BACKENDS
"llvm-cpu"
DRIVERS
"local-task"
LABELS
"hostonly"
"local"
TARGET_CPU_FEATURES_VARIANTS
"default"
)

iree_generated_e2e_runner_test(
NAME
e2e_attention_cpu_f16_f16_f16_medium
TEST_TYPE
attention
GENERATOR
"generate_e2e_attention_tests.py"
GENERATOR_ARGS
"--query_type=f16"
"--key_type=f16"
"--value_type=f16"
"--shapes=medium"
TEST_RUNNER
iree_tools_testing_e2e_iree-e2e-attention-test
TARGET_BACKENDS
"llvm-cpu"
DRIVERS
"local-task"
LABELS
"hostonly"
"local"
TARGET_CPU_FEATURES_VARIANTS
"default"
)

iree_generated_e2e_runner_test(
NAME
e2e_attention_cpu_f16_f16_f16_large
TEST_TYPE
attention
GENERATOR
"generate_e2e_attention_tests.py"
GENERATOR_ARGS
"--query_type=f16"
"--key_type=f16"
"--value_type=f16"
"--shapes=large"
TEST_RUNNER
iree_tools_testing_e2e_iree-e2e-attention-test
TARGET_BACKENDS
"llvm-cpu"
DRIVERS
"local-task"
LABELS
"hostonly"
"local"
TARGET_CPU_FEATURES_VARIANTS
"default"
)

### BAZEL_TO_CMAKE_PRESERVES_ALL_CONTENT_BELOW_THIS_LINE ###
Loading
Loading