Skip to content

Commit

Permalink
Initial pre-optimization passes enablement (openvinotoolkit#52)
Browse files Browse the repository at this point in the history
* [GPU] Enable trim_to_outputs for pre-optimization passes

Signed-off-by: Andrew Kwangwoong Park <[email protected]>

* [GPU] Enable handle_input_padding for pre-optimization passes

Signed-off-by: Andrew Kwangwoong Park <[email protected]>

* [GPU] Enable reverse_optional_nodes_outputs for pre-optimization passes

Signed-off-by: Andrew Kwangwoong Park <[email protected]>

* [GPU] Enable prepare_quantization for pre-optimization passes

Signed-off-by: Andrew Kwangwoong Park <[email protected]>

* [GPU] Enable progra::set_layout_optimizer_attributes and only part of layout_optimizer

Signed-off-by: Andrew Kwangwoong Park <[email protected]>
  • Loading branch information
andrew-k-park authored Mar 18, 2022
1 parent af2a6fa commit 63c9029
Show file tree
Hide file tree
Showing 118 changed files with 586 additions and 552 deletions.
2 changes: 1 addition & 1 deletion src/plugins/intel_gpu/include/intel_gpu/graph/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ struct program {
}

void run_graph_compilation();
#if 0 // TODO(Taylor) temporally removed for multiple output PoC to reduce scope
void pre_optimize_graph(bool is_internal);
#if 0 // TODO(Taylor) temporally removed for multiple output PoC to reduce scope
void post_optimize_graph(bool is_internal);
#endif
void cleanup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ struct activation : public primitive_base<activation> {
/// @param activation_func activation function.
/// @param additional_params additional params (slope/max_val/linear a,b).
activation(const primitive_id& id,
const primitive_id& input,
const input_info& input,
activation_func activation_function,
activation_additional_params additional_params = {0.f, 0.f},
const primitive_id& ext_prim_id = "",
const padding& output_padding = padding())
: primitive_base(id, {input}, ext_prim_id, output_padding),
: primitive_base(id, {input}, ext_prim_id, {output_padding}),
activation_function(activation_function),
additional_params(additional_params),
additional_params_input("") {}
Expand All @@ -104,12 +104,12 @@ struct activation : public primitive_base<activation> {
/// Input x dimension should be equal to input feature size (one value per channel. in case of linear is one pair per channel).
/// All other dimensions should be 1.
activation(const primitive_id& id,
const primitive_id& input,
const input_info& input,
const primitive_id& additional_params_input,
activation_func activation_function,
const primitive_id& ext_prim_id = "",
const padding& output_padding = padding())
: primitive_base(id, {input}, ext_prim_id, output_padding),
: primitive_base(id, {input}, ext_prim_id, {output_padding}),
activation_function(activation_function),
additional_params({0, 0}),
additional_params_input(additional_params_input) {}
Expand All @@ -126,10 +126,10 @@ struct activation : public primitive_base<activation> {
primitive_id additional_params_input;

protected:
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
std::vector<std::pair<std::reference_wrapper<const primitive_id>, int>> get_dependencies() const override {
if (additional_params_input.empty())
return {};
return {additional_params_input};
return {{std::ref(additional_params_input), 0}};
}
};
/// @}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ struct binary_convolution : public primitive_base<binary_convolution> {
/// @param pad_value Logical value of padding. Can be one of 3 values: 1 - pad bits equal to 1; -1 -> pad bits equal to 0; 0 -> pad is not counted
/// @param calc_precision Precision of intermediate accumulators
binary_convolution(const primitive_id& id,
const primitive_id& input,
const input_info& input,
const std::vector<primitive_id>& weights,
tensor stride = {1, 1, 1, 1},
tensor pad = {0, 0, 0, 0},
Expand All @@ -45,7 +45,7 @@ struct binary_convolution : public primitive_base<binary_convolution> {
data_types calc_precision = data_types::f32,
const primitive_id& ext_prim_id = "",
const padding& output_padding = padding())
: primitive_base(id, {input}, ext_prim_id, output_padding, optional_data_type {calc_precision}),
: primitive_base(id, {input}, ext_prim_id, {output_padding}, {optional_data_type {calc_precision}}),
pad(pad),
stride(stride),
dilation(dilation),
Expand Down Expand Up @@ -73,10 +73,10 @@ struct binary_convolution : public primitive_base<binary_convolution> {

int32_t split() const { return static_cast<int32_t>(weights.size()); }

std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
std::vector<std::reference_wrapper<const primitive_id>> ret;
std::vector<std::pair<std::reference_wrapper<const primitive_id>, int>> get_dependencies() const override {
std::vector<std::pair<std::reference_wrapper<const primitive_id>, int>> ret;
ret.reserve(weights.size());
for (auto& w : weights) ret.push_back(std::ref(w));
for (auto& w : weights) ret.push_back({std::ref(w), 0});
return ret;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ struct border : public primitive_base<border> {
/// @param border_value Value of elements which is used for paddings
/// @param output_padding Optional padding for output from primitive.
border(const primitive_id& id,
const primitive_id& input,
const input_info& input,
const tensor& left_top_sizes = {0, 0, 0, 0},
const tensor& right_bottom_sizes = {0, 0, 0, 0},
const border_type type = border_type::constant,
const float border_value = 0.0f,
const primitive_id& ext_prim_id = "",
const padding& output_padding = padding())
: primitive_base(id, {input}, ext_prim_id, output_padding),
: primitive_base(id, {input}, ext_prim_id, {output_padding}),
left_top_sizes(left_top_sizes),
right_bottom_sizes(right_bottom_sizes),
type(type),
Expand All @@ -87,7 +87,7 @@ struct border : public primitive_base<border> {
/// @param type Type of added border.
/// @param output_padding Optional padding for output from primitive.
border(const primitive_id& id,
const primitive_id& input,
const input_info& input,
const tensor& x_y_sizes,
const border_type type = border_type::constant,
const padding& output_padding = padding())
Expand Down
Loading

0 comments on commit 63c9029

Please sign in to comment.