Commit 8908c9df authored by shssf's avatar shssf Committed by Robert Kimball

IntelGPUBackend: const, div, maxpool and max operations (#1234)

* IntelGPUBackend: const, div, maxpool and max operations

* IntelGPUBackend: negative, abs, relu, sqrt, tanh and substract operations

* Update intelgpu_backend.cpp
parent e2255fbd
......@@ -20,6 +20,7 @@
#include <memory>
#include <CPP/engine.hpp>
#include <CPP/network.hpp>
#include "ngraph/runtime/backend.hpp"
......
......@@ -73,18 +73,39 @@ cldnn::data_types
else
{
ostringstream os;
os << "IntelGPUTensorView::get_cldnn_type: Unknown type " << element_type;
os << "IntelGPULayout::get_cldnn_type: Unknown type " << element_type;
throw std::invalid_argument(os.str());
}
}
cldnn::tensor runtime::intelgpu::IntelGPULayout::create_cldnn_tensor(const Shape& element_shape)
{
std::vector<size_t> idx(4, 1);
size_t index = 0;
for (auto i = element_shape.rbegin(); i != element_shape.rend() && index < 3; ++i, ++index)
{
idx.at(index) = *i;
}
if (element_shape.size() > 3)
{
idx.at(3) =
accumulate(element_shape.rbegin() + 3, element_shape.rend(), 1, multiplies<size_t>());
}
//Parameters for this ctor: batch, feature, spatial_x, spatial_y
const cldnn::tensor tns(idx.at(3), idx.at(2), idx.at(0), idx.at(1));
return tns;
}
cldnn::layout runtime::intelgpu::IntelGPULayout::create_cldnn_layout(
const ngraph::element::Type& element_type, const Shape& element_shape)
{
const size_t mem_size = shape_size(element_shape);
const cldnn::data_types data_type = get_cldnn_type(element_type);
const cldnn::tensor tensor(1, mem_size, 1, 1);
const cldnn::format::type format = cldnn::format::yxfb;
const cldnn::format::type format = cldnn::format::bfyx;
const cldnn::tensor tensor = create_cldnn_tensor(element_shape);
return cldnn::layout(data_type, format, tensor);
}
......@@ -17,6 +17,7 @@
#pragma once
#include <CPP/layout.hpp>
#include <CPP/tensor.hpp>
#include "ngraph/descriptor/layout/tensor_view_layout.hpp"
......@@ -48,6 +49,7 @@ public:
static cldnn::data_types get_cldnn_type(const ngraph::element::Type& element_type);
static cldnn::layout create_cldnn_layout(const ngraph::element::Type& element_type,
const Shape& element_shape);
static cldnn::tensor create_cldnn_tensor(const Shape& element_shape);
private:
Strides strides;
......
......@@ -41,7 +41,7 @@ runtime::intelgpu::IntelGPUTensorView::IntelGPUTensorView(const ngraph::element:
if (nullptr != memory_pointer)
{
ocl_memory = make_shared<cldnn::memory>(
cldnn::memory::attach<void>(layout, memory_pointer, layout.get_linear_size()));
cldnn::memory::attach<void>(layout, memory_pointer, layout.bytes_count()));
}
else
{
......
......@@ -17,11 +17,9 @@
#pragma once
#include <CPP/engine.hpp>
#include <CPP/layout.hpp>
#include <CPP/memory.hpp>
#include "ngraph/runtime/tensor_view.hpp"
#include "ngraph/type/element_type.hpp"
namespace ngraph
{
......@@ -56,7 +54,5 @@ public:
cldnn::memory* get_data_ptr() { return ocl_memory.get(); }
private:
cldnn::data_types get_cldnn_type(const ngraph::element::Type& element_type) const;
std::shared_ptr<cldnn::memory> ocl_memory;
};
ab
abc
abc_int64
abs
acos
......@@ -18,11 +16,10 @@ avg_pool_2d_2channel_2image_padded_3x3_strided
avg_pool_2d_2channel_2image_padded_3x3_strided_uneven
avg_pool_2d_2channel_2image_padded_only_above
avg_pool_2d_2channel_2image_padded_only_below
backwards_abc
avg_pool_3d
backwards_abs
backwards_acos
backwards_add
backwards_add_nested
backwards_asin
backwards_atan
backwards_avgpool_n1_c1_hw2x2
......@@ -56,18 +53,17 @@ backwards_maxpool_n2_c1_hw5_3x3_str2_max
backwards_maxpool_n4c1h4w4_kh2kw2_sh1sw1
backwards_maxpool_n4_c1_hw4_2x2_max
backwards_minimum
backwards_multiply
backwards_negative
backwards_parameter
backwards_power
backwards_relu
backwards_replace_slice
backwards_reshape
backwards_reverse_3d_02
backwards_reverse_sequence_n3_c2_h3
backwards_reverse_sequence_n4d2c3h2w2
backwards_select
backwards_select_nested
backwards_sigmoid
backwards_sign
backwards_sin
backwards_sinh
......@@ -152,9 +148,7 @@ convolution_4d_4items_strided_dilated_padded_same
convolution_outlining
cos
cosh
divide
divide_adjoint_stability
divide_by_zero_float32
divide_by_zero_int32
dot_0_0
dot1d
......@@ -176,8 +170,6 @@ equal
exp
floor
function_call
function_name
fuse_max_with_constant_zero_input_as_relu
greater
greatereq
kahan_sum_3d_to_vector
......@@ -193,20 +185,16 @@ max_3d_to_matrix_least_sig
max_3d_to_matrix_most_sig
max_3d_to_scalar
max_3d_to_vector
maximum
max_matrix_cols_zero
max_matrix_columns
max_matrix_rows
max_matrix_rows_zero
max_matrix_to_scalar_zero_by_zero
max_pool_1d_1channel_1image
max_pool_1d_1channel_2image
max_pool_1d_2channel_2image
max_pool_2d_1channel_1image_overpadded
max_pool_2d_1channel_1image_padded
max_pool_2d_1channel_1image_padded_negative_values
max_pool_2d_1channel_1image_strided
max_pool_2d_2channel_2image
max_pool_3d
max_to_scalar
max_trivial
max_trivial_5d
......@@ -226,10 +214,10 @@ min_to_scalar
min_trivial
min_trivial_5d
min_vector_zero
mkldnn_layouts
multiple_backends
multiple_result
negative
node_name
not
notequal
numeric_double_inf
......@@ -257,7 +245,6 @@ pad_interior_1d
pad_interior_exterior_1d
pad_interior_exterior_2d
pad_interior_exterior_4d_2x0x3x2
parameter_as_output
power
product_3d_eliminate_zero_dim
product_3d_to_matrix_least_sig
......@@ -297,19 +284,7 @@ replace_slice_3d_strided_different_strides
replace_slice_matrix
replace_slice_scalar
replace_slice_vector
reshape_3d_transpose
reshape_4d_transpose
reshape_6d
reshape_m2m_dim_change_transpose
reshape_m2m_same
reshape_m2m_transpose
reshape_s2t
reshape_t2s_012
reshape_t2s_120
reshape_t2v_012
reshape_v2m_col
reshape_v2m_row
reshape_v2t_middle
reverse_0d
reverse_1d_0
reverse_1d_nochange
......@@ -328,12 +303,14 @@ reverse_3d_nochange
reverse_sequence_n2c3h4w2
reverse_sequence_n4c3h2w2
reverse_sequence_n4d2c3h2w2
scalar_constant_float32
scalar_constant_int64
select
select_and_scatter_3d_without_overlap
select_and_scatter_without_overlap
select_and_scatter_with_overlap
sigmoid_bprop_n1c1h4
sigmoid_n1c1h2w2
sigmoid_n1c1h4
sign
sin
sinh
......@@ -369,11 +346,8 @@ sum_trivial_5d
sum_vector_zero
tan
tanh
tensor_constant
tensor_constant_float32
tensor_constant_int64
tensor_constant_with_op
tensorview_custom_mem
validate_call_input_type
validate_call_output_type
zero_sized_abs
......
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