Skip to content

Commit ec6a8d2

Browse files
authored
[GPU] add format::b_fs_yx_fsv4 to onednn::conv support list (#32435)
### Description of the issue(symptom, root-cause, how it was resolved) - This issue can be reproduced on the machine which the onednn is working. - It cannot create the onednn primitive with this error msg: "Check 'shape_consistent' failed at src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.cpp:264: [GPU] Input shape and output shape of weight reorder should be same." - root-cause: At add_required_reorders pass, b_fs_fsv4 is chosen for input0 via find_data_format(). b_fs_fsv4 is not in supported list for onednn::conv. it chooses bfzyx for in/out of conv via test_format(). #### The code and line that caused this issue (if it is not changed directly) - src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.cpp (test_format) #### Reproduction step and snapshot (if applicable. Do not attach for customer model) - reproducer is attached in the ticket. #### Problematic graph cldnn_program_1_15_prepare_buffer_fusing.graph <img width="388" height="209" alt="image" src="https://github.com/user-attachments/assets/99bbeaf8-3c46-4a08-858e-5da6127b3fb2" /> cldnn_program_1_16_add_required_reorders.graph <img width="388" height="301" alt="image" src="https://github.com/user-attachments/assets/deb64b52-af65-4203-a9ce-b536171ba2a4" /> #### Checklist - [x] Is it a proper fix? (not a workaround) - [x] Did you include test case for this fix, if necessary? - [x] Did you review existing test that can be extended to cover this scenario? Which test did you review? -> In add_required_reorder pass, this convolution should be chosen wrong format via test_format() to reproduce the issue. ### Tickets: - 174951
1 parent 228f44c commit ec6a8d2

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct ConvolutionImplementationManager : public ImplementationManager {
4747
format::bfzyx,
4848
format::byxf,
4949
format::bzyxf,
50+
format::b_fs_yx_fsv4,
5051
format::b_fs_yx_fsv8,
5152
format::b_fs_zyx_fsv8,
5253
format::b_fs_yx_fsv16,

src/plugins/intel_gpu/tests/unit/test_cases/convolution_gpu_test.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10845,6 +10845,45 @@ TEST(convolution_gpu_onednn, grouped_runtime_weights) {
1084510845
ASSERT_EQ(output_layout.get_shape(), ov::Shape({1, 256, 25, 25}));
1084610846
}
1084710847

10848+
TEST(convolution_gpu_onednn, grouped_conv_fsv4) {
10849+
auto& engine = get_test_engine();
10850+
10851+
if (!engine.get_device_info().supports_immad)
10852+
return;
10853+
10854+
tests::random_generator rg(GET_SUITE_NAME);
10855+
10856+
int64_t input_b = 1, input_f = 4, input_y = 3, input_x = 3;
10857+
auto input_size = ov::PartialShape{ input_b, input_f, input_y, input_x };
10858+
auto input_data = rg.generate_random_4d<ov::float16>(input_b, input_f, input_y, input_x, -1, 1);
10859+
auto input_data_byxf = flatten_4d(format::bfyx, input_data);
10860+
auto input_mem = engine.allocate_memory({ input_size, data_types::f16, format::bfyx });
10861+
set_values(input_mem, input_data_byxf);
10862+
10863+
int64_t weights_b = 2, weights_f = 2048, weights_y = 2, weights_x = 1;
10864+
auto weights_size = ov::PartialShape{ weights_b, weights_f, weights_y, weights_x };
10865+
auto weights_data = rg.generate_random_4d<ov::float16>(weights_b, weights_f, weights_y, weights_x, -1, 1);
10866+
auto weights_data_bfyx = flatten_4d(format::bfyx, weights_data);
10867+
auto weights_mem = engine.allocate_memory({ weights_size, data_types::f16, format::bfyx });
10868+
set_values(weights_mem, weights_data_bfyx);
10869+
10870+
topology topology(
10871+
input_layout("input", input_mem->get_layout()),
10872+
reorder("input_fsv", input_info("input"), { input_size, data_types::f16, format::b_fs_yx_fsv4 }),
10873+
input_layout("weights", weights_mem->get_layout()),
10874+
reshape("reshaped_weights", input_info("weights"), true, { 2, 2048, 2, 1, 1 }, { 2, 2048, 2, 1, 1 }),
10875+
convolution("conv", input_info("input_fsv"), "reshaped_weights", no_bias, 2, { 1, 1 }, { 1, 1 }, { 0, 0 }, { 0, 0 }, true),
10876+
reorder("reorder", input_info("conv"), { data_types::f32, format::bfyx, { 1, 4096, 3, 3 } }));
10877+
10878+
ExecutionConfig config = get_test_default_config(engine);
10879+
config.set_property(ov::intel_gpu::optimize_data(true));
10880+
10881+
network network(engine, topology, config);
10882+
network.set_input_data("input", input_mem);
10883+
network.set_input_data("weights", weights_mem);
10884+
network.execute();
10885+
}
10886+
1084810887
TEST(convolution_gpu_onednn, dyn_conv4d_reshape6d_pattern) {
1084910888
tests::random_generator rg(GET_SUITE_NAME);
1085010889
auto& engine = get_test_engine();

0 commit comments

Comments
 (0)