interface ngraph::snippets::pass::AlignElementType

Overview

Wrap sequence of operations which doesn’t support execution on original element type by ConvertSaturation and reset element type for type relaxed nodes inside body to align element type between nodes. Example 1: More…

#include <align_element_type.hpp>

template AlignElementType: public ov::pass::ModelPass
{
    // construction

    AlignElementType(const ov::element::Type exec_type = ov::element::f32);

    // methods

    OPENVINO_RTTI("AlignElementType", "0");
    bool run_on_model(const std::shared_ptr<ngraph::Function>& m);

    static bool opNeedsAlignElementType(
        const std::shared_ptr<ov::Node>& n,
        const ov::element::Type exec_type = ov::element::f32
        );
};

Inherited Members

public:
    // typedefs

    typedef DiscreteTypeInfo type_info_t;

    // methods

    bool get_property(const PassPropertyMask& prop_mask) const;
    void set_name(const std::string& name);
    std::string get_name() const;
    void set_callback(const param_callback& callback);
    virtual void set_pass_config(const std::shared_ptr<PassConfig>& pass_config);
    std::shared_ptr<PassConfig> get_pass_config();
    bool m_transformation_callback(const std::shared_ptr<const Node>& node);
    bool transformation_callback(const std::shared_ptr<const Node>& node);
    virtual const type_info_t& get_type_info() const = 0;
    OPENVINO_RTTI("ov::pass::ModelPass");
    virtual bool run_on_function(std::shared_ptr<ov::Model> m);
    virtual bool run_on_model(const std::shared_ptr<ov::Model>& m);

Detailed Documentation

Wrap sequence of operations which doesn’t support execution on original element type by ConvertSaturation and reset element type for type relaxed nodes inside body to align element type between nodes. Example 1:

  • After FQ decomposition there may be Convert[U8/I8]. If after the Convert there are other operations that don’t support U8/I8, new ConvertSaturation[exec_type] will be inserted after the FQ decomposition to execute these operations on supported element type Example 2:

  • Input[I8] -> Unsupported I8 op -> Movement op -> Output[I8]. There will be inserted two ConvertSaturation:

    • ConvertSatiration[exec_type] before op which is unsupported I8

    • ConvertSaturation[I8] before Movement op to return original low precision. Note: We cannot just remove original Convert[I8/U8] in Example 1 because we should cover two things:

    • allow execution of operations on supported element type for them

    • keep computations mathematically equivalent to the original function Thus, for these cases we should have the following pipeline: FP32 -> Convert[I8/U8] -> Convert[FP32] -> FP32 Note: We shouldn’t call validate_and_infer_type() after Convert insertions to avoid element type conflicts on inputs of ops