From 45ce076af5d98d228c775e9a27c9037494106da6 Mon Sep 17 00:00:00 2001 From: Kelvin Choi Date: Fri, 2 Aug 2024 19:20:57 +0900 Subject: [PATCH] [GPU] Prevent dynamic padding propagation to transposed gemm layer --- .../src/graph/include/reshape_inst.h | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/plugins/intel_gpu/src/graph/include/reshape_inst.h b/src/plugins/intel_gpu/src/graph/include/reshape_inst.h index 78cbba8f3eeba4..fa5dc2b8060913 100644 --- a/src/plugins/intel_gpu/src/graph/include/reshape_inst.h +++ b/src/plugins/intel_gpu/src/graph/include/reshape_inst.h @@ -8,6 +8,7 @@ #include "openvino/core/partial_shape.hpp" #include "crop_inst.h" #include "rope_inst.h" +#include "gemm_inst.h" #include "primitive_inst.h" #include @@ -40,9 +41,30 @@ struct typed_program_node : public typed_program_node_base { return false; // TODO: If user is RoPE and dynamic padding exists, ouput padding propagation is not supported in the base mode - if (get_users().size() == 1 && get_users().front()->is_type()) + auto user = get_users().front(); + if (get_users().size() == 1 && user->is_type()) return false; + // TODO: Support transpose-fused gemm with dynamic_pad + if (get_users().size() == 1 && user->is_type()) { + auto desc = user->as().get_primitive(); + + auto input_order_transposed = [&]() -> bool { + for (size_t i = 0; i < desc->input0_transpose_order.size(); i++) { + if (desc->input0_transpose_order[i] != static_cast(i)) + return true; + } + for (size_t i = 0; i < desc->input1_transpose_order.size(); i++) { + if (desc->input1_transpose_order[i] != static_cast(i)) + return true; + } + return false; + }; + + if (input_order_transposed()) + return false; + } + auto axis = input().as().get_primitive()->axis; const auto& input_pshape = input().get_output_layout(false).get_partial_shape(); auto input_rank = input_pshape.size();