[GPU] 7-dimention only supports plain format (#19039)
* Skip concat_input_order opt in case dependancy is dynamic * Add plain 7d 8d case for jitter pitch size
This commit is contained in:
parent
475ce744af
commit
c89b9edfe7
@ -118,8 +118,7 @@ void concat_input_order::run(program& p) {
|
|||||||
// 4. Not already aligned
|
// 4. Not already aligned
|
||||||
// 5. Users can accept shuffled features
|
// 5. Users can accept shuffled features
|
||||||
// 6. No fused primitives
|
// 6. No fused primitives
|
||||||
if (!node->is_type<concatenation>() || node->is_output() ||
|
if (!node->is_type<concatenation>() || node->is_output() || node->is_dynamic())
|
||||||
(node->is_valid_output_layout() && node->get_output_layout().is_dynamic()))
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
auto& concat_node = node->as<concatenation>();
|
auto& concat_node = node->as<concatenation>();
|
||||||
@ -146,6 +145,7 @@ void concat_input_order::run(program& p) {
|
|||||||
single_format &= dep_layout.format == out_format;
|
single_format &= dep_layout.format == out_format;
|
||||||
feature_sizes.push_back(dep_layout.feature());
|
feature_sizes.push_back(dep_layout.feature());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alignment is not optimal if aligned input follows unaligned one
|
// Alignment is not optimal if aligned input follows unaligned one
|
||||||
bool already_aligned = true;
|
bool already_aligned = true;
|
||||||
for (size_t i = 1; i < feature_sizes.size(); ++i) {
|
for (size_t i = 1; i < feature_sizes.size(); ++i) {
|
||||||
|
@ -1669,7 +1669,12 @@ format layout_optimizer::get_preferred_format(program_node& node) {
|
|||||||
// Check if selected format can be adjusted to the required input rank
|
// Check if selected format can be adjusted to the required input rank
|
||||||
// If no, use default fotmat instead
|
// If no, use default fotmat instead
|
||||||
try {
|
try {
|
||||||
format::adjust_to_rank(fmt, in_lay_rank);
|
// 7-dimention and 8-dimention only support plain format
|
||||||
|
if (in_lay_rank >= 7 || out_lay_rank >= 7) {
|
||||||
|
fmt = format::get_default_format(in_lay_rank);
|
||||||
|
} else {
|
||||||
|
format::adjust_to_rank(fmt, in_lay_rank);
|
||||||
|
}
|
||||||
} catch (ov::Exception&) {
|
} catch (ov::Exception&) {
|
||||||
fmt = format::get_default_format(in_lay_rank);
|
fmt = format::get_default_format(in_lay_rank);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,8 @@ JitDefinitions DataTensorJitConstant::GetDefinitions() const {
|
|||||||
};
|
};
|
||||||
if (_tensor.is_dynamic()) {
|
if (_tensor.is_dynamic()) {
|
||||||
if (_tensor.GetLayout() == DataLayout::bf || _tensor.GetLayout() == DataLayout::bfyx ||
|
if (_tensor.GetLayout() == DataLayout::bf || _tensor.GetLayout() == DataLayout::bfyx ||
|
||||||
_tensor.GetLayout() == DataLayout::bfzyx || _tensor.GetLayout() == DataLayout::bfwzyx) {
|
_tensor.GetLayout() == DataLayout::bfzyx || _tensor.GetLayout() == DataLayout::bfwzyx ||
|
||||||
|
_tensor.GetLayout() == DataLayout::bfuwzyx || _tensor.GetLayout() == DataLayout::bfvuwzyx) {
|
||||||
definitions.push_back({_name + "_X_PITCH", "1"});
|
definitions.push_back({_name + "_X_PITCH", "1"});
|
||||||
definitions.push_back({_name + "_Y_PITCH", dims_padded.x()});
|
definitions.push_back({_name + "_Y_PITCH", dims_padded.x()});
|
||||||
definitions.push_back({_name + "_Z_PITCH", toVectorMulString({dims_padded.x(), dims_padded.y()})});
|
definitions.push_back({_name + "_Z_PITCH", toVectorMulString({dims_padded.x(), dims_padded.y()})});
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <intel_gpu/primitives/convolution.hpp>
|
#include <intel_gpu/primitives/convolution.hpp>
|
||||||
#include <intel_gpu/primitives/data.hpp>
|
#include <intel_gpu/primitives/data.hpp>
|
||||||
#include <intel_gpu/primitives/reorder.hpp>
|
#include <intel_gpu/primitives/reorder.hpp>
|
||||||
|
#include <intel_gpu/primitives/grid_sample.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
@ -380,6 +381,66 @@ TEST(concat_gpu, mixed_input_types_5d) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TEST(concat_gpu, pooling_dynamic_input_no_exception) {
|
||||||
|
auto& engine = get_test_engine();
|
||||||
|
|
||||||
|
auto input0 = engine.allocate_memory({data_types::f32, format::bfyx, {1, 1, 8, 3}});
|
||||||
|
auto input1 = engine.allocate_memory({data_types::f32, format::bfyx, {1, 1, 8, 3}});
|
||||||
|
|
||||||
|
auto input_dyn_layout = layout{ ov::PartialShape{ 1, ov::Dimension(), 8, 2 }, data_types::f32, format::bfyx };
|
||||||
|
auto input_actual_grid = layout{ ov::PartialShape{ 1, 3, 8, 2 }, data_types::f32, format::bfyx};
|
||||||
|
auto input_grid = engine.allocate_memory(input_actual_grid);
|
||||||
|
|
||||||
|
set_values(input_grid, { 13, 13, 13, 13, 15, 15,
|
||||||
|
16, 15, 16, 14, 13, 14,
|
||||||
|
13, 14, 13, 18, 16, 18,
|
||||||
|
16, 15, 16, 15, 18, 14 });
|
||||||
|
|
||||||
|
set_values<float>(input0, { 11, 12, 13,
|
||||||
|
14, 12, 12,
|
||||||
|
13, -14, 13,
|
||||||
|
13, -13, 15,
|
||||||
|
16, -16, -13,
|
||||||
|
-14, 12, 11,
|
||||||
|
16, -14, -13,
|
||||||
|
18, -13, -15, });
|
||||||
|
set_values<float>(input1, { 11, 12, 13,
|
||||||
|
15, 12, 12,
|
||||||
|
13, 14, 12,
|
||||||
|
13, 13, 15,
|
||||||
|
12, 14, 13,
|
||||||
|
14, 17, 18,
|
||||||
|
13, 14, 11,
|
||||||
|
13, 13, 15 });
|
||||||
|
|
||||||
|
GridSampleOp::Attributes attributes(false, GridSampleOp::InterpolationMode::NEAREST, GridSampleOp::PaddingMode::ZEROS);
|
||||||
|
|
||||||
|
layout reorder_layout(data_types::f32, format::yxfb, {7, 2, 2, 1});
|
||||||
|
topology topology(input_layout("input0", input0->get_layout()),
|
||||||
|
input_layout("input1", input1->get_layout()),
|
||||||
|
input_layout("input_dyn", input_dyn_layout),
|
||||||
|
grid_sample("grid_sample", { input_info("input0"), input_info("input_dyn") }, attributes),
|
||||||
|
pooling("pool0", input_info("grid_sample"), pooling_mode::max, {2, 2}, {1, 1}),
|
||||||
|
pooling("pool1", input_info("input1"), pooling_mode::max, {2, 2}, {1, 1}),
|
||||||
|
concatenation("concat",
|
||||||
|
{ input_info("pool0"), input_info("pool1") },
|
||||||
|
1,
|
||||||
|
data_types::f32,
|
||||||
|
padding{{0, 0, 0, 0}, 0}),
|
||||||
|
reorder("reorder", input_info("concat"), reorder_layout));
|
||||||
|
ov::intel_gpu::ExecutionConfig config = get_test_default_config(engine);
|
||||||
|
config.set_property(ov::intel_gpu::optimize_data(true));
|
||||||
|
config.set_property(ov::intel_gpu::allow_new_shape_infer(true));
|
||||||
|
|
||||||
|
network network(engine, topology, config);
|
||||||
|
network.set_input_data("input0", input0);
|
||||||
|
network.set_input_data("input1", input1);
|
||||||
|
network.set_input_data("input_dyn", input_grid);
|
||||||
|
|
||||||
|
EXPECT_NO_THROW(network.execute());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(concat_gpu, i8_optimization_with_pool) {
|
TEST(concat_gpu, i8_optimization_with_pool) {
|
||||||
auto& engine = get_test_engine();
|
auto& engine = get_test_engine();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user