Skip to content

Commit

Permalink
Added add with convolution fusion
Browse files Browse the repository at this point in the history
  • Loading branch information
mryzhov committed Mar 13, 2023
1 parent dc705e3 commit 6cddb63
Show file tree
Hide file tree
Showing 6 changed files with 501 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/plugins/intel_gna/src/gna_transformations_pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "transformations/swap_input_matmul_gna.hpp"
#include "transformations/unfuse_reshape_and_transpose.hpp"
#include "transformations/utils/utils.hpp"
#include "transformations/fuse_conv_biasadd_activation.hpp"

#include "debug_new_pass.hpp"
#include "transformations/transpose_nchw.hpp"
Expand Down Expand Up @@ -124,6 +125,7 @@ void TransformationsPipeline::apply(const std::shared_ptr<ov::Model>& model,
manager.register_pass<ov::intel_gna::pass::GatherSinkingGeneral>();
manager.register_pass<ov::pass::ReshapeSequenceFusion>();
manager.register_pass<ov::pass::TransposeToReshape>();
manager.register_pass<ov::intel_gna::pass::GnaConvolutionFusion>();
manager.register_pass<ov::intel_gna::pass::RemoveInputsProcessing>(subgraph_cpu_map);
manager.register_pass<ov::intel_gna::pass::RemoveOutputsProcessing>(subgraph_cpu_map);
manager.register_pass<ov::pass::ConvertOpSet3ToOpSet2>();
Expand Down
19 changes: 19 additions & 0 deletions src/plugins/intel_gna/src/ops/gna_convolution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ void shape_infer(const ov::intel_gna::op::GNAConvolution* op,

} // namespace internal

/**
* @brief Activation modes for fused convolutions.
*
*/
enum class ActivationType { SIGMOID,
RELU,
TANH,
ABS,
LOG,
EXP,
SIGN,
CLAMP,
NO_ACTIVATION };

/// \brief Convolution with NHWC layout
///
class GNAConvolution : public ov::op::Op {
Expand Down Expand Up @@ -127,6 +141,9 @@ class GNAConvolution : public ov::op::Op {
void set_auto_pad(const ov::op::PadType& auto_pad) {
m_auto_pad = auto_pad;
}
bool has_add_node() const { return m_has_add_node; }
ActivationType get_activation() const { return m_activation_type; }
void set_activation(ActivationType activation_type) { m_activation_type = activation_type; }

/*
* TODO: for unit tests
Expand Down Expand Up @@ -166,6 +183,8 @@ class GNAConvolution : public ov::op::Op {
const ngraph::CoordinateDiff& pads_end,
const std::vector<T>& input_shapes,
std::vector<T>& output_shapes);
bool m_has_add_node;
ActivationType m_activation_type;
};
} // namespace op
} // namespace intel_gna
Expand Down
Loading

0 comments on commit 6cddb63

Please sign in to comment.