diff --git a/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/behavior/ov_plugin/properties.cpp b/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/behavior/ov_plugin/properties.cpp index 268f14e567c..e2ca8e79eda 100644 --- a/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/behavior/ov_plugin/properties.cpp +++ b/src/tests/functional/plugin/conformance/test_runner/api_conformance_runner/src/behavior/ov_plugin/properties.cpp @@ -83,6 +83,12 @@ INSTANTIATE_TEST_SUITE_P(ov_plugin_mandatory, OVCheckChangePropComplieModleGetPr ::testing::Values(ov::AnyMap({}))), OVCheckChangePropComplieModleGetPropTests_DEVICE_ID::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(ov_plugin_mandatory, OVCheckChangePropComplieModleGetPropTests_InferencePrecision, + ::testing::Combine( + ::testing::ValuesIn(return_all_possible_device_combination()), + ::testing::Values(ov::AnyMap({}))), + OVCheckChangePropComplieModleGetPropTests_InferencePrecision::getTestCaseName); + INSTANTIATE_TEST_SUITE_P(ov_plugin, OVCheckMetricsPropsTests_ModelDependceProps, ::testing::Combine( ::testing::ValuesIn(return_all_possible_device_combination()), diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/properties_tests.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/properties_tests.hpp index 45f9125abe6..edfcc5920b0 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_plugin/properties_tests.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_plugin/properties_tests.hpp @@ -80,6 +80,7 @@ public: using OVCheckSetSupportedRWMetricsPropsTests = OVPropertiesTestsWithCompileModelProps; using OVCheckGetSupportedROMetricsPropsTests = OVPropertiesTestsWithCompileModelProps; using OVCheckChangePropComplieModleGetPropTests_DEVICE_ID = OVPropertiesTestsWithCompileModelProps; +using OVCheckChangePropComplieModleGetPropTests_InferencePrecision = OVPropertiesTestsWithCompileModelProps; using OVCheckMetricsPropsTests_ModelDependceProps = OVPropertiesTestsWithCompileModelProps; class OVClassSetDefaultDeviceIDPropTest : public OVPluginTestBase, diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp index 349016b3fd0..ac66fea4559 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_plugin/properties_tests.cpp @@ -240,18 +240,6 @@ std::vector OVPropertiesTestsWithCompileModelProps::configurePropert std::vector OVPropertiesTestsWithCompileModelProps::getRWMandatoryPropertiesValues(std::vector props) { std::vector res; - if (props.empty() || std::find(props.begin(), props.end(), ov::hint::inference_precision.name()) != props.end()) { - const std::vector ovElemTypes = { - ov::element::f64, ov::element::f32, ov::element::f16, ov::element::bf16, - ov::element::i64, ov::element::i32, ov::element::i16, ov::element::i8, ov::element::i4, - ov::element::u64, ov::element::u32, ov::element::u16, ov::element::u8, ov::element::u4, ov::element::u1, - ov::element::boolean, ov::element::undefined, ov::element::dynamic - }; - for (auto &precision : ovElemTypes) { - res.push_back({{ov::hint::inference_precision(precision)}}); - } - } - if (props.empty() || std::find(props.begin(), props.end(), ov::hint::performance_mode.name()) != props.end()) { ov::hint::PerformanceMode performance_modes[] = {ov::hint::PerformanceMode::LATENCY, ov::hint::PerformanceMode::THROUGHPUT, ov::hint::PerformanceMode::CUMULATIVE_THROUGHPUT}; @@ -401,6 +389,48 @@ TEST_P(OVCheckChangePropComplieModleGetPropTests_DEVICE_ID, ChangeCorrectDeviceP } } +TEST_P(OVCheckChangePropComplieModleGetPropTests_InferencePrecision, ChangeCorrectProperties) { + std::vector supported_properties; + OV_ASSERT_NO_THROW(supported_properties = core->get_property(target_device, ov::supported_properties)); + auto supported = util::contains(supported_properties, ov::hint::inference_precision); + ASSERT_TRUE(supported) << "property is not supported: " << ov::hint::inference_precision; + + ov::Any default_property; + OV_ASSERT_NO_THROW(default_property = core->get_property(target_device, ov::hint::inference_precision)); + ASSERT_FALSE(default_property.empty()); + + const std::vector ovElemTypes = { + ov::element::f64, ov::element::f32, ov::element::f16, ov::element::bf16, + ov::element::i64, ov::element::i32, ov::element::i16, ov::element::i8, ov::element::i4, + ov::element::u64, ov::element::u32, ov::element::u16, ov::element::u8, ov::element::u4, ov::element::u1, + ov::element::boolean, ov::element::undefined, ov::element::dynamic + }; + + bool any_supported = false; + for (ov::element::Type type : ovElemTypes) { + try { + core->set_property(target_device, ov::hint::inference_precision(type)); + core->compile_model(model, target_device, compileModelProperties); + } catch (const Exception& ex) { + std::string err_msg(ex.what()); + ASSERT_TRUE(err_msg.find("Unsupported precision") != std::string::npos) << + "Fail to set and compile_model with precision: " << type << std::endl; + continue; + } + + ov::Any actual_property_value; + OV_ASSERT_NO_THROW(actual_property_value = core->get_property(target_device, ov::hint::inference_precision)); + ASSERT_FALSE(actual_property_value.empty()); + + ov::element::Type actual_value = actual_property_value.as(); + ASSERT_EQ(actual_value, type) << "Peoperty is changed in wrong way"; + + std::cout << "Supported precision: " << type << std::endl; + any_supported = true; + } + ASSERT_TRUE(any_supported) << "No one supported precision is found"; +} + std::vector OVPropertiesTestsWithCompileModelProps::getModelDependcePropertiesValues() { std::vector res; // Read Only