[GPU][DG2] Fix unit test: test_select_preferred_formats.setting_target_conv_format (#14837)
* Fix wrong weight shape * Output layout initialization * Ensure preferred output format is selected
This commit is contained in:
parent
a8fa767f41
commit
9cde294b7f
@ -1868,7 +1868,7 @@ void layout_optimizer::select_preferred_formats_for_onednn(program_node& node, d
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (node.get_preferred_output_fmt() == format::any) {
|
if (node.get_preferred_output_fmt() == format::any) {
|
||||||
for (size_t usr = 0 ; usr < node.get_users().size() ; usr++)
|
for (size_t usr = 0; usr < std::max<size_t>(1, node.get_users().size()); usr++)
|
||||||
node.set_preferred_output_fmt(usr, dst_fmt);
|
node.set_preferred_output_fmt(usr, dst_fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,12 +25,12 @@ using namespace testing;
|
|||||||
TEST(test_select_preferred_formats, setting_target_conv_format) {
|
TEST(test_select_preferred_formats, setting_target_conv_format) {
|
||||||
auto& engine = get_test_engine();
|
auto& engine = get_test_engine();
|
||||||
auto input = engine.allocate_memory({ data_types::f16, format::bfyx, { 1, 32, 64, 64 } });
|
auto input = engine.allocate_memory({ data_types::f16, format::bfyx, { 1, 32, 64, 64 } });
|
||||||
auto weights = engine.allocate_memory({ data_types::f16, format::bfyx, { 1, 32, 64, 64 } });
|
auto weights = engine.allocate_memory({ data_types::f16, format::bfyx, { 32, 32, 3, 3 } });
|
||||||
|
|
||||||
topology topology;
|
topology topology;
|
||||||
topology.add(data("weights", weights));
|
topology.add(data("weights", weights));
|
||||||
topology.add(input_layout("input", input->get_layout()));
|
topology.add(input_layout("input", input->get_layout()));
|
||||||
topology.add(reorder("reorder", input_info("input"), format::b_fs_yx_fsv16, data_types::f16)),
|
topology.add(reorder("reorder", input_info("input"), format::b_fs_yx_fsv16, data_types::f16));
|
||||||
topology.add(convolution("conv1", input_info("reorder"), { "weights" }));
|
topology.add(convolution("conv1", input_info("reorder"), { "weights" }));
|
||||||
|
|
||||||
build_options build;
|
build_options build;
|
||||||
@ -41,6 +41,9 @@ TEST(test_select_preferred_formats, setting_target_conv_format) {
|
|||||||
layout_optimizer lo(true);
|
layout_optimizer lo(true);
|
||||||
auto prog = program::build_program(engine, topology, build, false, true);
|
auto prog = program::build_program(engine, topology, build, false, true);
|
||||||
|
|
||||||
|
// It initializes output_layout.
|
||||||
|
// It's necessary because this test runs select_preferred_formats pass alone.
|
||||||
|
prog->get_node("conv1").get_output_layouts(false);
|
||||||
program_wrapper::apply_opt_pass<select_preferred_formats>(*prog, lo);
|
program_wrapper::apply_opt_pass<select_preferred_formats>(*prog, lo);
|
||||||
|
|
||||||
ASSERT_NE(prog, nullptr);
|
ASSERT_NE(prog, nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user