Skip to content

Commit 7ea6e2d

Browse files
authored
[GPU] Add bzyxf input format for tensor transform in reorder calc output layout (#30939)
### Details: - Add bzyxf input format for tensor transform in reorder calc output layout ### Tickets: - 168257
1 parent f2f89b5 commit 7ea6e2d

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

src/plugins/intel_gpu/src/graph/reorder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ layout reorder_inst::calc_output_layout(reorder_node const& node, kernel_impl_pa
159159
}
160160

161161
if ((ofmt == format::bs_fs_fsv8_bsv8 || ofmt == format::os_i_osv8__ai8 || ofmt == format::os_i_osv16__ai8 || ofmt == format::os_i_osv16 ||
162-
ofmt == format::bfzyx || ifmt == format::bfzyx || ofmt == format::b_fs_zyx_fsv16 || ifmt == format::b_fs_zyx_fsv16 ||
162+
ofmt == format::bfzyx || ifmt == format::bfzyx || ifmt == format::bzyxf ||
163+
ofmt == format::b_fs_zyx_fsv16 || ifmt == format::b_fs_zyx_fsv16 ||
163164
ofmt == format::bs_fs_zyx_bsv16_fsv16 || ifmt == format::bs_fs_zyx_bsv16_fsv16 ||
164165
ofmt == format::bs_fs_zyx_bsv16_fsv32 || ifmt == format::bs_fs_zyx_bsv16_fsv32 ||
165166
ofmt == format::b_fs_zyx_fsv32 || ifmt == format::b_fs_zyx_fsv32 ||

src/plugins/intel_gpu/tests/unit/passes/reorder_inputs_test.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,38 @@ TEST(reorder_inputs, mixed_ranks_gather) {
163163
ASSERT_EQ(gather2_node.get_output_layout().format, format::bfwzyx);
164164
}
165165

166+
TEST(reorder_inputs, mixed_ranks_reshape) {
167+
// Topology:
168+
// transpose -> (5d) -> reshape -> (3d)
169+
// Expected: (bfzyx:5d) -> reorder -> (bfyx:4d) -> reshape -> (bfyx:3d)
170+
171+
auto& engine = get_test_engine();
172+
auto shape = engine.allocate_memory(layout{ { 3 }, data_types::i64, format::bfyx });
173+
set_values<int64_t>(shape, { 0, -1, 2 });
174+
175+
topology topology;
176+
topology.add(input_layout("input", layout{ { 1, 2, 32, 128, 128 }, data_types::f16, format::bzyxf }));
177+
topology.add(input_layout("eltw_input", layout{ { 1, 524288, 2 }, data_types::f16, format::bfyx }));
178+
topology.add(data("shape", shape));
179+
topology.add(permute("permute", input_info("input"), { 0, 2, 3, 4, 1 }));
180+
topology.add(reshape("reshape", input_info("permute"), input_info("shape"), true, ov::PartialShape{ 1, 524288, 2 }));
181+
topology.add(eltwise("eltwise", input_info("reshape"), input_info("eltw_input"), eltwise_mode::sum));
182+
183+
ExecutionConfig config = get_test_default_config(engine);
184+
config.set_property(ov::intel_gpu::optimize_data(true));
185+
186+
program::ptr prog = nullptr;
187+
OV_ASSERT_NO_THROW(prog = program::build_program(engine, topology, config));
188+
ASSERT_NE(prog, nullptr);
189+
190+
auto prog_impl = prog.get();
191+
192+
auto& reshape_node = prog_impl->get_node("reshape");
193+
194+
ov::PartialShape expected_reorder_shape{ 1, 32, 16384, 2 };
195+
ASSERT_EQ(reshape_node.get_input_layouts()[0].get_partial_shape(), expected_reorder_shape);
196+
}
197+
166198
TEST(reorder_inputs, impl_forcing_basic_format) {
167199
auto& engine = get_test_engine();
168200
auto input = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 2, 4, 1 } });

0 commit comments

Comments
 (0)