Skip to content

Commit 119ef51

Browse files
test fixes
1 parent 884234c commit 119ef51

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

src/plugins/intel_cpu/src/config.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ Config Config::clone(int sub_stream_idx, bool enable_node_split) const {
117117
return new_config;
118118
}
119119

120+
void Config::set_properties(const ov::AnyMap& config, OptionVisibility allowed_visibility) {
121+
const auto& it = config.find(ov::num_streams.name());
122+
if (it != config.end()) {
123+
auto num_streams = it->second.as<std::string>();
124+
auto new_config = config;
125+
new_config.at(ov::num_streams.name()) = num_streams;
126+
PluginConfig::set_user_property(new_config, allowed_visibility);
127+
128+
return;
129+
}
130+
131+
PluginConfig::set_user_property(config, allowed_visibility);
132+
}
133+
120134
void Config::apply_rt_info(const IRemoteContext* context, const ov::RTMap& rt_info) {
121135
apply_rt_info_property(ov::hint::kv_cache_precision, rt_info);
122136
apply_rt_info_property(ov::hint::dynamic_quantization_group_size, rt_info);

src/plugins/intel_cpu/src/config.h

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ struct Config : public ov::PluginConfig {
2525
Config(const Config& other);
2626
Config& operator=(const Config& other);
2727

28+
void set_properties(const ov::AnyMap& config, OptionVisibility allowed_visibility = OptionVisibility::ANY);
29+
2830
private:
2931
void finalize_impl(const IRemoteContext* context, const ov::Model* model) override;
3032
void apply_model_specific_options(const IRemoteContext* context, const ov::Model& model) override;

src/plugins/intel_cpu/src/plugin.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
176176
DEBUG_LOG(PrintableModel(*cloned_model, "org_"));
177177

178178
Config config = m_plugin_config;
179-
config.set_user_property(properties, OptionVisibility::RELEASE);
179+
config.set_properties(properties, OptionVisibility::RELEASE);
180180

181181
Transformations transformations(cloned_model, config);
182182

@@ -219,7 +219,7 @@ std::shared_ptr<ov::ICompiledModel> Plugin::compile_model(const std::shared_ptr<
219219
}
220220

221221
void Plugin::set_property(const ov::AnyMap& config) {
222-
m_plugin_config.set_user_property(config, OptionVisibility::RELEASE);
222+
m_plugin_config.set_properties(config, OptionVisibility::RELEASE);
223223
}
224224

225225
ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& options) const {
@@ -364,7 +364,9 @@ ov::Any Plugin::get_property(const std::string& name, const ov::AnyMap& options)
364364
return res;
365365
}
366366

367-
return m_plugin_config.get_property(name, OptionVisibility::RELEASE);
367+
auto config = m_plugin_config;
368+
config.finalize(get_default_context().get(), nullptr);
369+
return config.get_property(name, OptionVisibility::RELEASE);
368370
}
369371

370372
ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr<const ov::Model>& model, const ov::AnyMap& properties) const {
@@ -375,7 +377,7 @@ ov::SupportedOpsMap Plugin::query_model(const std::shared_ptr<const ov::Model>&
375377
}
376378

377379
Config config = m_plugin_config;
378-
config.set_user_property(properties, OptionVisibility::RELEASE);
380+
config.set_properties(properties, OptionVisibility::RELEASE);
379381
config.finalize(get_default_context().get(), model.get());
380382
auto context = std::make_shared<GraphContext>(config, fake_w_cache, false, false);
381383

@@ -445,10 +447,8 @@ std::shared_ptr<ov::ICompiledModel> Plugin::import_model(std::istream& model_str
445447
deserializer >> model;
446448

447449
Config config = m_plugin_config;
448-
config.set_user_property(properties, OptionVisibility::RELEASE);
450+
config.set_properties(_properties, OptionVisibility::RELEASE);
449451

450-
// import config props from caching model
451-
// calculate_streams(config, model, true);
452452
config.finalize(get_default_context().get(), model.get());
453453

454454
auto compiled_model = std::make_shared<CompiledModel>(model, shared_from_this(), config, loaded_from_cache);

src/plugins/intel_cpu/tests/functional/custom/behavior/ov_plugin/properties.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,7 @@ TEST_F(OVClassConfigTestCPU, smoke_PluginSetConfigLogLevel) {
285285

286286
// check throwing message
287287
auto property = ov::PropertyName(ov::log::level.name(), ov::PropertyMutability::RW);
288-
const std::string expect_message = std::string("Wrong value DUMMY VALUE for property key ") +
289-
ov::log::level.name() + ". Expected only ov::log::Level::NO/ERR/WARNING/INFO/DEBUG/TRACE.";
290-
OV_EXPECT_THROW(ie.set_property("CPU", {{property, "DUMMY VALUE"}}),
291-
ov::Exception,
292-
testing::HasSubstr(expect_message));
288+
EXPECT_THROW(ie.set_property("CPU", {{property, "DUMMY VALUE"}}), ov::Exception);
293289
}
294290

295291
TEST_F(OVClassConfigTestCPU, smoke_PluginCheckCPUExecutionDevice) {

0 commit comments

Comments
 (0)