[GPU] Remove scale primitive (#12893)

This commit is contained in:
Felix Dohyun Kim 2022-09-06 16:35:26 +09:00 committed by GitHub
parent 2108fe0dfc
commit 0b05eb2c67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
123 changed files with 101 additions and 773 deletions

View File

@ -1,74 +0,0 @@
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "primitive.hpp"
#include <vector>
namespace cldnn {
/// @addtogroup cpp_api C++ API
/// @{
/// @addtogroup cpp_topology Network Topology
/// @{
/// @addtogroup cpp_primitives Primitives
/// @{
/// @brief Performs elementwise product of input and scale_input.
/// @details Scale input dimension should be equal to input dimension or be 1 if it is not there.<br>
/// Input size : 2x3x4x5(BFYX)<br>
/// Possible scale inputs sizes :<br>
/// 2x3x4x5 - works the same as(axis == 0 == -4) in caffe<br>
/// 1x3x4x5 - works the same as(axis == 1 == -3) in caffe<br>
/// 1x1x4x5 - works the same as(axis == 2 == -2) in caffe<br>
/// 1x1x1x5 - works the same as(axis == 3 == -1) in caffe<br>
/// 1x1x1x1 - works the same as empty shape(scalar) in caffe<br>
/// When scale_input is the same as input, the behavior is the same as @ref eltwise with product operation.<br>
/// Performs scale over feature when the scale feature size is equal to input feature size.<br>
/// Performs scale over feature in batch when the scale feature and scale batch sizes are equal to input feature and input batch sizes.<br>
/// Optionally it can also add provided biases by providing bias data.<br>
struct scale : public primitive_base<scale> {
CLDNN_DECLARE_PRIMITIVE(scale)
/// @brief Constructs scale primitive without adding bias.
/// @param id This primitive id.
/// @param input Input primitive id.
/// @param scale_input Scale input primitive id with values needed for product computation.
scale(const primitive_id& id,
const primitive_id& input,
const primitive_id& scale_input, // should be bfyx or yxfb, where each dimension can be 1, if all dimensions
// are 1 then this is scalar
const optional_data_type& output_dt = {},
const padding& output_padding = padding())
: primitive_base(id, {input, scale_input}, output_padding, output_dt), bias("") {}
/// @brief Constructs scale primitive with optional adding bias.
/// @param id This primitive id.
/// @param input Input primitive id.
/// @param scale_input Scale input primitive id with values needed for product computation.
/// @param bias Primitive id containing bias data.
scale(const primitive_id& id,
const primitive_id& input,
const primitive_id& scale_input, // should be bfyx or yxfb, where each dimension can be 1, if all dimensions
// are 1 then this is scalar
const primitive_id& bias, // should be same size as scale_input
const optional_data_type& output_dt = {},
const padding& output_padding = padding())
: primitive_base(id, {input, scale_input}, output_padding, output_dt), bias(bias) {}
/// @brief Primitive id containing bias data.
primitive_id bias;
protected:
std::vector<std::reference_wrapper<const primitive_id>> get_dependencies() const override {
if (bias.empty())
return {};
else
return {bias};
}
};
/// @}
/// @}
/// @}
} // namespace cldnn

View File

@ -11,7 +11,6 @@
#include "crop_inst.h"
#include "eltwise_inst.h"
#include "reshape_inst.h"
#include "scale_inst.h"
#include "depth_to_space_inst.h"
#include "resample_inst.h"
#include "loop_inst.h"
@ -166,7 +165,7 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
// todo: we need add padding support for all optimized kernels to remove this condition
if (!input->is_type<pooling>() && !input->is_type<convolution>() && !input->is_type<quantize>() &&
!input->is_type<activation>() && !input->is_type<deconvolution>() &&
!input->is_type<concatenation>() && !input->is_type<crop>() && !input->is_type<scale>() && !input->is_type<eltwise>() &&
!input->is_type<concatenation>() && !input->is_type<crop>() && !input->is_type<eltwise>() &&
!input->is_type<resample>())
return false;

View File

@ -25,7 +25,6 @@
#include "permute_inst.h"
#include "reshape_inst.h"
#include "softmax_inst.h"
#include "scale_inst.h"
#include "resample_inst.h"
#include "depth_to_space_inst.h"
#include "space_to_depth_inst.h"
@ -267,7 +266,7 @@ void prepare_primitive_fusing::fuse_activations(program &p) {
!input.is_type<crop>() && !input.is_type<deconvolution>() && !input.is_type<eltwise>() &&
!input.is_type<fully_connected>() && !input.is_type<lrn>() && !input.is_type<normalize>() &&
!input.is_type<permute>() && !input.is_type<pooling>() && !input.is_type<reorder>() &&
!input.is_type<reshape>() && !input.is_type<roi_pooling>() && !input.is_type<scale>() &&
!input.is_type<reshape>() && !input.is_type<roi_pooling>() &&
!input.is_type<softmax>() && !input.is_type<resample>() && !input.is_type<mvn>() &&
!input.is_type<depth_to_space>() && !input.is_type<batch_to_space>() &&
!input.is_type<space_to_batch>() && !input.is_type<gather>() && !input.is_type<scatter_update>() && !input.is_type<shuffle_channels>() &&
@ -817,8 +816,6 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
should_fuse |= input_data.is_type<reduce>() && reduce_supports_fusings(input_data.as<reduce>());
should_fuse |= input_data.is_type<scale>();
should_fuse |= input_data.is_type<eltwise>() && eltwise_supports_fusings(input_data.as<eltwise>());
if (!should_fuse)
@ -827,71 +824,6 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
p.fuse_nodes(input_data, activation_node, &fusing_history);
};
auto fuse_scale_f = [&](scale_node& scale_node) {
if (scale_node.get_dependencies().empty())
CLDNN_ERROR_MESSAGE(scale_node.id(), "scale has invalid count of dependencies");
auto& input_data = scale_node.get_dependency(0);
if (input_data.get_users().size() != 1 || input_data.get_dependencies().empty())
return;
bool should_fuse = input_data.is_type<binary_convolution>() &&
all_ones(input_data.as<binary_convolution>().get_primitive()->dilation);
should_fuse |= input_data.is_type<convolution>() && conv_supports_fusings(input_data.as<convolution>());
should_fuse |= input_data.is_type<fully_connected>() && fc_supports_fusings(input_data.as<fully_connected>());
should_fuse |= input_data.is_type<gemm>() && gemm_supports_fusings(input_data.as<gemm>());
should_fuse |= input_data.is_type<pooling>() && pooling_supports_fusings(input_data.as<pooling>());
should_fuse |= input_data.is_type<resample>();
should_fuse |= input_data.is_type<mvn>() && mvn_supports_fusings(input_data.as<mvn>());
should_fuse |= input_data.is_type<normalize>() && data_type_traits::is_i8_u8(input_data.get_dependency(0).get_output_layout().data_type);
should_fuse |= input_data.is_type<deconvolution>();
should_fuse |= input_data.is_type<permute>();
should_fuse |= input_data.is_type<activation>();
should_fuse |= input_data.is_type<lrn>();
should_fuse |= input_data.is_type<gather>();
should_fuse |= input_data.is_type<gather_nd>();
should_fuse |= input_data.is_type<gather_elements>();
should_fuse |= input_data.is_type<scatter_update>();
should_fuse |= input_data.is_type<scatter_nd_update>();
should_fuse |= input_data.is_type<scatter_elements_update>();
should_fuse |= input_data.is_type<depth_to_space>();
should_fuse |= input_data.is_type<space_to_depth>();
should_fuse |= input_data.is_type<batch_to_space>();
should_fuse |= input_data.is_type<space_to_batch>();
should_fuse |= input_data.is_type<reduce>() && reduce_supports_fusings(input_data.as<reduce>());
should_fuse |= input_data.is_type<scale>();
should_fuse |= input_data.is_type<eltwise>() && eltwise_supports_fusings(input_data.as<eltwise>());
if (!should_fuse)
return;
p.fuse_nodes(input_data, scale_node, &fusing_history);
};
auto fuse_quantize_f = [&](quantize_node& quantize_node) {
auto& input_data = quantize_node.get_dependency(0);
if (input_data.get_users().size() != 1 || input_data.get_dependencies().empty())
@ -989,8 +921,6 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
should_fuse |= input_data.is_type<eltwise>() && eltwise_supports_fusings(input_data.as<eltwise>()) && quantize_node.get_scale_shift_opt();
should_fuse |= input_data.is_type<scale>() && quantize_node.get_scale_shift_opt();
should_fuse |= input_data.is_type<softmax>() &&
input_data.as<softmax>().get_primitive()->dimension == 1 &&
per_tensor_values;
@ -1034,7 +964,6 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
(parents[i]->is_type<batch_to_space>()) ||
(parents[i]->is_type<space_to_batch>()) ||
(parents[i]->is_type<eltwise>() && eltwise_supports_fusings(parents[i]->as<eltwise>())) ||
(parents[i]->is_type<scale>()) ||
(parents[i]->is_type<gather_nd>()) ||
(parents[i]->is_type<gather_elements>()) ||
(parents[i]->is_type<scatter_nd_update>()) ||
@ -1205,9 +1134,8 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
p.fuse_nodes(*fused_node, node, &fusing_history);
};
program_helpers::do_for_types<activation, scale, quantize, eltwise>(*node,
program_helpers::do_for_types<activation, quantize, eltwise>(*node,
fuse_activation_f,
fuse_scale_f,
fuse_quantize_f,
fuse_eltwise_f);
}

View File

@ -9,7 +9,6 @@
#include "reshape_inst.h"
#include "reorder_inst.h"
#include "binary_convolution_inst.h"
#include "scale_inst.h"
#include "eltwise_inst.h"
#include "data_inst.h"
#include "pass_manager.h"

View File

@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "intel_gpu/primitives/scale.hpp"
#include "intel_gpu/primitives/quantize.hpp"
#include "binary_convolution_inst.h"
#include "primitive_base.hpp"

View File

@ -66,7 +66,6 @@ void register_implementations() {
REGISTER_OCL(roi_align);
REGISTER_OCL(roi_pooling);
REGISTER_OCL(roll);
REGISTER_OCL(scale);
REGISTER_OCL(scatter_update);
REGISTER_OCL(scatter_nd_update);
REGISTER_OCL(scatter_elements_update);

View File

@ -61,7 +61,6 @@
#include "intel_gpu/primitives/roi_align.hpp"
#include "intel_gpu/primitives/roi_pooling.hpp"
#include "intel_gpu/primitives/roll.hpp"
#include "intel_gpu/primitives/scale.hpp"
#include "intel_gpu/primitives/scatter_elements_update.hpp"
#include "intel_gpu/primitives/scatter_nd_update.hpp"
#include "intel_gpu/primitives/scatter_update.hpp"
@ -143,7 +142,6 @@ REGISTER_OCL(reverse_sequence);
REGISTER_OCL(roi_align);
REGISTER_OCL(roi_pooling);
REGISTER_OCL(roll);
REGISTER_OCL(scale);
REGISTER_OCL(scatter_update);
REGISTER_OCL(scatter_elements_update);
REGISTER_OCL(scatter_nd_update);

View File

@ -1,152 +0,0 @@
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "scale_inst.h"
#include "primitive_base.hpp"
#include "impls/implementation_map.hpp"
#include "kernel_selector_helper.h"
#include "eltwise/eltwise_kernel_selector.h"
#include "eltwise/eltwise_kernel_base.h"
#include "intel_gpu/runtime/error_handler.hpp"
using namespace cldnn;
namespace cldnn {
namespace ocl {
struct scale_impl : typed_primitive_impl_ocl<scale> {
using parent = typed_primitive_impl_ocl<scale>;
using parent::parent;
std::unique_ptr<primitive_impl> clone() const override {
return make_unique<scale_impl>(*this);
}
explicit scale_impl(const scale_impl& other) : parent(other),
_has_bias_term(other._has_bias_term) {}
scale_impl(const scale_node& arg, const kernel_selector::kernel_data& kd) : parent(arg, kd) {
set_node_params(arg);
}
void set_node_params(const program_node& arg) override {
IE_ASSERT(arg.is_type<scale>());
const auto& node = arg.as<scale>();
_has_bias_term = node.bias_term();
}
protected:
kernel_arguments_data get_arguments(typed_primitive_inst<scale>& instance, int32_t split) const override {
kernel_arguments_data args = parent::get_arguments(instance, split);
args.inputs = {instance.input_memory_ptr(), instance.scale_memory()};
args.outputs = {instance.output_memory_ptr()};
if (_has_bias_term) {
args.inputs.push_back(instance.bias_memory());
}
return args;
}
public:
static primitive_impl* create(const scale_node& arg, const kernel_impl_params& impl_param) {
auto ew_params = get_default_params<kernel_selector::eltwise_params>(impl_param);
auto ew_optional_params =
get_default_optional_params<kernel_selector::eltwise_optional_params>(arg.get_program());
ew_params.inputs.push_back(convert_data_tensor(impl_param.input_layouts[1]));
ew_params.operations.push_back({{kernel_selector::eltwise_params::InputType::Buffer(0),
kernel_selector::eltwise_params::InputType::Buffer(1)},
kernel_selector::eltwise_mode::MUL});
if (arg.bias_term()) {
ew_params.inputs.push_back(convert_data_tensor(impl_param.input_layouts[2]));
ew_params.operations.push_back({{kernel_selector::eltwise_params::InputType::Intermediate(0),
kernel_selector::eltwise_params::InputType::Buffer(2)},
kernel_selector::eltwise_mode::ADD});
}
ew_params.layoutBased = true;
auto& kernel_selector = kernel_selector::eltwise_kernel_selector::Instance();
auto best_kernels = kernel_selector.GetBestKernels(ew_params, ew_optional_params);
CLDNN_ERROR_BOOL(arg.id(),
"Best_kernel.empty()",
best_kernels.empty(),
"Cannot find a proper kernel with this arguments");
auto scale = new scale_impl(arg, best_kernels[0]);
return scale;
}
private:
bool _has_bias_term = false;
};
namespace detail {
attach_scale_impl::attach_scale_impl() {
implementation_map<scale>::add(impl_types::ocl, scale_impl::create, {
std::make_tuple(data_types::f32, format::yxfb),
std::make_tuple(data_types::f16, format::yxfb),
std::make_tuple(data_types::i32, format::yxfb),
std::make_tuple(data_types::f32, format::byxf),
std::make_tuple(data_types::f16, format::byxf),
std::make_tuple(data_types::i32, format::byxf),
std::make_tuple(data_types::f32, format::bfyx),
std::make_tuple(data_types::f16, format::bfyx),
std::make_tuple(data_types::i32, format::bfyx),
std::make_tuple(data_types::u8, format::bfyx),
std::make_tuple(data_types::i8, format::bfyx),
std::make_tuple(data_types::f32, format::bfzyx),
std::make_tuple(data_types::f16, format::bfzyx),
std::make_tuple(data_types::i32, format::bfzyx),
std::make_tuple(data_types::u8, format::bfzyx),
std::make_tuple(data_types::i8, format::bfzyx),
std::make_tuple(data_types::f32, format::bfwzyx),
std::make_tuple(data_types::f16, format::bfwzyx),
std::make_tuple(data_types::i32, format::bfwzyx),
std::make_tuple(data_types::u8, format::bfwzyx),
std::make_tuple(data_types::i8, format::bfwzyx),
std::make_tuple(data_types::f32, format::b_fs_yx_fsv16),
std::make_tuple(data_types::f16, format::b_fs_yx_fsv16),
std::make_tuple(data_types::i32, format::b_fs_yx_fsv16),
std::make_tuple(data_types::u8, format::b_fs_yx_fsv16),
std::make_tuple(data_types::i8, format::b_fs_yx_fsv16),
std::make_tuple(data_types::f32, format::b_fs_zyx_fsv16),
std::make_tuple(data_types::f16, format::b_fs_zyx_fsv16),
std::make_tuple(data_types::i32, format::b_fs_zyx_fsv16),
std::make_tuple(data_types::i8, format::b_fs_zyx_fsv16),
std::make_tuple(data_types::u8, format::b_fs_zyx_fsv16),
std::make_tuple(data_types::f32, format::bs_fs_zyx_bsv16_fsv16),
std::make_tuple(data_types::f16, format::bs_fs_zyx_bsv16_fsv16),
std::make_tuple(data_types::i32, format::bs_fs_zyx_bsv16_fsv16),
std::make_tuple(data_types::f16, format::fs_b_yx_fsv32),
std::make_tuple(data_types::i32, format::fs_b_yx_fsv32),
std::make_tuple(data_types::f32, format::bs_fs_yx_bsv16_fsv16),
std::make_tuple(data_types::f16, format::bs_fs_yx_bsv16_fsv16),
std::make_tuple(data_types::i32, format::bs_fs_yx_bsv16_fsv16),
std::make_tuple(data_types::u8, format::b_fs_yx_fsv4),
std::make_tuple(data_types::i8, format::b_fs_yx_fsv4),
std::make_tuple(data_types::f16, format::b_fs_yx_fsv4),
std::make_tuple(data_types::f32, format::b_fs_yx_fsv4),
std::make_tuple(data_types::i32, format::b_fs_yx_fsv4),
std::make_tuple(data_types::u8, format::b_fs_yx_fsv32),
std::make_tuple(data_types::i8, format::b_fs_yx_fsv32),
std::make_tuple(data_types::f16, format::b_fs_yx_fsv32),
std::make_tuple(data_types::f32, format::b_fs_yx_fsv32),
std::make_tuple(data_types::i32, format::b_fs_yx_fsv32),
std::make_tuple(data_types::u8, format::b_fs_zyx_fsv32),
std::make_tuple(data_types::i8, format::b_fs_zyx_fsv32),
std::make_tuple(data_types::f16, format::b_fs_zyx_fsv32),
std::make_tuple(data_types::f32, format::b_fs_zyx_fsv32),
std::make_tuple(data_types::i32, format::b_fs_zyx_fsv32),
});
}
} // namespace detail
} // namespace ocl
} // namespace cldnn

View File

@ -9,7 +9,6 @@
#include "intel_gpu/runtime/tensor.hpp"
#include "intel_gpu/runtime/error_handler.hpp"
#include "intel_gpu/primitives/eltwise.hpp"
#include "intel_gpu/primitives/scale.hpp"
#include "intel_gpu/primitives/quantize.hpp"
#include "intel_gpu/primitives/activation.hpp"
#include "intel_gpu/primitives/primitive.hpp"

View File

@ -1,59 +0,0 @@
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
///////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "intel_gpu/primitives/scale.hpp"
#include "primitive_inst.h"
#include "kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_base.h"
#include <string>
#include <memory>
namespace cldnn {
template <>
struct typed_program_node<scale> : public typed_program_node_base<scale> {
private:
using parent = typed_program_node_base<scale>;
public:
using parent::parent;
typed_program_node(const std::shared_ptr<scale> prim, program& prog) : parent(prim, prog) {
support_padding_all(true);
}
program_node& input() const { return get_dependency(0); }
program_node& scale_in() const { return get_dependency(1); }
program_node& bias() const { return get_dependency(2); }
bool bias_term() const { return get_primitive()->bias.length() != 0; }
std::shared_ptr<kernel_selector::fuse_params> get_fuse_params() const override {
return std::make_shared<kernel_selector::scale_fuse_params>();
}
};
using scale_node = typed_program_node<scale>;
template <>
class typed_primitive_inst<scale> : public typed_primitive_inst_base<scale> {
using parent = typed_primitive_inst_base<scale>;
public:
static layout calc_output_layout(scale_node const& node, kernel_impl_params const& impl_param);
static std::string to_string(scale_node const& node);
public:
typed_primitive_inst(network& network, scale_node const& desc);
memory::ptr scale_memory() const { return dep_memory_ptr(1); }
memory::ptr bias_memory() const { return dep_memory_ptr(2); }
bool bias_term() const { return _node.as<scale>().bias_term(); }
};
using scale_inst = typed_primitive_inst<scale>;
} // namespace cldnn

View File

@ -31,7 +31,6 @@
#include "reshape_inst.h"
#include "quantize_inst.h"
#include "activation_inst.h"
#include "scale_inst.h"
#include "depth_to_space_inst.h"
#include "convolution_inst.h"
#include "concatenation_inst.h"
@ -1403,7 +1402,6 @@ void program::set_layout_optimizer_attributes(layout_optimizer& lo) {
prim.type() != cldnn::border::type_id() &&
prim.type() != cldnn::resample::type_id() &&
prim.type() != cldnn::crop::type_id() &&
prim.type() != cldnn::scale::type_id() &&
prim.type() != cldnn::depth_to_space::type_id() &&
prim.type() != cldnn::shuffle_channels::type_id() &&
(prim.type() != cldnn::mvn::type_id()
@ -1443,7 +1441,6 @@ void program::set_layout_optimizer_attributes(layout_optimizer& lo) {
prim.type() != cldnn::reshape::type_id() &&
prim.type() != cldnn::input_layout::type_id() &&
prim.type() != cldnn::activation::type_id() &&
prim.type() != cldnn::scale::type_id() &&
prim.type() != cldnn::softmax::type_id() &&
prim.type() != cldnn::fully_connected::type_id() &&
prim.type() != cldnn::generic_layer::type_id() &&

View File

@ -1,115 +0,0 @@
// Copyright (C) 2018-2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "scale_inst.h"
#include "primitive_type_base.h"
#include "intel_gpu/runtime/error_handler.hpp"
#include "json_object.h"
#include <string>
namespace cldnn {
primitive_type_id scale::type_id() {
static primitive_type_base<scale> instance;
return &instance;
}
layout scale_inst::calc_output_layout(scale_node const& node, kernel_impl_params const& impl_param) {
auto desc = impl_param.desc;
auto result = impl_param.get_non_padded_input_layout();
auto scale_layout = impl_param.get_non_padded_input_layout(1);
auto scale_x_size = scale_layout.spatial(0);
auto scale_y_size = scale_layout.spatial(1);
auto scale_z_size = scale_layout.spatial(2);
auto input_x_size = result.spatial(0);
auto input_y_size = result.spatial(1);
auto input_z_size = result.spatial(2);
if ((result.data_type == data_types::u8 || result.data_type == data_types::i8 || result.data_type == data_types::i32) &&
(scale_layout.data_type == data_types::f32 ||
scale_layout.data_type == data_types::f16))
result.data_type = scale_layout.data_type;
if (desc->output_data_type)
result.data_type = *desc->output_data_type;
if (impl_param.has_fused_primitives()) {
result.data_type = impl_param.get_fused_output_layout().data_type;
}
if (scale_x_size != 1) {
CLDNN_ERROR_NOT_EQUAL(desc->id, "Scale x size", scale_x_size, "input x size", input_x_size, "");
}
if (scale_y_size != 1) {
CLDNN_ERROR_NOT_EQUAL(desc->id, "Scale y size", scale_y_size, "input y size", input_y_size, "");
}
if (scale_z_size != 1) {
CLDNN_ERROR_NOT_EQUAL(desc->id, "Scale z size", scale_z_size, "input z size", input_z_size, "");
}
return result;
}
std::string scale_inst::to_string(scale_node const& node) {
auto desc = node.get_primitive();
auto node_info = node.desc_to_json();
auto& input = node.input();
auto& scale_input = node.scale_in();
std::stringstream primitive_description;
json_composite scale_info;
scale_info.add("input", input.id());
scale_info.add("scale input", scale_input.id());
node_info->add("scale info", scale_info);
node_info->dump(primitive_description);
return primitive_description.str();
}
scale_inst::typed_primitive_inst(network& network, scale_node const& node) : parent(network, node) {
auto scale_layout = node.scale_in().get_output_layout();
auto scale_format = scale_layout.format;
auto scale_batch_size = scale_layout.batch();
auto scale_feature_size = scale_layout.feature();
auto input_batch_size = node.input().get_output_layout().batch();
auto input_feature_size = node.input().get_output_layout().feature();
if (scale_batch_size != 1) {
CLDNN_ERROR_NOT_EQUAL(node.id(),
"Scale batch size",
scale_batch_size,
"input batch size",
input_batch_size,
"");
}
if (scale_feature_size != 1) {
CLDNN_ERROR_NOT_EQUAL(node.id(),
"Scale feature size",
scale_feature_size,
"input feature size",
input_feature_size,
"");
}
if (!argument.bias.empty()) {
auto bias_layout = node.bias().get_output_layout();
auto bias_format = bias_layout.format;
auto bias_raw_sizes = bias_layout.get_tensor().raw;
CLDNN_ERROR_NOT_PROPER_FORMAT(node.id(), "Scale format", scale_format.value, "bias format", bias_format);
for (size_t i = 0; i < bias_layout.get_tensor().raw.size(); ++i) {
if (scale_layout.get_tensor().raw[i] != bias_raw_sizes[i])
CLDNN_ERROR_MESSAGE(node.id(),
"Scale input size do not match bias size! Size index:" + std::to_string(i));
}
}
}
} // namespace cldnn

View File

@ -29,7 +29,6 @@ enum class KernelType {
ACTIVATION,
SOFT_MAX,
ELTWISE,
SCALE,
REORDER,
RESHAPE,
COUNT_NONZERO,

View File

@ -26,7 +26,6 @@ protected:
JitConstants GetJitConstants(const activation_params& params, DispatchData dispatchData) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return {FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION};
}
};

View File

@ -23,7 +23,6 @@ public:
JitConstants GetJitConstants(const activation_params& params, DispatchData dispatchData) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return {FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION};
}

View File

@ -23,7 +23,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -135,32 +135,6 @@ JitConstants BinaryConvolutionKernel1x1::GetFusedPrimitivesJitConstants(const bi
std::string e_mul = "e_mul" + toCodeString(op_id);
switch (fused_dep.GetType()) {
case KernelType::SCALE: {
std::string cast_type = (fused_dep.tensors[0].GetDType() == Datatype::F32) ? "as_float2" : "as_half2";
if (fused_dep.tensors.size() == 1) {
std::string var_name = fused_dep_codegen.GetInputVarName(0);
prepare_data += "\\\n\t" + vec_data_type + " " + var_name + " = " + cast_type +
get_aligned_load2(fused_dep_codegen.GetInputPtrName(0), "f_block*OC_BLOCK_SIZE") + ";";
eltwise_fused_ops += "\\\n\t" + data_type + " " + sc + " = (oc < 16) ? " +
get_shuffle(var_name + ".s0", "oc") + " : " + get_shuffle(var_name + ".s1", "oc") + ";";
eltwise_fused_ops += "\\\n\tres = res*" + sc + ";";
} else {
std::string var0_name = fused_dep_codegen.GetInputVarName(0);
std::string var1_name = fused_dep_codegen.GetInputVarName(1);
prepare_data += "\\\n\t" + vec_data_type + " " + var0_name + " = " + cast_type +
get_aligned_load2(fused_dep_codegen.GetInputPtrName(0), "f_block*OC_BLOCK_SIZE") + ";";
prepare_data += "\\\n\t" + vec_data_type + " " + var1_name + " = " + cast_type +
get_aligned_load2(fused_dep_codegen.GetInputPtrName(1), "f_block*OC_BLOCK_SIZE") + ";";
eltwise_fused_ops += "\\\n\t" + data_type + " " + sc +" = (oc < 16) ? " +
get_shuffle(var0_name + ".s0", "oc") + " : " + get_shuffle(var0_name + ".s1", "oc") + ";";
eltwise_fused_ops += "\\\n\t" + data_type + " " + sh + " = (oc < 16) ? " +
get_shuffle(var1_name + ".s0", "oc") + " : " + get_shuffle(var1_name + ".s1", "oc") + ";";
eltwise_fused_ops += "\\\n\tres = res*" + sc + " + " + sh + ";";
}
break;
}
case KernelType::QUANTIZE: {
std::string var_name_in = fused_dep_codegen.GetInputVarName(0);
std::string var_name_out = fused_dep_codegen.GetInputVarName(3);

View File

@ -139,27 +139,6 @@ JitConstants BinaryConvolutionKernel1x1_b_fs_yx_fsv16::GetFusedPrimitivesJitCons
std::string e_mul = "e_mul" + toCodeString(op_id);
switch (fused_dep.GetType()) {
case KernelType::SCALE: {
std::string cast_type = (fused_dep.tensors[0].GetDType() == Datatype::F32) ? "as_float" : "as_half";
if (fused_dep.tensors.size() == 1) {
std::string var_name = fused_dep_codegen.GetInputVarName(0);
prepare_data += "\\\n\t" + vec_data_type + " " + var_name + " = " + cast_type +
get_aligned_load(fused_dep_codegen.GetInputPtrName(0), "f_block*OC_BLOCK_SIZE") + ";";
eltwise_fused_ops += "\\\n\t" + data_type + " " + sc + " = " + get_shuffle(var_name, "oc") + ";";
eltwise_fused_ops += "\\\n\tres = res*" + var_name + ";";
} else {
std::string var0_name = fused_dep_codegen.GetInputVarName(0);
std::string var1_name = fused_dep_codegen.GetInputVarName(1);
prepare_data += "\\\n\t" + vec_data_type + " " + var0_name + " = " + cast_type +
get_aligned_load(fused_dep_codegen.GetInputPtrName(0), "f_block*OC_BLOCK_SIZE") + ";";
prepare_data += "\\\n\t" + vec_data_type + " " + var1_name + " = " + cast_type +
get_aligned_load(fused_dep_codegen.GetInputPtrName(1), "f_block*OC_BLOCK_SIZE") + ";";
eltwise_fused_ops += "\\\n\tres = res*" + var0_name + " + " + var1_name + ";";
}
break;
}
case KernelType::ACTIVATION: {
auto p = fused_dep.GetOpParams<activation_fuse_params>();
base_activation_params activation = p->param;

View File

@ -130,31 +130,6 @@ JitConstants BinaryConvolutionKernelGeneric::GetFusedPrimitivesJitConstants(cons
std::string e_mul = "e_mul" + toCodeString(op_id);
switch (fused_dep.GetType()) {
case KernelType::SCALE: {
std::string cast_type = (fused_dep.tensors[0].GetDType() == Datatype::F32) ? "as_float2" : "as_half2";
if (fused_dep.tensors.size() == 1) {
std::string var_name = fused_dep_codegen.GetInputVarName(0);
prepare_data += vec_data_type + " " + var_name + " = " + cast_type +
get_aligned_load2(fused_dep_codegen.GetInputPtrName(0), "f_block*OC_BLOCK_SIZE") + ";";
eltwise_fused_ops += data_type + " " + sc + " = (i < 16) ? " + var_name + ".s0" + " : " + var_name + ".s1;";
eltwise_fused_ops += "res = res*" + sc +";";
} else {
std::string var0_name = fused_dep_codegen.GetInputVarName(0);
std::string var1_name = fused_dep_codegen.GetInputVarName(1);
prepare_data += vec_data_type + " " + var0_name + " = " + cast_type +
get_aligned_load2(fused_dep_codegen.GetInputPtrName(0), "f_block*OC_BLOCK_SIZE") + ";";
prepare_data += vec_data_type + " " + var1_name + " = " + cast_type +
get_aligned_load2(fused_dep_codegen.GetInputPtrName(1), "f_block*OC_BLOCK_SIZE") + ";";
eltwise_fused_ops +=
data_type + " " + sc + " = (i < 16) ? " + var0_name + ".s0" + " : " + var0_name + ".s1;";
eltwise_fused_ops +=
data_type + " " + sh + " = (i < 16) ? " + var1_name + ".s0" + " : " + var1_name + ".s1;";
eltwise_fused_ops += "res = res*" + sc + " + " + sh + ";";
}
break;
}
case KernelType::QUANTIZE: {
std::string var_name_in = fused_dep_codegen.GetInputVarName(0);
std::string var_name_out = fused_dep_codegen.GetInputVarName(3);

View File

@ -36,7 +36,6 @@ protected:
// so that it can decide whether to fuse eltwise along with reorder.
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::REORDER };
}

View File

@ -28,7 +28,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
bool Validate(const Params& p, const optional_params& o) const override;

View File

@ -26,7 +26,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -32,7 +32,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -27,7 +27,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -49,7 +49,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -27,7 +27,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -32,7 +32,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -26,7 +26,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -30,7 +30,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -30,7 +30,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -30,7 +30,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -30,7 +30,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -32,7 +32,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -37,7 +37,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -30,7 +30,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -40,7 +40,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -31,7 +31,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -32,7 +32,6 @@ protected:
// so that it can decide whether to fuse eltwise along with reorder.
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::REORDER };
}

View File

@ -34,7 +34,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -51,7 +51,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -25,7 +25,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -28,7 +28,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -27,7 +27,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -24,7 +24,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -24,7 +24,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::REORDER,
FusedOpType::ACTIVATION };
}

View File

@ -19,7 +19,6 @@ public:
return {
FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE
};
}

View File

@ -29,7 +29,6 @@ public:
return {
FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE
};
}

View File

@ -94,10 +94,6 @@ struct eltwise_fuse_params : fuse_params {
eltwise_fuse_params(EltwiseMode mode) : fuse_params(KernelType::ELTWISE), mode(mode) {}
};
struct scale_fuse_params : fuse_params {
scale_fuse_params() : fuse_params(KernelType::SCALE) {}
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// EltwiseKernelBase
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -19,7 +19,6 @@ public:
return {
FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE
};
}

View File

@ -22,7 +22,6 @@ public:
protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -57,7 +57,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE };
}
JitConstants GetJitConstants(const fully_connected_params& params, const DispatchData& dispatchData) const override;

View File

@ -24,7 +24,6 @@ protected:
DispatchData SetDefault(const fully_connected_params& params, int autoTuneIndex = -1) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -22,7 +22,6 @@ public:
protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -22,7 +22,6 @@ public:
protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -26,7 +26,6 @@ protected:
JitConstants GetJitConstants(const fully_connected_params& params, const DispatchData& dispatchData) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -34,7 +34,6 @@ protected:
DispatchData SetDefault(const fully_connected_params& params, int autoTuneIndex = -1) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -23,7 +23,6 @@ public:
protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -34,7 +34,6 @@ public:
ParamsKey GetSupportedKey() const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -37,7 +37,6 @@ public:
ParamsKey GetSupportedKey() const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -32,7 +32,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE };
}
bool Validate(const Params& params, const optional_params& options) const override;

