Skip to content

Commit

Permalink
gtests: graph: update pass name in ut
Browse files Browse the repository at this point in the history
  • Loading branch information
ElaineBao authored and TaoLv committed Jan 17, 2025
1 parent d426ab0 commit 526bc87
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
18 changes: 13 additions & 5 deletions tests/gtests/graph/unit/backend/dnnl/test_large_partition.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2020-2024 Intel Corporation
* Copyright 2020-2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -660,7 +660,9 @@ TEST(test_large_partition_execute, F32Mha) {

ASSERT_EQ(g.get_ops().size(), 7U);

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass(
eng->kind() == graph::engine_kind::cpu ? "float_sdp_fusion_cpu"
: "float_sdp_fusion_gpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -717,7 +719,9 @@ TEST(test_large_partition_execute, F32DistilBertMha) {

ASSERT_EQ(g.get_ops().size(), 7U);

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass(
eng->kind() == graph::engine_kind::cpu ? "float_sdp_fusion_cpu"
: "float_sdp_fusion_gpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -989,7 +993,9 @@ TEST(test_large_partition_execute, Bf16Mha_CPU) {

ASSERT_EQ(g.get_ops().size(), 7U);

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass(
eng->kind() == graph::engine_kind::cpu ? "float_sdp_fusion_cpu"
: "float_sdp_fusion_gpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -1134,7 +1140,9 @@ TEST(test_large_partition_execute, Bf16DistilBertMha) {

ASSERT_EQ(g.get_ops().size(), 7U);

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass(
eng->kind() == graph::engine_kind::cpu ? "float_sdp_fusion_cpu"
: "float_sdp_fusion_gpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down
4 changes: 3 additions & 1 deletion tests/gtests/graph/unit/backend/dnnl/test_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12929,7 +12929,9 @@ TEST(test_pass, F32MhaFusion) {
agraph.finalize();
ASSERT_EQ(agraph.get_ops().size(), 7U);

dnnl::impl::graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass(
engine_kind == graph::engine_kind::cpu ? "float_sdp_fusion_cpu"
: "float_sdp_fusion_gpu");
apass->run(agraph);
ASSERT_EQ(agraph.get_num_partitions(), 1U);
}
Expand Down
14 changes: 7 additions & 7 deletions tests/gtests/graph/unit/backend/dnnl/test_sdp_decomp.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright 2024 Intel Corporation
* Copyright 2024-2025 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -76,7 +76,7 @@ TEST(test_sdp_decomp_execute, F32SdpDecomp_CPU) {
else
ASSERT_EQ(g.get_ops().size(), 6U);

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion_cpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -179,7 +179,7 @@ TEST(test_sdp_decomp_execute, Bf16SdpDecomp_CPU) {
else
ASSERT_EQ(g.get_ops().size(), 6U);

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion_cpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -570,7 +570,7 @@ TEST(test_sdp_decomp_execute, F32SdpCorr_CPU) {
attention_mask_vec[j]);
g.finalize();

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion_cpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -688,7 +688,7 @@ TEST(test_sdp_decomp_execute, F32DistilBertSdpCorr_CPU) {
batch_size, seq_len, num_head, head_dim, transpose_b[i]);
g.finalize();

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion_cpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -811,7 +811,7 @@ TEST(test_sdp_decomp_execute, Bf16SdpCorr_CPU) {
attention_mask_vec[j]);
g.finalize();

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion_cpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down Expand Up @@ -934,7 +934,7 @@ TEST(test_sdp_decomp_execute, Bf16DistilBertSdpCorr_CPU) {
batch_size, seq_len, num_head, head_dim, transpose_b[i]);
g.finalize();

graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion");
graph::pass::pass_base_ptr apass = get_pass("float_sdp_fusion_cpu");
apass->run(g);
ASSERT_EQ(g.get_num_partitions(), 1U);
auto part = g.get_partitions()[0];
Expand Down

0 comments on commit 526bc87

Please sign in to comment.