[CPU] Fix user setting num_streams=0 (#20469)

This commit is contained in:
Wanglei Shen authored and GitHub committed 2023-10-31 09:23:58 +04:00
1 parent 50b6c5f0d7
commit 78f11965d8
2 files changed
+24 -1

No files matched your search

+3 -1
View File
@@ -325,7 +325,9 @@ void Engine::GetPerformanceStreams(Config& config, const std::shared_ptr<ngraph:
streams = config.streamExecutorConfig._streams == 1 ? 0 : config.streamExecutorConfig._streams;
}
get_num_streams(streams, ngraphFunc, config);
if (!((0 == config.streamExecutorConfig._streams) && config.streamExecutorConfig._streams_changed)) {
get_num_streams(streams, ngraphFunc, config);
}
config._config[CONFIG_KEY(CPU_THROUGHPUT_STREAMS)] = std::to_string(config.streamExecutorConfig._streams);
}
@@ -137,6 +137,27 @@ TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkCheckModelStreamsHasHigherPrior
ASSERT_EQ(streams, value);
}
TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkCheckModelZeroStreams) {
ov::Core ie;
int32_t streams = 0;
int32_t value = -1;
ASSERT_NO_THROW(ie.set_property(deviceName, ov::hint::performance_mode(ov::hint::PerformanceMode::LATENCY)));
ov::AnyMap config;
config[ov::num_streams.name()] = streams;
ov::CompiledModel compiledModel = ie.compile_model(model, deviceName, config);
ASSERT_NO_THROW(value = compiledModel.get_property(ov::num_streams));
#if defined(OPENVINO_ARCH_ARM) || \
defined(OPENVINO_ARCH_ARM64) // Will be removed after multiple streams is supported on ARM
streams = 1;
#endif
ASSERT_EQ(streams, value);
}
TEST_F(OVClassConfigTestCPU, smoke_CpuExecNetworkCheckSparseWeigthsDecompressionRate) {
ov::Core core;