View File

@ -34,7 +34,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE };
}
bool Validate(const Params& params, const optional_params& options) const override;

View File

@ -21,7 +21,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE };
}
bool Validate(const Params& params, const optional_params& options) const override;

View File

@ -29,7 +29,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE,
FusedOpType::ELTWISE };
}
bool Validate(const Params& params, const optional_params& options) const override;

View File

@ -35,8 +35,7 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}

View File

@ -24,8 +24,7 @@ private:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}
DispatchData SetDefault(const mvn_params& params) const override;

View File

@ -34,8 +34,7 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}

View File

@ -25,8 +25,7 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}
std::string GetKernelName(const mvn_params&) const override;

View File

@ -50,8 +50,7 @@ protected:
KernelsData GetCommonKernelsData(const Params& params, const optional_params&) const;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::ACTIVATION,
FusedOpType::SCALE };
FusedOpType::ACTIVATION };
}
bool Validate(const Params& params, const optional_params&) const override;
Datatype GetActivationType(const normalize_params& params) const;

View File

@ -29,8 +29,7 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}
};

View File

@ -27,8 +27,7 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}
};

View File

@ -27,8 +27,7 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::QUANTIZE,
FusedOpType::ELTWISE,
FusedOpType::SCALE
FusedOpType::ELTWISE
};
}
};

