From 68ba5b1edfda173e26de8f6cb2d0b8b92f6b3eca Mon Sep 17 00:00:00 2001 From: fishbell Date: Wed, 25 Dec 2024 09:21:37 +0800 Subject: [PATCH] fix case Signed-off-by: fishbell --- .../graph_optimizer/reshape_transfer.cpp | 26 ++++++++----------- .../unit/passes/reorder_reshape_permute.cpp | 9 ------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/reshape_transfer.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/reshape_transfer.cpp index 90e0e351097a4f..90faed7160310a 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/reshape_transfer.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/reshape_transfer.cpp @@ -34,22 +34,18 @@ void reshape_transfer::run(program& p) { is_suitable_parent = [&is_suitable_parent](const cldnn::program_node* node) -> bool { if (node->get_users().size() != 1 || node->is_dynamic()) return false; - if (node->is_type()) - return true; - if (node->is_type()) { - for (size_t idx = 0; idx < node->get_dependencies().size(); idx++) { - auto& input = node->get_dependency(idx); - if (!input.is_in_data_flow() || input.is_constant()) - continue; - if (input.is_type()) { - return true; - } else if (input.is_type() && input.get_dependency(1).is_constant()) { - return is_suitable_parent(&input); - } else if (input.is_type()) { - return is_suitable_parent(&input); - } - return false; + for (size_t idx = 0; idx < node->get_dependencies().size(); idx++) { + auto& input = node->get_dependency(idx); + if (!input.is_in_data_flow() || input.is_constant()) + continue; + if (node->is_type() || input.is_type()) { + return true; + } else if (input.is_type() && input.get_dependency(1).is_constant()) { + return is_suitable_parent(&input); + } else if (input.is_type()) { + return is_suitable_parent(&input); } + return false; } return false; }; diff --git a/src/plugins/intel_gpu/tests/unit/passes/reorder_reshape_permute.cpp b/src/plugins/intel_gpu/tests/unit/passes/reorder_reshape_permute.cpp index 7189b3e29ee978..553352d45a681e 100644 --- a/src/plugins/intel_gpu/tests/unit/passes/reorder_reshape_permute.cpp +++ b/src/plugins/intel_gpu/tests/unit/passes/reorder_reshape_permute.cpp @@ -336,16 +336,8 @@ TEST(opt_reorder_reshape_permute, not_sinking_reshape) { net.set_input_data("input", input); auto output = net.execute(); - auto optimzed_nodes = net.get_program()->get_optimized(); - auto it = - std::find_if(std::begin(optimzed_nodes), std::end(optimzed_nodes), [&](cldnn::program::optimized_info& oi) { - return oi.first == "reorder_inter"; - }); - ASSERT_NE(it, optimzed_nodes.end()); auto permute_inst = net.get_primitive("permute_inter"); ASSERT_FALSE(permute_inst->can_be_optimized()); - auto reshape_inst = net.get_primitive("reshape_inter"); - ASSERT_FALSE(reshape_inst->can_be_optimized()); auto& processing_order = prog->get_processing_order(); @@ -365,7 +357,6 @@ TEST(opt_reorder_reshape_permute, not_sinking_reshape) { mem_lock lock_ref(ref_out_mem, get_test_stream()); for (size_t i = 0; i < out_mem->count(); i++) { float actual = lock[i]; - std::cout << actual << ", " << std::endl; ASSERT_EQ(actual, lock_ref[i]); } }