Commit c671a2b7 authored by shssf's avatar shssf Committed by Robert Kimball

IntelGPU backend. Fix bug in Concat and small refactoring (#1668)

parent 015435d8
...@@ -73,6 +73,8 @@ ...@@ -73,6 +73,8 @@
using namespace std; using namespace std;
using namespace ngraph; using namespace ngraph;
using intelgpu_space = runtime::intelgpu::IntelGPULayout;
// This expands the op list in op_tbl.hpp into a list of enumerations that look like this: // This expands the op list in op_tbl.hpp into a list of enumerations that look like this:
// Abs, // Abs,
// Acos, // Acos,
...@@ -176,14 +178,10 @@ static void do_pooling_operation(cldnn::topology& topology, ...@@ -176,14 +178,10 @@ static void do_pooling_operation(cldnn::topology& topology,
{ {
arguments_check(op, 1, 1); arguments_check(op, 1, 1);
const cldnn::tensor output_size = const cldnn::tensor output_size = intelgpu_space::create_cldnn_tensor(get_output_shape(op));
runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(get_output_shape(op)); const cldnn::tensor input_offset = intelgpu_space::create_cldnn_offset(pad_below);
const cldnn::tensor size = intelgpu_space::create_cldnn_tensor(pool_shape);
const cldnn::tensor input_offset = const cldnn::tensor stride = intelgpu_space::create_cldnn_tensor(pool_strides);
runtime::intelgpu::IntelGPULayout::create_cldnn_offset(pad_below);
const cldnn::tensor size = runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(pool_shape);
const cldnn::tensor stride =
runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(pool_strides);
const cldnn::pooling cldnn_pooling( const cldnn::pooling cldnn_pooling(
get_output_name(op), get_input_name(op), mode, size, stride, input_offset, output_size); get_output_name(op), get_input_name(op), mode, size, stride, input_offset, output_size);
...@@ -409,14 +407,17 @@ bool runtime::intelgpu::IntelGPUBackend::compile(shared_ptr<Function> func) ...@@ -409,14 +407,17 @@ bool runtime::intelgpu::IntelGPUBackend::compile(shared_ptr<Function> func)
{ {
arguments_check(op, 1, 1); arguments_check(op, 1, 1);
} }
const size_t ngraph_tensor_dims = get_input_shape(op, 0).size();
// All input shapes must be the same
// if shape is empty (means Shape{}) in this case treat its size as 1
const size_t ngraph_tensor_dims =
get_input_shape(op).empty() ? 1 : get_input_shape(op).size();
const shared_ptr<op::Concat> concat_op = static_pointer_cast<op::Concat>(op); const shared_ptr<op::Concat> concat_op = static_pointer_cast<op::Concat>(op);
const size_t ngraph_concat_axis = concat_op->get_concatenation_axis(); const size_t ngraph_concat_axis = concat_op->get_concatenation_axis();
vector<cldnn::primitive_id> inputs; vector<cldnn::primitive_id> inputs;
cldnn::concatenation::concatenation_axis cldnn_axis = cldnn::concatenation::concatenation_axis cldnn_axis =
runtime::intelgpu::IntelGPULayout::get_cldnn_axis(ngraph_tensor_dims, intelgpu_space::get_cldnn_axis(ngraph_tensor_dims, ngraph_concat_axis);
ngraph_concat_axis);
for (auto const& input : op->get_inputs()) for (auto const& input : op->get_inputs())
{ {
...@@ -612,7 +613,7 @@ bool runtime::intelgpu::IntelGPUBackend::compile(shared_ptr<Function> func) ...@@ -612,7 +613,7 @@ bool runtime::intelgpu::IntelGPUBackend::compile(shared_ptr<Function> func)
(get_input_shape(op).size() == 1 && get_input_shape(op).at(0) == 1)) (get_input_shape(op).size() == 1 && get_input_shape(op).at(0) == 1))
{ {
const cldnn::tensor output_tensor_size = const cldnn::tensor output_tensor_size =
runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(get_output_shape(op)); intelgpu_space::create_cldnn_tensor(get_output_shape(op));
const cldnn::broadcast cldnn_broadcast( const cldnn::broadcast cldnn_broadcast(
get_output_name(op), get_input_name(op), output_tensor_size); get_output_name(op), get_input_name(op), output_tensor_size);
topology.add(cldnn_broadcast); topology.add(cldnn_broadcast);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment