forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests to check fuse_transpose_matmul
- Loading branch information
1 parent
be9ac81
commit 38bd8cc
Showing
8 changed files
with
133 additions
and
10 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
32 changes: 32 additions & 0 deletions
32
src/common/snippets/tests/include/pass/fuse_transpose_brgemm.hpp
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,32 @@ | ||
// Copyright (C) 2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "lowering_utils.hpp" | ||
#include "snippets_helpers.hpp" | ||
|
||
/* The main purpose is to test that FuseTransposeBrgemm properly fuses 0213 Transposes on both inputs, as well as on output | ||
*/ | ||
|
||
namespace ov { | ||
namespace test { | ||
namespace snippets { | ||
|
||
typedef std::tuple< | ||
std::vector<PartialShape>, // Input shapes | ||
size_t // Transpose position | ||
> fuseTransposeBrgemmParams; | ||
|
||
class FuseTransposeBrgemmTests : public LoweringTests, public testing::WithParamInterface<fuseTransposeBrgemmParams> { | ||
public: | ||
static std::string getTestCaseName(testing::TestParamInfo<fuseTransposeBrgemmParams> obj); | ||
protected: | ||
void SetUp() override; | ||
std::shared_ptr<SnippetsFunctionBase> snippets_function; | ||
}; | ||
|
||
} // namespace snippets | ||
} // namespace test | ||
} // namespace ov |
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
56 changes: 56 additions & 0 deletions
56
src/common/snippets/tests/src/pass/fuse_transpose_brgemm.cpp
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,56 @@ | ||
// Copyright (C) 2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <gtest/gtest.h> | ||
#include "pass/fuse_transpose_brgemm.hpp" | ||
#include "common_test_utils/common_utils.hpp" | ||
#include "subgraph_matmul.hpp" | ||
#include "subgraph_lowered.hpp" | ||
|
||
namespace ov { | ||
namespace test { | ||
namespace snippets { | ||
|
||
std::string FuseTransposeBrgemmTests::getTestCaseName(testing::TestParamInfo<fuseTransposeBrgemmParams> obj) { | ||
std::vector<PartialShape> input_shapes(2); | ||
size_t transpose_position; | ||
std::tie(input_shapes, transpose_position) = obj.param; | ||
std::ostringstream result; | ||
result << "IS[0]=" << CommonTestUtils::partialShape2str({input_shapes[0]}) << "_"; | ||
result << "IS[1]=" << CommonTestUtils::partialShape2str({input_shapes[1]}) << "_"; | ||
result << "Pos=" << transpose_position << "_"; | ||
return result.str(); | ||
} | ||
|
||
void FuseTransposeBrgemmTests::SetUp() { | ||
LoweringTests::SetUp(); | ||
std::vector<PartialShape> input_shapes(2); | ||
size_t transpose_position; | ||
std::tie(input_shapes, transpose_position) = this->GetParam(); | ||
|
||
snippets_function = std::make_shared<Transpose0213MatMulSinhLoweredFunction>(input_shapes, transpose_position); | ||
} | ||
|
||
TEST_P(FuseTransposeBrgemmTests, FuseTransposeMatmul) { | ||
auto subgraph = getLoweredSubgraph(snippets_function->getOriginal(), master_shape); | ||
function = subgraph->get_body(); | ||
function_ref = snippets_function->getLowered(); | ||
} | ||
|
||
namespace FuseTransposeBrgemmTestsInstantiation { | ||
using ov::Shape; | ||
std::vector<fuseTransposeBrgemmParams> test_params{ | ||
{{{1, 49, 2, 23}, {2, 2, 23, 39}}, 0}, | ||
{{{1, 2, 49, 23}, {2, 23, 1, 39}}, 1}, | ||
{{{1, 2, 49, 23}, {2, 2, 23, 39}}, 2}, | ||
}; | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_Snippets_FuseTransposeMatMul, FuseTransposeBrgemmTests, | ||
::testing::ValuesIn(test_params), | ||
FuseTransposeBrgemmTests::getTestCaseName); | ||
|
||
} // namespace FuseTransposeBrgemmTestsInstantiation | ||
} // namespace snippets | ||
} // namespace test | ||
} // namespace ov |
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