From c99a34880209f8087336ea79cfd0854c2a7b883f Mon Sep 17 00:00:00 2001 From: Michal Miotk Date: Thu, 21 Nov 2024 23:54:32 +0100 Subject: [PATCH] new shape infer for lsm_cell, changes from review Signed-off-by: Michal Miotk --- .../src/graph/impls/onednn/lstm_seq_onednn.hpp | 4 +++- .../intel_gpu/src/graph/layout_optimizer.cpp | 4 +--- .../cl_kernels/lstm_cell_and_seq_bfyx.cl | 10 +++++----- src/plugins/intel_gpu/src/plugin/ops/rnn.cpp | 17 ----------------- src/plugins/intel_gpu/src/plugin/plugin.cpp | 6 ------ .../intel_gpu/src/plugin/program_builder.cpp | 2 +- 6 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/lstm_seq_onednn.hpp b/src/plugins/intel_gpu/src/graph/impls/onednn/lstm_seq_onednn.hpp index e4b3f93639457b..edc337034b53e9 100644 --- a/src/plugins/intel_gpu/src/graph/impls/onednn/lstm_seq_onednn.hpp +++ b/src/plugins/intel_gpu/src/graph/impls/onednn/lstm_seq_onednn.hpp @@ -3,6 +3,7 @@ // #include "lstm_seq_inst.h" +#include "reshape_inst.h" #include "intel_gpu/runtime/utils.hpp" #include "impls/registry/implementation_manager.hpp" #include "transformations/utils/utils.hpp" @@ -20,7 +21,8 @@ struct LSTMSeqImplementationManager : public ImplementationManager { bool validate_impl(const program_node& node) const override { assert(node.is_type()); - return node.get_input_layout(0).format == cldnn::format::bfyx || node.get_input_layout(0).format == cldnn::format::fbyx; + return node.get_input_layout(0).format == cldnn::format::bfyx || node.get_input_layout(0).format == cldnn::format::fbyx \ + || node.get_input_layout(0).format == cldnn::format::ybfx; } in_out_fmts_t query_formats(const program_node& node) const override { diff --git a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp index 9d8e00fa46ac6b..e2c53c660fb782 100644 --- a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp +++ b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp @@ -1088,7 +1088,7 @@ format layout_optimizer::get_expected_format(quantize_node const& node) { return all_users_gemm; }; - auto use_onednn_impls = contains_onednn_impls_optimization_attribute(&node); + auto use_onednn_impls = has_all_enabled_onednn_impls_optimization_attribute(); if (use_onednn_impls) { expected = format::any; @@ -1445,8 +1445,6 @@ bool layout_optimizer::has_all_enabled_onednn_impls_optimization_attribute() { is_enabled_onednn_for() && is_enabled_onednn_for() && is_enabled_onednn_for(); } - - void layout_optimizer::set_value_onednn(primitive_type_id p_type, bool val) { _optimization_attributes.onednn_impls[p_type] = val; } diff --git a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/lstm_cell_and_seq_bfyx.cl b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/lstm_cell_and_seq_bfyx.cl index 850af6c98a824f..f2cf2ca985e855 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/lstm_cell_and_seq_bfyx.cl +++ b/src/plugins/intel_gpu/src/kernel_selector/cl_kernels/lstm_cell_and_seq_bfyx.cl @@ -149,11 +149,11 @@ KERNEL(lstm_cell_and_seq_bfyx)( } unroll_for(uint j=block_num*VEC_SIZE;j(op->get_output_size()))); - } else { - auto mutable_precision_first = op->get_output_element_type(1); - cldnn::layout outLayout = cldnn::layout( - cldnn::element_type_to_data_type(mutable_precision_first), - cldnn::format::get_default_format(op->get_output_shape(1).size()), - tensor_from_dims(op->get_output_shape(1))); - - cldnn::memory::ptr shared_memory = p.get_engine().allocate_memory(outLayout); - const cldnn::primitive_id mutable_id_1 = layerName + "_md_write.1"; - const cldnn::mutable_data mutable_prim_1{mutable_id_1, shared_memory}; - p.add_primitive(*op, mutable_prim_1); - - p.add_primitive(*op, cldnn::lstm_cell(layerName+".out0", inputs[0], inputs[1], inputs[2], inputs[3], inputs[4], inputs[5], \ - cldnn::input_info(), "", layerName + "_md_write.1", clip, false, activations, \ - activation_params, cldnn::lstm_weights_order::fizo, ov::op::RecurrentSequenceDirection::FORWARD, cldnn::padding(), 1)); - - p.add_primitive(*op, cldnn::mutable_data(layerName + ".out1", {cldnn::input_info(layerName + ".out0")}, shared_memory)); } } diff --git a/src/plugins/intel_gpu/src/plugin/plugin.cpp b/src/plugins/intel_gpu/src/plugin/plugin.cpp index 4ad19d7ef1a787..9148ad74706d3f 100644 --- a/src/plugins/intel_gpu/src/plugin/plugin.cpp +++ b/src/plugins/intel_gpu/src/plugin/plugin.cpp @@ -189,9 +189,6 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< ExecutionConfig config = m_configs_map.at(device_id); config.set_user_property(orig_config); - if (context->get_engine().get_device_info().supports_immad) { - config.set_property(ov::intel_gpu::use_onednn(true)); - } config.apply_user_properties(context->get_engine().get_device_info()); set_cache_info(model, config); @@ -213,9 +210,6 @@ std::shared_ptr Plugin::compile_model(const std::shared_ptr< ExecutionConfig config = m_configs_map.at(device_id); config.set_user_property(orig_config); - if (context_impl->get_engine().get_device_info().supports_immad) { - config.set_property(ov::intel_gpu::use_onednn(true)); - } config.apply_user_properties(context_impl->get_engine().get_device_info()); set_cache_info(model, config); diff --git a/src/plugins/intel_gpu/src/plugin/program_builder.cpp b/src/plugins/intel_gpu/src/plugin/program_builder.cpp index 4fcf67ef616b8d..48f0b3dbf23f66 100644 --- a/src/plugins/intel_gpu/src/plugin/program_builder.cpp +++ b/src/plugins/intel_gpu/src/plugin/program_builder.cpp @@ -356,7 +356,7 @@ bool ProgramBuilder::requires_new_shape_infer(const std::shared_ptr& o return true; } - if (ov::is_type(op)) { + if (ov::is_type(op) || ov::is_type(op)) { return true; } // When input node has dynamic shape with 4 dimension, this function return false