[CPU] Add few tests to smoke scope (#16963)

This commit is contained in:
Egor Duplenskii 2023-04-17 07:04:57 +02:00 committed by GitHub
parent c96a5c4b70
commit 175db3523a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 20 deletions

View File

@ -23,7 +23,6 @@ protected:
configuration.insert(additional_config.begin(), additional_config.end());
std::vector<size_t> inputShape {2, 4, 4, 1};
std::vector<size_t> outputShape = inputShape;
auto eltwiseType = ngraph::helpers::EltwiseTypes::ADD;
auto secondaryInputType = ngraph::helpers::InputLayerType::CONSTANT;
@ -45,16 +44,16 @@ protected:
\ /
X No Reorder X
\ /
Eltwise[FP32->BF16]
Eltwise[FP32->BF16] (or Subgraph[FP32->BF16])
|
|
Output[BF16]
*/
TEST_F(InputNoReorderEltwiseBF16, CompareWithRefs) {
TEST_F(InputNoReorderEltwiseBF16, smoke_CompareWithRefs) {
Run();
CheckNumberOfNodesWithType(executableNetwork, "Reorder", 0);
CheckNumberOfNodesWithType(executableNetwork, "Convert", 0);
CheckNumberOfNodesWithType(executableNetwork, "Eltwise", 1);
CheckNumberOfNodesWithTypes(executableNetwork, {"Eltwise", "Subgraph"}, 1);
}
} // namespace CPULayerTestsDefinitions

View File

@ -16,7 +16,7 @@ namespace SubgraphTestsDefinitions {
class SubgraphSnippetSerializationTest : public ::testing::Test, public CPUTestsBase {};
TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraph) {
TEST_F(SubgraphSnippetSerializationTest, smoke_SerializeSubgraph) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
auto model = ([] () -> std::shared_ptr<ov::Model> {
@ -64,7 +64,7 @@ TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraph) {
ASSERT_TRUE(results.valid) << results.message;
}
TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraphWithScalarConst) {
TEST_F(SubgraphSnippetSerializationTest, smoke_SerializeSubgraphWithScalarConst) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
auto model = ([] () -> std::shared_ptr<ov::Model> {
auto shape = ov::Shape({1});
@ -109,7 +109,7 @@ TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraphWithScalarConst) {
ASSERT_TRUE(results.valid) << results.message;
}
TEST_F(SubgraphSnippetSerializationTest, SerializeSubgraphWithResultAs1stOutput) {
TEST_F(SubgraphSnippetSerializationTest, smoke_SerializeSubgraphWithResultAs1stOutput) {
SKIP_IF_CURRENT_TEST_IS_DISABLED()
auto precision = ov::element::f32;
auto shape = ov::Shape{1, 3, 16, 16};

View File

@ -288,6 +288,21 @@ std::string CPUTestsBase::getISA(bool skip_amx) const {
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::makeCPUInfo(const std::vector<cpu_memory_format_t>& inFmts,
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,
std::string nodeType,
const std::unordered_set<std::string>& nodeTypes,
size_t expectedCount) {
ASSERT_NE(nullptr, function);
size_t actualNodeCount = 0;
@ -369,27 +384,39 @@ inline void CheckNumberOfNodesWithTypeImpl(std::shared_ptr<const ov::Model> func
IE_ASSERT(rtInfo.end() != it);
return it->second.as<std::string>();
};
if (getExecValue(ExecGraphInfoSerialization::LAYER_TYPE) == nodeType) {
if (nodeTypes.count(getExecValue(ExecGraphInfoSerialization::LAYER_TYPE))) {
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();
CheckNumberOfNodesWithTypeImpl(function, nodeType, expectedCount);
}
void CheckNumberOfNodesWithType(InferenceEngine::ExecutableNetwork &execNet, std::string nodeType, size_t expectedCount) {
void CheckNumberOfNodesWithTypes(InferenceEngine::ExecutableNetwork &execNet, const std::unordered_set<std::string>& nodeTypes, size_t expectedCount) {
if (!execNet) return;
InferenceEngine::CNNNetwork execGraphInfo = execNet.GetExecGraphInfo();
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) {

View File

@ -177,6 +177,8 @@ const std::map<std::string, std::string> cpuBF16PluginConfig =
// utility functions
std::vector<CPUSpecificParams> filterCPUSpecificParams(std::vector<CPUSpecificParams>& paramsVector);
std::vector<CPUSpecificParams> filterCPUInfoForDevice(std::vector<CPUSpecificParams> CPUParams);
void CheckNumberOfNodesWithType(ov::CompiledModel &compiledModel, std::string nodeType, size_t expectedCount);
void CheckNumberOfNodesWithType(InferenceEngine::ExecutableNetwork &execNet, std::string nodeType, size_t expectedCount);
void CheckNumberOfNodesWithType(const ov::CompiledModel &compiledModel, const 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