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

This commit is contained in:
Wanglei Shen 2023-10-31 13:23:58 +08:00 committed by Alexander Nesterov
parent 29416d003e
commit b3f6db7da4
2 changed files with 24 additions and 1 deletions

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);
}

View File

@ -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;