|
3 | 3 | //
|
4 | 4 |
|
5 | 5 | #include "test_utils.h"
|
| 6 | +#include "random_generator.hpp" |
6 | 7 |
|
7 | 8 | #include <intel_gpu/primitives/input_layout.hpp>
|
8 | 9 | #include <intel_gpu/primitives/concatenation.hpp>
|
| 10 | +#include <intel_gpu/primitives/fully_connected.hpp> |
| 11 | +#include <intel_gpu/primitives/permute.hpp> |
9 | 12 | #include <intel_gpu/primitives/reorder.hpp>
|
10 | 13 | #include <intel_gpu/primitives/data.hpp>
|
11 | 14 | #include <intel_gpu/primitives/reshape.hpp>
|
@@ -57,3 +60,49 @@ TEST(propagate_constants, copy_dependecies_from_nodes) {
|
57 | 60 | TEST(propagate_constants, copy_dependecies_from_nodes_cached) {
|
58 | 61 | test_copy_dependecies_from_nodes<ov::float16>(true);
|
59 | 62 | }
|
| 63 | + |
| 64 | +TEST(propagate_constants, permute_1_0_reorder_fc) { |
| 65 | + auto& engine = get_test_engine(); |
| 66 | + |
| 67 | + auto input2_layout_dyn = layout{ ov::PartialShape{ -1, 32 }, data_types::f16, format::bfyx }; |
| 68 | + |
| 69 | + auto input = engine.allocate_memory({ { 2, 32 }, data_types::f16, format::bfyx }); |
| 70 | + auto input2 = engine.allocate_memory({ { 2, 32 }, data_types::f16, format::bfyx }); |
| 71 | + auto weights = engine.allocate_memory({{ 32, 2 }, data_types::f32, format::bfyx }); |
| 72 | + |
| 73 | + tests::random_generator rg(GET_SUITE_NAME); |
| 74 | + auto input_data = rg.generate_random_2d<ov::float16>(2, 32, -1, 1); |
| 75 | + auto input2_data = rg.generate_random_2d<ov::float16>(2, 32, -1, -1); |
| 76 | + auto weights_data = rg.generate_random_2d<float>(32, 2, -1, 1); |
| 77 | + |
| 78 | + set_values(input, flatten_2d(format::bfyx, input_data)); |
| 79 | + set_values(input2, input2_data); |
| 80 | + set_values(weights, flatten_2d(format::bfyx, weights_data)); |
| 81 | + |
| 82 | + topology topology( |
| 83 | + input_layout("input", input->get_layout()), |
| 84 | + input_layout("input2", input2_layout_dyn), |
| 85 | + data("weights", weights), |
| 86 | + permute("permute_test", input_info("weights"), {1, 0}), |
| 87 | + reorder("reorder_dt", input_info("permute_test"), format::any, data_types::f16, std::vector<float>()), |
| 88 | + fully_connected("fc1", input_info("input"), { "reorder_dt" }, "", data_types::f16), |
| 89 | + fully_connected("fc2", input_info("input2"), { "reorder_dt" }, "", data_types::f16) |
| 90 | + ); |
| 91 | + |
| 92 | + ExecutionConfig config = get_test_default_config(engine); |
| 93 | + config.set_property(ov::intel_gpu::optimize_data(true)); |
| 94 | + config.set_property(ov::intel_gpu::allow_new_shape_infer(true)); |
| 95 | + |
| 96 | + if (engine.get_device_info().supports_immad) { |
| 97 | + ov::intel_gpu::ImplementationDesc fc_impl = { format::bfyx, "", impl_types::onednn }; |
| 98 | + config.set_property(ov::intel_gpu::force_implementations(ov::intel_gpu::ImplForcingMap{ {"fc1", fc_impl} })); |
| 99 | + } |
| 100 | + |
| 101 | + cldnn::network network(engine, topology, config); |
| 102 | + network.set_input_data("input", input); |
| 103 | + network.set_input_data("input2", input2); |
| 104 | + |
| 105 | + auto outputs = network.execute(); |
| 106 | + auto output = outputs.at("fc1").get_memory(); |
| 107 | + cldnn::mem_lock<ov::float16> output_ptr(output, get_test_stream()); |
| 108 | +} |
0 commit comments