From d09c09d9fd5d91adb65c78f3aec9c33ad1149840 Mon Sep 17 00:00:00 2001 From: Nadezhda Ageeva Date: Tue, 18 Jan 2022 18:26:55 +0300 Subject: [PATCH] [GNA] Deprecate GNA_SW mode (#9738) --- docs/IE_DG/supported_plugins/GNA.md | 2 +- samples/cpp/speech_sample/speech_sample.hpp | 2 - src/inference/include/ie/gna/gna_config.hpp | 52 +++++++++++++++---- .../intel_gna/gna_plugin_query_api.cpp | 12 ++--- .../executable_network/get_metric.cpp | 4 ++ .../behavior/infer_request/config.cpp | 2 + .../ov_executable_network/get_metric.cpp | 4 ++ .../behavior/plugin/configuration_tests.cpp | 10 ++-- src/tests/unit/gna/gna_plugin_config_test.cpp | 2 + .../unit/engines/gna/gna_proc_type_test.cpp | 5 -- .../smoke_tests/test_speech_sample.py | 2 +- 11 files changed, 65 insertions(+), 32 deletions(-) diff --git a/docs/IE_DG/supported_plugins/GNA.md b/docs/IE_DG/supported_plugins/GNA.md index 6dfdba55787..40abf7acd9a 100644 --- a/docs/IE_DG/supported_plugins/GNA.md +++ b/docs/IE_DG/supported_plugins/GNA.md @@ -450,7 +450,7 @@ In future releases, it will be changed to a more meaningful status code. Any application working with GNA must properly react to this code. One of the strategies to adapt an application: -1. Immediately switch to the GNA_SW emulation mode: +1. Immediately switch to the GNA_SW_EXACT emulation mode: @sphinxdirective .. tab:: C++ diff --git a/samples/cpp/speech_sample/speech_sample.hpp b/samples/cpp/speech_sample/speech_sample.hpp index 0b84c6438e4..35aa199d546 100644 --- a/samples/cpp/speech_sample/speech_sample.hpp +++ b/samples/cpp/speech_sample/speech_sample.hpp @@ -265,12 +265,10 @@ bool ParseAndCheckCommandLine(int argc, char* argv[]) { "GNA_HW", "GNA_HW_WITH_SW_FBACK", "GNA_SW_EXACT", - "GNA_SW", "GNA_SW_FP32", "HETERO:GNA,CPU", "HETERO:GNA_HW,CPU", "HETERO:GNA_SW_EXACT,CPU", - "HETERO:GNA_SW,CPU", "HETERO:GNA_SW_FP32,CPU", "MYRIAD"}; diff --git a/src/inference/include/ie/gna/gna_config.hpp b/src/inference/include/ie/gna/gna_config.hpp index 09713b4d7fb..f2a444dcf71 100644 --- a/src/inference/include/ie/gna/gna_config.hpp +++ b/src/inference/include/ie/gna/gna_config.hpp @@ -61,23 +61,57 @@ INFERENCE_ENGINE_DEPRECATED("The config key will be removed") DECLARE_GNA_CONFIG_KEY(FIRMWARE_MODEL_IMAGE_GENERATION); /** - * @brief GNA proc_type setting that should be one of GNA_AUTO, GNA_HW, GNA_HW_WITH_SW_FBACK, GNA_SW, GNA_SW_EXACT + * @brief GNA proc_type setting that should be one of GNA_AUTO, GNA_HW, GNA_HW_WITH_SW_FBACK, GNA_SW_EXACT */ DECLARE_GNA_CONFIG_KEY(DEVICE_MODE); +/** + * @brief Specific software acceleration mode. + * Uses Intel GNA if available, otherwise uses software execution mode on CPU. + */ DECLARE_GNA_CONFIG_VALUE(AUTO); + +/** + * @brief Specific software acceleration mode. + * Uses Intel GNA if available, otherwise raises an error. + */ DECLARE_GNA_CONFIG_VALUE(HW); + +/** + * @brief Specific software acceleration mode. + * Uses Intel GNA if available, otherwise raises an error. + * If the hardware queue is not empty, automatically falls back to CPU in the bit-exact mode. + */ DECLARE_GNA_CONFIG_VALUE(HW_WITH_SW_FBACK); + +/** + * @brief Specific software acceleration mode. + * @deprecated Mode is deprecated and will be removed in a future release. + * Use InferenceEngine::GNAConfigParams::SW_EXACT instead. + */ +INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW_EXACT instead") DECLARE_GNA_CONFIG_VALUE(SW); + +/** + * @brief Specific software acceleration mode. + * Executes the GNA-compiled graph on CPU performing calculations + * in the same precision as the Intel GNA in the bit-exact mode. + */ DECLARE_GNA_CONFIG_VALUE(SW_EXACT); + +/** + * @brief Specific software acceleration mode. + * Executes the GNA-compiled graph on CPU but substitutes parameters and calculations + * from low precision to floating point + */ DECLARE_GNA_CONFIG_VALUE(SW_FP32); /** * @brief Specific software acceleration mode. * @deprecated Mode is deprecated and will be removed in a future release. - * Use InferenceEngine::GNAConfigParams::SW instead. + * Use InferenceEngine::GNAConfigParams::SW_EXACT instead. */ -INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW instead") +INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW_EXACT instead") DECLARE_GNA_CONFIG_VALUE(GEN); /** @@ -91,9 +125,9 @@ DECLARE_GNA_CONFIG_VALUE(GEN_EXACT); /** * @brief Specific software acceleration mode. * @deprecated Mode is deprecated and will be removed in a future release. - * Use InferenceEngine::GNAConfigParams::SW instead. + * Use InferenceEngine::GNAConfigParams::SW_EXACT instead. */ -INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW instead") +INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW_EXACT instead") DECLARE_GNA_CONFIG_VALUE(SSE); /** @@ -107,9 +141,9 @@ DECLARE_GNA_CONFIG_VALUE(SSE_EXACT); /** * @brief Specific software acceleration mode. * @deprecated Mode is deprecated and will be removed in a future release. - * Use InferenceEngine::GNAConfigParams::SW instead. + * Use InferenceEngine::GNAConfigParams::SW_EXACT instead. */ -INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW instead") +INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW_EXACT instead") DECLARE_GNA_CONFIG_VALUE(AVX1); /** @@ -123,9 +157,9 @@ DECLARE_GNA_CONFIG_VALUE(AVX1_EXACT); /** * @brief Specific software acceleration mode. * @deprecated Mode is deprecated and will be removed in a future release. - * Use InferenceEngine::GNAConfigParams::SW instead. + * Use InferenceEngine::GNAConfigParams::SW_EXACT instead. */ -INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW instead") +INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::GNAConfigParams::SW_EXACT instead") DECLARE_GNA_CONFIG_VALUE(AVX2); /** diff --git a/src/plugins/intel_gna/gna_plugin_query_api.cpp b/src/plugins/intel_gna/gna_plugin_query_api.cpp index 964c66cec07..7865cdca449 100644 --- a/src/plugins/intel_gna/gna_plugin_query_api.cpp +++ b/src/plugins/intel_gna/gna_plugin_query_api.cpp @@ -37,7 +37,7 @@ Parameter GNAPlugin::GetMetric(const std::string& name, const std::map devices; - // probing for gna-sw-exact, or gna-sw implementation part of libgna - try { - GNADeviceHelper swHelper; - devices.push_back("GNA_SW"); - }catch(...) {} try { - GNADeviceHelper hwHelper; - if (hwHelper.hasGnaHw()) { + GNADeviceHelper helper; + devices.push_back("GNA_SW_EXACT"); + if (helper.hasGnaHw()) { devices.push_back("GNA_HW"); } }catch(...) {} diff --git a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/executable_network/get_metric.cpp b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/executable_network/get_metric.cpp index 0bd3b596774..e5133fc1766 100644 --- a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/executable_network/get_metric.cpp +++ b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/executable_network/get_metric.cpp @@ -51,6 +51,7 @@ INSTANTIATE_TEST_SUITE_P( DISABLED_smoke_IEClassExecutableNetworkSetConfigTest, IEClassExecutableNetworkSetConfigTest, ::testing::Values("GNA")); +IE_SUPPRESS_DEPRECATED_START // TODO: Convolution with 3D input is not supported on GNA INSTANTIATE_TEST_SUITE_P( DISABLED_smoke_IEClassExecutableNetworkSupportedConfigTest, IEClassExecutableNetworkSupportedConfigTest, @@ -59,6 +60,7 @@ INSTANTIATE_TEST_SUITE_P( std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO)))); +IE_SUPPRESS_DEPRECATED_END // TODO: Convolution with 3D input is not supported on GNA INSTANTIATE_TEST_SUITE_P( @@ -81,6 +83,7 @@ TEST_P(IEClassExecutableNetworkSetConfigFromFp32Test, SetConfigFromFp32Throws) { ASSERT_THROW(exeNetwork.SetConfig({{configKey, configValue}}), InferenceEngine::Exception); } +IE_SUPPRESS_DEPRECATED_START // TODO: Convolution with 3D input is not supported on GNA INSTANTIATE_TEST_SUITE_P( DISABLED_smoke_IEClassExecutableNetworkSetConfigFromFp32Test, IEClassExecutableNetworkSetConfigFromFp32Test, @@ -90,6 +93,7 @@ INSTANTIATE_TEST_SUITE_P( std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_FP32), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO)))); +IE_SUPPRESS_DEPRECATED_END // // Hetero Executable Network GetMetric diff --git a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/infer_request/config.cpp b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/infer_request/config.cpp index 23d18863744..366114fae6e 100644 --- a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/infer_request/config.cpp +++ b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/infer_request/config.cpp @@ -11,6 +11,7 @@ namespace { {} }; +IE_SUPPRESS_DEPRECATED_START const std::vector> Inconfigs = { {{InferenceEngine::GNAConfigParams::KEY_GNA_SCALE_FACTOR, "1.0"}}, {{InferenceEngine::GNAConfigParams::KEY_GNA_PRECISION, "I8"}}, @@ -23,6 +24,7 @@ namespace { {{InferenceEngine::GNAConfigParams::KEY_GNA_DEVICE_MODE, InferenceEngine::GNAConfigParams::GNA_SW_EXACT}}, {{InferenceEngine::GNAConfigParams::KEY_GNA_COMPACT_MODE, InferenceEngine::PluginConfigParams::NO}} }; +IE_SUPPRESS_DEPRECATED_END INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, InferRequestConfigTest, ::testing::Combine( diff --git a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_executable_network/get_metric.cpp b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_executable_network/get_metric.cpp index 57caba79dbf..0d275def7f7 100644 --- a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_executable_network/get_metric.cpp +++ b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/ov_executable_network/get_metric.cpp @@ -52,6 +52,7 @@ INSTANTIATE_TEST_SUITE_P(DISABLED_smoke_OVClassExecutableNetworkSetConfigTest, OVClassExecutableNetworkSetConfigTest, ::testing::Values("GNA")); +IE_SUPPRESS_DEPRECATED_START // TODO: Convolution with 3D input is not supported on GNA INSTANTIATE_TEST_SUITE_P( DISABLED_smoke_OVClassExecutableNetworkSupportedConfigTest, @@ -62,6 +63,7 @@ INSTANTIATE_TEST_SUITE_P( std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO)))); +IE_SUPPRESS_DEPRECATED_END // TODO: Convolution with 3D input is not supported on GNA INSTANTIATE_TEST_SUITE_P( @@ -86,6 +88,7 @@ ov::runtime::CompiledModel exeNetwork = ie.compile_model(simpleNetwork, deviceNa ASSERT_THROW(exeNetwork.set_config({{configKey, configValue}}), ov::Exception); } +IE_SUPPRESS_DEPRECATED_START // TODO: Convolution with 3D input is not supported on GNA INSTANTIATE_TEST_SUITE_P( DISABLED_smoke_OVClassExecutableNetworkSetConfigFromFp32Test, @@ -97,6 +100,7 @@ INSTANTIATE_TEST_SUITE_P( std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_EXACT), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_SW_FP32), std::make_pair(GNA_CONFIG_KEY(DEVICE_MODE), InferenceEngine::GNAConfigParams::GNA_AUTO)))); +IE_SUPPRESS_DEPRECATED_END // // Hetero Executable Network GetMetric diff --git a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/plugin/configuration_tests.cpp b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/plugin/configuration_tests.cpp index f6013d10178..a26cee3e4d0 100644 --- a/src/tests/functional/plugin/gna/shared_tests_instances/behavior/plugin/configuration_tests.cpp +++ b/src/tests/functional/plugin/gna/shared_tests_instances/behavior/plugin/configuration_tests.cpp @@ -28,15 +28,13 @@ namespace { ::testing::ValuesIn(inconfigs)), IncorrectConfigTests::getTestCaseName); - const std::vector> Inconfigs = { - {{"KEY_KEY_GNA_DEVICE_MODE", InferenceEngine::GNAConfigParams::GNA_SW}}, - {{"GNA_DEVICE_MODE_XYZ", InferenceEngine::GNAConfigParams::GNA_SW}}, - {{"KEY_GNA_DEVICE_MODE_XYZ", InferenceEngine::GNAConfigParams::GNA_SW}}, - {{"KEY_GNA_SCALE_FACTOR_1", InferenceEngine::GNAConfigParams::GNA_SW}} + {{"KEY_KEY_GNA_DEVICE_MODE", InferenceEngine::GNAConfigParams::GNA_SW_EXACT}}, + {{"GNA_DEVICE_MODE_XYZ", InferenceEngine::GNAConfigParams::GNA_SW_EXACT}}, + {{"KEY_GNA_DEVICE_MODE_XYZ", InferenceEngine::GNAConfigParams::GNA_SW_EXACT}}, + {{"KEY_GNA_SCALE_FACTOR_1", InferenceEngine::GNAConfigParams::GNA_SW_EXACT}} }; - INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, IncorrectConfigAPITests, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_GNA), diff --git a/src/tests/unit/gna/gna_plugin_config_test.cpp b/src/tests/unit/gna/gna_plugin_config_test.cpp index 68c80e4cb43..c4689773458 100644 --- a/src/tests/unit/gna/gna_plugin_config_test.cpp +++ b/src/tests/unit/gna/gna_plugin_config_test.cpp @@ -105,7 +105,9 @@ TEST_F(GNAPluginConfigTest, GnaConfigDeviceModeTest) { SetAndCompare(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_HW_WITH_SW_FBACK); EXPECT_EQ(config.pluginGna2AccMode, Gna2AccelerationModeHardwareWithSoftwareFallback); EXPECT_EQ(config.swExactMode, false); + IE_SUPPRESS_DEPRECATED_START SetAndCompare(GNA_CONFIG_KEY(DEVICE_MODE), GNAConfigParams::GNA_SW); + IE_SUPPRESS_DEPRECATED_END EXPECT_EQ(config.pluginGna2AccMode, Gna2AccelerationModeSoftware); EXPECT_EQ(config.swExactMode, false); diff --git a/src/tests_deprecated/unit/engines/gna/gna_proc_type_test.cpp b/src/tests_deprecated/unit/engines/gna/gna_proc_type_test.cpp index 0f810246822..225bdd57f1b 100644 --- a/src/tests_deprecated/unit/engines/gna/gna_proc_type_test.cpp +++ b/src/tests_deprecated/unit/engines/gna/gna_proc_type_test.cpp @@ -33,11 +33,6 @@ TEST_F(GNAProcTypeTest, canPassHWProcTypeToGNA) { .onInfer1AFModel().withGNADeviceMode("GNA_HW").gna().propagate_forward().called_with().proc_type(GNA_HARDWARE); } -TEST_F(GNAProcTypeTest, canPassSWProcTypeToGNA) { - assert_that().withGNAConfig(GNA_CONFIG_KEY(SCALE_FACTOR), 1.0f) - .onInfer1AFModel().withGNADeviceMode("GNA_SW").gna().propagate_forward().called_with().proc_type(GNA_SOFTWARE); -} - TEST_F(GNAProcTypeTest, canPassSWEXACTProcTypeToGNA) { assert_that().onInfer1AFModel().withGNAConfig(GNA_CONFIG_KEY(SCALE_FACTOR), 1.0f) .withGNADeviceMode("GNA_SW_EXACT").gna(). diff --git a/tests/samples_tests/smoke_tests/test_speech_sample.py b/tests/samples_tests/smoke_tests/test_speech_sample.py index 5ab358ab0f4..062efa87433 100644 --- a/tests/samples_tests/smoke_tests/test_speech_sample.py +++ b/tests/samples_tests/smoke_tests/test_speech_sample.py @@ -26,7 +26,7 @@ test_data = get_tests(cmd_params={'i': [os.path.join('ark', 'dev93_10.ark')], 'o': ['res_output.ark'], 'r': [os.path.join('ark', 'dev93_scores_10.ark')], 'qb': [8, 16], - 'd': ['GNA_SW']}, + 'd': ['GNA_SW_EXACT']}, use_device=False )