OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
[GPU] Fix crash due to the unaligned input for fake aligned user (#29199)
Taylor Yeonbok Lee3ee2cf76c726
diff --git a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp b/src/plugins/intel_gpu/src/graph/primitive_inst.cppindex 449c0d38aae..901d3d593f6 100644--- a/src/plugins/intel_gpu/src/graph/primitive_inst.cpp+++ b/src/plugins/intel_gpu/src/graph/primitive_inst.cpp@@ -516,7 +516,7 @@ kernel_impl_params primitive_inst::get_fake_aligned_params_if_possible(kernel_imconst auto &dev_info = get_node().get_program().get_engine().get_device_info();// The target HW of this patch is limited because of performance concern- if (dev_info.supports_immad && dev_info.dev_type == device_type::integrated_gpu) {+ if ((dev_info.supports_immad && dev_info.dev_type == device_type::integrated_gpu) || dev_info.gfx_ver.major >= 20) {// Check whether the input node has enough space for output data. Otherwise, fake alignment is not possible due to page fault// i.e. predecessor node was supposed be increased alreadyif (get_node().is_type<fully_connected>() && dependencies().size() > 0 && dep_memory(0).get_layout().is_static()diff --git a/src/plugins/intel_gpu/tests/unit/fake_alignment/fc_fake_alignment_test.cpp b/src/plugins/intel_gpu/tests/unit/fake_alignment/fc_fake_alignment_test.cppindex 6e3472bc48a..6fec4d02d7a 100644--- a/src/plugins/intel_gpu/tests/unit/fake_alignment/fc_fake_alignment_test.cpp+++ b/src/plugins/intel_gpu/tests/unit/fake_alignment/fc_fake_alignment_test.cpp@@ -13,6 +13,9 @@#include "fully_connected_inst.h"#include "eltwise_inst.h"+#include "test_utils.h"+#include "random_generator.hpp"+#include "program_wrapper.h"#include <cmath>@@ -276,4 +279,51 @@ INSTANTIATE_TEST_SUITE_P(smoke, fully_connected_skip_fake_align_test,layout{ov::PartialShape{1, 1000, 512}, data_types::f32, format::bfyx} // skipped fake_aligned output layout_dgpu},}));++class fully_connected_skip_fake_align_test2 : public testing::TestWithParam<fc_fake_align_params> {};++TEST_P(fully_connected_skip_fake_align_test2, runtime_skip_and_fake_alginement) {+ auto p = GetParam();+ tests::random_generator rg;+ auto& engine = get_test_engine();+ auto rank = p.input_layout.get_partial_shape().size();+ auto input_layout_dynamic = layout {ov::PartialShape::dynamic(rank), data_types::f16, format::get_default_format(rank)};+ auto weights_mem = engine.allocate_memory(p.weight_layout);+ auto weights_data = rg.generate_random_2d<ov::float16>(3584, 3584, -1, 1);+ set_values(weights_mem, weights_data);++ topology topology(input_layout("input", input_layout_dynamic),+ permute("permute", input_info("input"), {0, 2, 1}),+ data("weight", weights_mem),+ fully_connected("fc", input_info("permute"), "weight", "", p.data_type, rank),+ reorder("reorder", input_info("fc"), format::get_default_format(rank), data_types::f32));++ ExecutionConfig config = get_test_default_config(engine);+ config.set_property(ov::intel_gpu::allow_new_shape_infer(true));+ config.set_property(ov::intel_gpu::optimize_data(true));+ network network(engine, topology, config);++ auto input_mem = engine.allocate_memory(p.input_layout);+ network.set_input_data("input", input_mem);++ std::map<primitive_id, network_output> outputs;+ OV_ASSERT_NO_THROW(outputs = network.execute());+ outputs.begin()->second.get_memory();++ auto permute_inst = network.get_primitive("permute");+ ASSERT_EQ(permute_inst->can_be_optimized(), true);+}++INSTANTIATE_TEST_SUITE_P(smoke, fully_connected_skip_fake_align_test2,+ testing::ValuesIn(std::vector<fc_fake_align_params>{+ {+ layout{ov::PartialShape{1014, 3584, 1}, data_types::f16, format::bfyx}, // input_layout+ layout{ov::PartialShape{3584, 3584}, data_types::f16, format::bfyx}, // weight layout+ data_types::f16,+ layout{ov::PartialShape{1014, 1, 3584}, data_types::f16, format::bfyx}, // not used in this test+ layout{ov::PartialShape{1014, 1, 3584}, data_types::f16, format::bfyx}, // not used in this test+ layout{ov::PartialShape{1014, 1, 3584}, data_types::f16, format::bfyx}, // not used in this test+ layout{ov::PartialShape{1014, 1, 3584}, data_types::f16, format::bfyx} // not used in this test+ },+ }));} // fake_alignment_tests