View File

@ -23,7 +23,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -20,7 +20,6 @@ public:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -21,7 +21,6 @@ public:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -23,7 +23,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -21,7 +21,6 @@ public:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION};
}

View File

@ -27,7 +27,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -23,7 +23,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -23,7 +23,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -23,7 +23,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -21,7 +21,6 @@ public:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
ParamsKey GetSupportedKey() const override;

View File

@ -18,7 +18,6 @@ public:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -19,7 +19,6 @@ public:
ParamsKey GetSupportedKey() const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ELTWISE,
FusedOpType::ACTIVATION };
}

View File

@ -19,7 +19,6 @@ public:
JitConstants GetJitConstants(const reduce_params& params) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ELTWISE,
FusedOpType::ACTIVATION };
}

View File

@ -24,7 +24,6 @@ protected:
Datatype GetUnitType(const base_params& params) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ELTWISE,
FusedOpType::ACTIVATION };
}

View File

@ -19,7 +19,6 @@ public:
JitConstants GetJitConstants(const resample_params& params) const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ELTWISE,
FusedOpType::ACTIVATION };
}

View File

@ -33,7 +33,6 @@ public:
ParamsKey GetSupportedKey() const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -37,7 +37,6 @@ public:
ParamsKey GetSupportedKey() const override;
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE };
}

