[CPU] Add few tests to smoke scope (#16963)
This commit is contained in:
parent
c96a5c4b70
commit
175db3523a
@ -23,7 +23,6 @@ protected:
|
|||||||
configuration.insert(additional_config.begin(), additional_config.end());
|
configuration.insert(additional_config.begin(), additional_config.end());
|
||||||
|
|
||||||
std::vector<size_t> inputShape {2, 4, 4, 1};
|
std::vector<size_t> inputShape {2, 4, 4, 1};
|
||||||
std::vector<size_t> outputShape = inputShape;
|
|
||||||
auto eltwiseType = ngraph::helpers::EltwiseTypes::ADD;
|
auto eltwiseType = ngraph::helpers::EltwiseTypes::ADD;
|
||||||
auto secondaryInputType = ngraph::helpers::InputLayerType::CONSTANT;
|
auto secondaryInputType = ngraph::helpers::InputLayerType::CONSTANT;
|
||||||
|
|
||||||
@ -45,16 +44,16 @@ protected:
|
|||||||
\ /
|
\ /
|
||||||
X No Reorder X
|
X No Reorder X
|
||||||
\ /
|
\ /
|
||||||
Eltwise[FP32->BF16]
|
Eltwise[FP32->BF16] (or Subgraph[FP32->BF16])
|
||||||
|
|
|
|
||||||
|
|
|
|
||||||
Output[BF16]
|
Output[BF16]
|
||||||
*/
|
*/
|
||||||
TEST_F(InputNoReorderEltwiseBF16, CompareWithRefs) {
|
TEST_F(InputNoReorderEltwiseBF16, smoke_CompareWithRefs) {
|
||||||
Run();
|
Run();
|
||||||
|
|
||||||
CheckNumberOfNodesWithType(executableNetwork, "Reorder", 0);
|
CheckNumberOfNodesWithType(executableNetwork, "Reorder", 0);
|
||||||
CheckNumberOfNodesWithType(executableNetwork, "Convert", 0);
|
CheckNumberOfNodesWithType(executableNetwork, "Convert", 0);
|
||||||
CheckNumberOfNodesWithType(executableNetwork, "Eltwise", 1);
|
CheckNumberOfNodesWithTypes(executableNetwork, {"Eltwise", "Subgraph"}, 1);
|
||||||
}
|
}
|
||||||
} // namespace CPULayerTestsDefinitions
|
} // namespace CPULayerTestsDefinitions
|
||||||
|
@ -16,7 +16,7 @@ namespace SubgraphTestsDefinitions {
|
|||||||
|
|
||||||
class SubgraphSnippetSerializationTest : public ::testing::Test, public CPUTestsBase {};
|
class SubgraphSnippetSerializationTest : public ::testing::Test, public CPUTestsBase {};
|
||||||
|
|
||||||
TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraph) {
|
TEST_F(SubgraphSnippetSerializationTest, smoke_SerializeSubgraph) {
|
||||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||||
|
|
||||||
auto model = ([] () -> std::shared_ptr<ov::Model> {
|
auto model = ([] () -> std::shared_ptr<ov::Model> {
|
||||||
@ -64,7 +64,7 @@ TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraph) {
|
|||||||
ASSERT_TRUE(results.valid) << results.message;
|
ASSERT_TRUE(results.valid) << results.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraphWithScalarConst) {
|
TEST_F(SubgraphSnippetSerializationTest, smoke_SerializeSubgraphWithScalarConst) {
|
||||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||||
auto model = ([] () -> std::shared_ptr<ov::Model> {
|
auto model = ([] () -> std::shared_ptr<ov::Model> {
|
||||||
auto shape = ov::Shape({1});
|
auto shape = ov::Shape({1});
|
||||||
@ -109,7 +109,7 @@ TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraphWithScalarConst) {
|
|||||||
ASSERT_TRUE(results.valid) << results.message;
|
ASSERT_TRUE(results.valid) << results.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraphWithResultAs1stOutput) {
|
TEST_F(SubgraphSnippetSerializationTest, smoke_SerializeSubgraphWithResultAs1stOutput) {
|
||||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||||
auto precision = ov::element::f32;
|
auto precision = ov::element::f32;
|
||||||
auto shape = ov::Shape{1, 3, 16, 16};
|
auto shape = ov::Shape{1, 3, 16, 16};
|
||||||
|
@ -288,6 +288,21 @@ std::string CPUTestsBase::getISA(bool skip_amx) const {
|
|||||||
return isaType;
|
return isaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::string setToString(const std::unordered_set<std::string> s) {
|
||||||
|
if (s.empty())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
std::string result;
|
||||||
|
result.append("{");
|
||||||
|
for (const auto& str : s) {
|
||||||
|
result.append(str);
|
||||||
|
result.append(",");
|
||||||
|
}
|
||||||
|
result.append("}");
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
CPUTestsBase::CPUInfo
|
CPUTestsBase::CPUInfo
|
||||||
CPUTestsBase::makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts,
|
CPUTestsBase::makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts,
|
||||||
const std::vector<cpu_memory_format_t>& outFmts,
|
const std::vector<cpu_memory_format_t>& outFmts,
|
||||||
@ -358,7 +373,7 @@ std::vector<CPUSpecificParams> filterCPUSpecificParams(std::vector<CPUSpecificPa
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline void CheckNumberOfNodesWithTypeImpl(std::shared_ptr<const ov::Model> function,
|
inline void CheckNumberOfNodesWithTypeImpl(std::shared_ptr<const ov::Model> function,
|
||||||
std::string nodeType,
|
const std::unordered_set<std::string>& nodeTypes,
|
||||||
size_t expectedCount) {
|
size_t expectedCount) {
|
||||||
ASSERT_NE(nullptr, function);
|
ASSERT_NE(nullptr, function);
|
||||||
size_t actualNodeCount = 0;
|
size_t actualNodeCount = 0;
|
||||||
@ -369,27 +384,39 @@ inline void CheckNumberOfNodesWithTypeImpl(std::shared_ptr<const ov::Model> func
|
|||||||
IE_ASSERT(rtInfo.end() != it);
|
IE_ASSERT(rtInfo.end() != it);
|
||||||
return it->second.as<std::string>();
|
return it->second.as<std::string>();
|
||||||
};
|
};
|
||||||
if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == nodeType) {
|
|
||||||
|
if (nodeTypes.count(getExecValue(ExecGraphInfoSerialization::LAYER_TYPE))) {
|
||||||
actualNodeCount++;
|
actualNodeCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_EQ(expectedCount, actualNodeCount) << "Unexpected count of the node type '" << nodeType << "' ";
|
ASSERT_EQ(expectedCount, actualNodeCount) << "Unexpected count of the node types '" << setToString(nodeTypes) << "' ";
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckNumberOfNodesWithType(ov::CompiledModel &compiledModel, std::string nodeType, size_t expectedCount) {
|
|
||||||
if (!compiledModel) return;
|
|
||||||
|
|
||||||
std::shared_ptr<const ov::Model> function = compiledModel.get_runtime_model();
|
void CheckNumberOfNodesWithTypes(InferenceEngine::ExecutableNetwork &execNet, const std::unordered_set<std::string>& nodeTypes, size_t expectedCount) {
|
||||||
CheckNumberOfNodesWithTypeImpl(function, nodeType, expectedCount);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CheckNumberOfNodesWithType(InferenceEngine::ExecutableNetwork &execNet, std::string nodeType, size_t expectedCount) {
|
|
||||||
if (!execNet) return;
|
if (!execNet) return;
|
||||||
|
|
||||||
InferenceEngine::CNNNetwork execGraphInfo = execNet.GetExecGraphInfo();
|
InferenceEngine::CNNNetwork execGraphInfo = execNet.GetExecGraphInfo();
|
||||||
std::shared_ptr<const ov::Model> function = execGraphInfo.getFunction();
|
std::shared_ptr<const ov::Model> function = execGraphInfo.getFunction();
|
||||||
CheckNumberOfNodesWithTypeImpl(function, nodeType, expectedCount);
|
|
||||||
|
CheckNumberOfNodesWithTypeImpl(function, nodeTypes, expectedCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckNumberOfNodesWithTypes(const ov::CompiledModel &compiledModel, const std::unordered_set<std::string>& nodeTypes, size_t expectedCount) {
|
||||||
|
if (!compiledModel) return;
|
||||||
|
|
||||||
|
std::shared_ptr<const ov::Model> function = compiledModel.get_runtime_model();
|
||||||
|
|
||||||
|
CheckNumberOfNodesWithTypeImpl(function, nodeTypes, expectedCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckNumberOfNodesWithType(const ov::CompiledModel &compiledModel, const std::string& nodeType, size_t expectedCount) {
|
||||||
|
CheckNumberOfNodesWithTypes(compiledModel, {nodeType}, expectedCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckNumberOfNodesWithType(InferenceEngine::ExecutableNetwork &execNet, const std::string& nodeType, size_t expectedCount) {
|
||||||
|
CheckNumberOfNodesWithTypes(execNet, {nodeType}, expectedCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CPUSpecificParams> filterCPUInfoForDevice(std::vector<CPUSpecificParams> CPUParams) {
|
std::vector<CPUSpecificParams> filterCPUInfoForDevice(std::vector<CPUSpecificParams> CPUParams) {
|
||||||
|
@ -177,6 +177,8 @@ const std::map<std::string, std::string> cpuBF16PluginConfig =
|
|||||||
// utility functions
|
// utility functions
|
||||||
std::vector<CPUSpecificParams> filterCPUSpecificParams(std::vector<CPUSpecificParams>& paramsVector);
|
std::vector<CPUSpecificParams> filterCPUSpecificParams(std::vector<CPUSpecificParams>& paramsVector);
|
||||||
std::vector<CPUSpecificParams> filterCPUInfoForDevice(std::vector<CPUSpecificParams> CPUParams);
|
std::vector<CPUSpecificParams> filterCPUInfoForDevice(std::vector<CPUSpecificParams> CPUParams);
|
||||||
void CheckNumberOfNodesWithType(ov::CompiledModel &compiledModel, std::string nodeType, size_t expectedCount);
|
void CheckNumberOfNodesWithType(const ov::CompiledModel &compiledModel, const std::string& nodeType, size_t expectedCount);
|
||||||
void CheckNumberOfNodesWithType(InferenceEngine::ExecutableNetwork &execNet, std::string nodeType, size_t expectedCount);
|
void CheckNumberOfNodesWithType(InferenceEngine::ExecutableNetwork &execNet, const std::string& nodeType, size_t expectedCount);
|
||||||
|
void CheckNumberOfNodesWithTypes(const ov::CompiledModel &compiledModel, const std::unordered_set<std::string>& nodeTypes, size_t expectedCount);
|
||||||
|
void CheckNumberOfNodesWithTypes(InferenceEngine::ExecutableNetwork &execNet, const std::unordered_set<std::string>& nodeTypes, size_t expectedCount);
|
||||||
} // namespace CPUTestUtils
|
} // namespace CPUTestUtils
|
||||||
|
Loading…
Reference in New Issue
Block a user