forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
26c609a
commit f8b6e3c
Showing
7 changed files
with
751 additions
and
1,238 deletions.
There are no files selected for viewing
621 changes: 0 additions & 621 deletions
621
src/plugins/intel_cpu/tests/functional/custom/subgraph_tests/src/rotary_pos_emb.cpp
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...ugins/intel_cpu/tests/functional/shared_tests_instances/subgraph_tests/rotary_pos_emb.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,32 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "subgraph_tests/rotary_pos_emb.hpp" | ||
|
||
namespace ov { | ||
namespace test { | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_RoPETestLlama2, | ||
RoPETestLlama2, | ||
::testing::Values(ov::test::utils::DEVICE_CPU), | ||
RoPETestLlama2::getTestCaseName); | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_RoPETestChatGLM, | ||
RoPETestChatGLM, | ||
::testing::Values(ov::test::utils::DEVICE_CPU), | ||
RoPETestChatGLM::getTestCaseName); | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_RoPETestQwen7b, | ||
RoPETestQwen7b, | ||
::testing::Combine(::testing::Values(true, false), | ||
::testing::Values(ov::test::utils::DEVICE_CPU)), | ||
RoPETestQwen7b::getTestCaseName); | ||
|
||
INSTANTIATE_TEST_SUITE_P(smoke_RoPETestGPTJ, | ||
RoPETestGPTJ, | ||
::testing::Combine(::testing::Values(true, false), | ||
::testing::Values(ov::test::utils::DEVICE_CPU)), | ||
RoPETestGPTJ::getTestCaseName); | ||
} // 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
624 changes: 10 additions & 614 deletions
624
...ugins/intel_gpu/tests/functional/shared_tests_instances/subgraph_tests/rotary_pos_emb.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
52 changes: 52 additions & 0 deletions
52
src/tests/functional/plugin/shared/include/subgraph_tests/rotary_pos_emb.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,52 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "shared_test_classes/subgraph/rotary_pos_emb.hpp" | ||
|
||
namespace ov { | ||
namespace test { | ||
|
||
inline void CheckNumberOfNodesWithType(std::shared_ptr<const ov::Model> function, | ||
const std::unordered_set<std::string>& nodeTypes, | ||
size_t expectedCount) { | ||
ASSERT_NE(nullptr, function); | ||
int num_ops = 0; | ||
for (const auto& node : function->get_ordered_ops()) { | ||
const auto& rt_info = node->get_rt_info(); | ||
const auto layer_type = rt_info.find("layerType")->second.as<std::string>(); | ||
if (nodeTypes.count(layer_type)) { | ||
num_ops++; | ||
} | ||
} | ||
ASSERT_EQ(num_ops, expectedCount); | ||
} | ||
|
||
TEST_P(RoPETestLlama2, CompareWithRefs) { | ||
run(); | ||
auto function = compiledModel.get_runtime_model(); | ||
CheckNumberOfNodesWithType(function, {"RoPE"}, 1); | ||
}; | ||
|
||
TEST_P(RoPETestChatGLM, CompareWithRefs) { | ||
run(); | ||
auto function = compiledModel.get_runtime_model(); | ||
CheckNumberOfNodesWithType(function, {"RoPE"}, 1); | ||
}; | ||
|
||
TEST_P(RoPETestQwen7b, CompareWithRefs) { | ||
run(); | ||
auto function = compiledModel.get_runtime_model(); | ||
CheckNumberOfNodesWithType(function, {"RoPE"}, 1); | ||
}; | ||
|
||
TEST_P(RoPETestGPTJ, CompareWithRefs) { | ||
run(); | ||
auto function = compiledModel.get_runtime_model(); | ||
CheckNumberOfNodesWithType(function, {"RoPE"}, 1); | ||
}; | ||
|
||
} // namespace test | ||
} // namespace ov |
67 changes: 67 additions & 0 deletions
67
...ts/functional/shared_test_classes/include/shared_test_classes/subgraph/rotary_pos_emb.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,67 @@ | ||
// Copyright (C) 2018-2024 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include "shared_test_classes/base/ov_subgraph.hpp" | ||
|
||
namespace ov { | ||
namespace test { | ||
|
||
class RoPETestLlama2 : public SubgraphBaseTest, public testing::WithParamInterface<std::string> { | ||
private: | ||
ov::OutputVector makeCosSinCache(int max_position_embeddings, int rotary_ndims); | ||
std::shared_ptr<ov::Model> buildROPE_Llama2(int batch, | ||
int seq_length, | ||
int max_position_embeddings, | ||
int num_head, | ||
int ndims); | ||
ov::Tensor create_i32_tensor(const ov::Shape& shape, int start, int step = 1); | ||
protected: | ||
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override; | ||
void SetUp() override; | ||
|
||
public: | ||
static std::string getTestCaseName(const testing::TestParamInfo<std::string>& obj); | ||
}; | ||
|
||
class RoPETestChatGLM : public SubgraphBaseTest, public testing::WithParamInterface<std::string> { | ||
private: | ||
std::shared_ptr<ov::Model> buildROPE_ChatGLM(int batch, int head_cnt, int rotary_dims); | ||
ov::Tensor create_i32_tensor(const ov::Shape& shape, int start, int step = 1); | ||
protected: | ||
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override; | ||
void SetUp() override; | ||
|
||
public: | ||
static std::string getTestCaseName(const testing::TestParamInfo<std::string>& obj); | ||
}; | ||
|
||
class RoPETestQwen7b : public SubgraphBaseTest, public testing::WithParamInterface<std::tuple<bool, std::string>> { | ||
private: | ||
std::shared_ptr<ov::Model> buildROPE_QWen7b(bool specialReshape); | ||
protected: | ||
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override; | ||
void SetUp() override; | ||
|
||
public: | ||
static std::string getTestCaseName(const testing::TestParamInfo<std::tuple<bool, std::string>>& obj); | ||
}; | ||
|
||
class RoPETestGPTJ : public SubgraphBaseTest, public testing::WithParamInterface<std::tuple<bool, std::string>> { | ||
private: | ||
std::shared_ptr<ov::Model> buildROPE_GPTJ(int num_head, | ||
int hidden_dims, | ||
int rotary_dims, | ||
bool hasShapeOf); | ||
protected: | ||
void generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) override; | ||
void SetUp() override; | ||
|
||
public: | ||
static std::string getTestCaseName(const testing::TestParamInfo<std::tuple<bool, std::string>>& obj); | ||
}; | ||
|
||
} // namespace test | ||
} // namespace ov |
Oops, something went wrong.