View File

@ -35,7 +35,6 @@ public:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}

View File

@ -23,7 +23,6 @@ protected:
return {
FusedOpType::ACTIVATION,
FusedOpType::ELTWISE,
FusedOpType::SCALE,
FusedOpType::QUANTIZE
};
}

View File

@ -41,7 +41,6 @@ protected:
std::vector<FusedOpType> GetSupportedFusedOps() const override {
return { FusedOpType::ELTWISE,
FusedOpType::QUANTIZE,
FusedOpType::SCALE,
FusedOpType::ACTIVATION };
}
};

View File

@ -1485,7 +1485,6 @@ bool FusedOpsCodeGenerator::CanPreloadData(const FusedOpsConfiguration& conf) co
std::string FusedOpsCodeGenerator::GetTypeStr() const {
switch (desc.GetType()) {
case KernelType::ELTWISE: return "eltwise";
case KernelType::SCALE: return "scale";
case KernelType::QUANTIZE: return "quantize";
case KernelType::ACTIVATION: return "activation";
case KernelType::UNKNOWN: throw std::runtime_error("Invalid type of fused operation. Fused op can't have type UNKNOWN");
@ -1578,7 +1577,7 @@ JitConstants FusedOpsCodeGenerator::MakeOpJitConstants(const FusedOpsConfigurati
const auto& out_type = desc.output_tensor.GetDType();
if (conf.load_type == FusedOpsConfiguration::LoadType::FEATURE_SHUFFLE &&
(desc.GetType() == KernelType::SCALE || desc.GetType() == KernelType::QUANTIZE)) {
desc.GetType() == KernelType::QUANTIZE) {
is_shuffled = true;
}
@ -1627,18 +1626,6 @@ JitConstants FusedOpsCodeGenerator::MakeOpJitConstants(const FusedOpsConfigurati
}
switch (desc.GetType()) {
case KernelType::SCALE: {
auto tmp_var = out_var + "_tmp";
if (desc.tensors.size() > 1) {
op_decls += "\\\n\t" + GetType(get_acc_t(), vec_size) + " " + tmp_var + " = "
+ input_vars[0] + " * " + input_vars[1] + " + " + input_vars[2] + ";";
} else {
op_decls += "\\\n\t" + GetType(get_acc_t(), vec_size) + " " + tmp_var + " = "
+ input_vars[0] + " * " + input_vars[1] + ";";
}
op_decls += "\\\n\t" + GetOutputType(vec_size) + " " + out_var + " = " + ConvertToOutputType(tmp_var, vec_size) + ";";
break;
}
case KernelType::ELTWISE: {
auto p = desc.GetOpParams<eltwise_fuse_params>();
if (!p)

View File

@ -101,7 +101,7 @@ TEST_P(batch_to_space_scale_act_eltwise_quantize_u8, basic) {
input_layout("input", get_input_layout(p)),
batch_to_space("batch_to_space", "input", p.block_shape, p.crops_begin, p.crops_end, p.output_size),
data("scale1_data", get_mem(get_per_channel_layout(p), -0.125f)),
scale("scale1", "batch_to_space", "scale1_data"),
eltwise("scale1", { "batch_to_space", "scale1_data" }, eltwise_mode::prod, p.default_type),
activation("actv1", "scale1", activation_func::relu),
data("eltw_data", get_mem(layout(p.default_type, p.input_format, p.output_size))),
eltwise("eltw", { "actv1", "eltw_data" }, eltwise_mode::sum, p.default_type),
@ -135,7 +135,7 @@ TEST_P(batch_to_space_scale_act_eltw, basic) {
input_layout("input", get_input_layout(p)),
batch_to_space("batch_to_space", "input", p.block_shape, p.crops_begin, p.crops_end, p.output_size),
data("scale1_data", get_mem(get_per_channel_layout(p), -0.125f)),
scale("scale1", "batch_to_space", "scale1_data"),
eltwise("scale1", { "batch_to_space", "scale1_data" }, eltwise_mode::prod, p.default_type),
activation("actv1", "scale1", activation_func::relu),
data("eltw_data", get_mem(layout(p.default_type, p.input_format, p.output_size))),
eltwise("eltw", { "actv1", "eltw_data" }, eltwise_mode::sum, p.default_type),

View File

@ -106,7 +106,7 @@ TEST_P(conv_bin_scale_activation, basic) {
data("weights", get_mem(get_weights_layout(p), -127, 127)),
data("scale_data", get_mem(get_per_channel_layout(p), 1.0f/p.kernel.count())),
binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups),
scale("scale", "bin_conv_prim", "scale_data"),
eltwise("scale", { "bin_conv_prim", "scale_data" }, eltwise_mode::prod, p.default_type),
activation("activation", "scale", activation_func::relu),
reorder("reorder_bfyx", "activation", p.default_format, data_types::f32)
);
@ -179,7 +179,7 @@ TEST_P(conv_bin_scale_conv_dw, dw_kernel_3x3_stride2) {
data("weights_dw", get_mem(dw_weights_layout, -127, 127)),
data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)),
binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups),
scale("scale", "bin_conv_prim", "scale_data"),
eltwise("scale", { "bin_conv_prim", "scale_data" }, eltwise_mode::prod, p.default_type),
convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation),
reorder("reorder_bfyx", "conv_dw", p.default_format, data_types::f32)
);
@ -202,7 +202,7 @@ TEST_P(conv_bin_scale_conv_dw, dw_kernel_3x3_stride1) {
data("weights_dw", get_mem(dw_weights_layout, -127, 127)),
data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)),
binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups),
scale("scale", "bin_conv_prim", "scale_data"),
eltwise("scale", { "bin_conv_prim", "scale_data" }, eltwise_mode::prod, p.default_type),
convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation),
reorder("reorder_bfyx", "conv_dw", p.default_format, data_types::f32)
);
@ -232,7 +232,7 @@ TEST_P(conv_bin_scale_conv_dw_prelu, dw_kernel_3x3_stride2) {
data("weights_dw", get_mem(dw_weights_layout, -127, 127)),
data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)),
binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups),
scale("scale", "bin_conv_prim", "scale_data"),
eltwise("scale", { "bin_conv_prim", "scale_data" }, eltwise_mode::prod, p.default_type),
convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation),
data("slope_data", get_mem(get_per_channel_layout(p))),
activation("activation", "conv_dw", "slope_data", activation_func::relu_negative_slope),
@ -258,7 +258,7 @@ TEST_P(conv_bin_scale_conv_dw_prelu, dw_kernel_3x3_stride1) {
data("weights_dw", get_mem(dw_weights_layout, -127, 127)),
data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)),
binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups),
scale("scale", "bin_conv_prim", "scale_data"),
eltwise("scale", { "bin_conv_prim", "scale_data" }, eltwise_mode::prod, p.default_type),
convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation),
data("slope_data", get_mem(get_per_channel_layout(p))),
activation("activation", "conv_dw", "slope_data", activation_func::relu_negative_slope),

Some files were not shown because too many files have changed in this diff Show More