From 9428d629d55194d96f9d343ad2e7cdf4ec2f94ce Mon Sep 17 00:00:00 2001 From: Evgeny Kotov Date: Thu, 19 Aug 2021 14:49:03 +0300 Subject: [PATCH 1/4] use ngraph-based unroll-ti as default --- inference-engine/src/gna_plugin/gna_plugin.cpp | 7 ++----- .../shared_test_classes/src/subgraph/memory_LSTMCell.cpp | 3 ++- .../shared_test_classes/src/subgraph/multiple_LSTMCell.cpp | 6 ++++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/inference-engine/src/gna_plugin/gna_plugin.cpp b/inference-engine/src/gna_plugin/gna_plugin.cpp index 651bf075b6d37f..525061582c9494 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin.cpp @@ -721,11 +721,6 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { manager.register_pass(); const auto& pass_config = manager.get_pass_config(); - pass_config->set_callback( - [](const std::shared_ptr &node) -> bool { - // UnrollTI transformation is disabled by default, is turned on by LowLatency transformation - return node->get_rt_info().count("UNROLL_TI") == 0; - }); pass_config->disable(); pass_config->disable(); pass_config->disable(); @@ -765,8 +760,10 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { int passIdx = 0; auto run_passes = [&] (const CNNNetwork& network, bool runBeforeCopy, bool lowPrecision) { auto passes = make_shared(PassManagerSettings{runBeforeCopy, lowPrecision}, network); + /* passes->registerPass(); passes->registerPass(); + */ passes->registerPass(); if (!isNgraphPassesUsed) passes->registerPass(); diff --git a/inference-engine/tests/functional/shared_test_classes/src/subgraph/memory_LSTMCell.cpp b/inference-engine/tests/functional/shared_test_classes/src/subgraph/memory_LSTMCell.cpp index 291774616714a7..2baa728a18913d 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/subgraph/memory_LSTMCell.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/subgraph/memory_LSTMCell.cpp @@ -104,7 +104,7 @@ namespace SubgraphTestsDefinitions { // TI construction auto tensor_iterator = std::make_shared(); tensor_iterator->set_body(body); - tensor_iterator->set_invariant_input(X, permute_in); + tensor_iterator->set_sliced_input(X, permute_in, 0, 1, 1, -1, 0); tensor_iterator->set_merged_input(H_t, hidden_memory_read, H_o); tensor_iterator->set_merged_input(C_t, cell_memory_read, C_o); @@ -130,6 +130,7 @@ namespace SubgraphTestsDefinitions { SinkVector{cell_memory_write, hidden_memory_write}, input_parameter, "TI_with_memory"); + tensor_iterator->validate_and_infer_types(); } void MemoryLSTMCellTest::switchToNgraphFriendlyModel() { diff --git a/inference-engine/tests/functional/shared_test_classes/src/subgraph/multiple_LSTMCell.cpp b/inference-engine/tests/functional/shared_test_classes/src/subgraph/multiple_LSTMCell.cpp index 09f8020df41220..a3a131eb5b2345 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/subgraph/multiple_LSTMCell.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/subgraph/multiple_LSTMCell.cpp @@ -106,9 +106,10 @@ void MultipleLSTMCellTest::SetUp() { // TI construction auto tensor_iterator = std::make_shared(); tensor_iterator->set_body(body); - tensor_iterator->set_invariant_input(X, permute_in); + tensor_iterator->set_sliced_input(X, permute_in, 0, 1, 1, -1, 0); tensor_iterator->set_merged_input(H_t, hidden_memory_read, H_o); tensor_iterator->set_merged_input(C_t, cell_memory_read, C_o); + tensor_iterator->validate_and_infer_types(); auto out_unsqueeze = tensor_iterator->get_iter_value(unsqueeze_o, -1); auto out_hidden = tensor_iterator->get_iter_value(H_o, -1); @@ -165,9 +166,10 @@ void MultipleLSTMCellTest::SetUp() { // TI construction auto tensor_iterator_2 = std::make_shared(); tensor_iterator_2->set_body(body_2); - tensor_iterator_2->set_invariant_input(X_2, inbetween_squeeze); + tensor_iterator_2->set_sliced_input(X_2, inbetween_squeeze, 0, 1, 1, -1, 0); tensor_iterator_2->set_merged_input(H_t_2, hidden_memory_2_read, H_o_2); tensor_iterator_2->set_merged_input(C_t_2, cell_memory_2_read, C_o_2); + tensor_iterator_2->validate_and_infer_types(); auto out_unsqueeze_2 = tensor_iterator_2->get_iter_value(unsqueeze_o_2, -1); auto out_hidden_2 = tensor_iterator_2->get_iter_value(H_o_2, -1); From 026d583c77d6dca5fd8103abbda8576755ecc608 Mon Sep 17 00:00:00 2001 From: Evgeny Kotov Date: Mon, 23 Aug 2021 17:29:04 +0300 Subject: [PATCH 2/4] use isNgraphPassesUsed for legacy code --- inference-engine/src/gna_plugin/gna_plugin.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inference-engine/src/gna_plugin/gna_plugin.cpp b/inference-engine/src/gna_plugin/gna_plugin.cpp index 525061582c9494..a08a0c484a4d12 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin.cpp @@ -760,10 +760,10 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { int passIdx = 0; auto run_passes = [&] (const CNNNetwork& network, bool runBeforeCopy, bool lowPrecision) { auto passes = make_shared(PassManagerSettings{runBeforeCopy, lowPrecision}, network); - /* - passes->registerPass(); - passes->registerPass(); - */ + if (!isNgraphPassesUsed) { + passes->registerPass(); + passes->registerPass(); + } passes->registerPass(); if (!isNgraphPassesUsed) passes->registerPass(); From f32fab649d352a0e472cc769b6d9301c43939153 Mon Sep 17 00:00:00 2001 From: Evgeny Kotov Date: Thu, 26 Aug 2021 12:19:00 +0300 Subject: [PATCH 3/4] code review fixes --- inference-engine/src/gna_plugin/gna_plugin.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inference-engine/src/gna_plugin/gna_plugin.cpp b/inference-engine/src/gna_plugin/gna_plugin.cpp index a08a0c484a4d12..39e30aae662372 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin.cpp @@ -760,11 +760,12 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { int passIdx = 0; auto run_passes = [&] (const CNNNetwork& network, bool runBeforeCopy, bool lowPrecision) { auto passes = make_shared(PassManagerSettings{runBeforeCopy, lowPrecision}, network); + passes->registerPass(); if (!isNgraphPassesUsed) { - passes->registerPass(); passes->registerPass(); + passes->registerPass(); } - passes->registerPass(); + if (!isNgraphPassesUsed) passes->registerPass(); passes->registerPass(); From 19c5a8da2804f2845574de84bfc764baf0f76473 Mon Sep 17 00:00:00 2001 From: Evgeny Kotov Date: Thu, 26 Aug 2021 12:24:12 +0300 Subject: [PATCH 4/4] code review fixes --- inference-engine/src/gna_plugin/gna_plugin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/inference-engine/src/gna_plugin/gna_plugin.cpp b/inference-engine/src/gna_plugin/gna_plugin.cpp index 39e30aae662372..9c1d8b036ed55f 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin.cpp @@ -764,10 +764,9 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { if (!isNgraphPassesUsed) { passes->registerPass(); passes->registerPass(); + passes->registerPass(); } - if (!isNgraphPassesUsed) - passes->registerPass(); passes->registerPass(); // fake quantisation aware passes