Stage

Applicability

Product

Supported or Not

Atlas A3 training products / Atlas A3 inference products

Atlas A2 training products / Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference products

Atlas training products

Header File/Library File

  • Header file: #include <ge/fusion/pass/fusion_pass_reg.h>
  • Library file: libge_compiler.so

Function Usage

Defines the fusion pass phase.

Note: The common fusion pass cannot be registered in the kAfterAssignLogicStream phase, and the graph structure cannot be modified in this phase. If a pass is unexpectedly registered in this phase, it will be ignored.

Prototype

1
FusionPassRegistrationData &Stage(CustomPassStage stage)

Parameters

Parameter

Input/Output

Description

stage

Input

Execution phase of a customized fusion pass.

  • kBeforeInferShape (default value): The customized pass is executed before InferShape at the framework entry.
  • kAfterInferShape: The customized pass is executed after InferShape.

    If the customized pass is executed after InferShape, the pass must ensure the shape continuity after graph modification. You can use the InferShapeAndType API to ensure the continuity.

    1
    2
    3
    4
    5
    6
    7
        // 1. Obtain the output description of node1, an input node.
        TensorDesc output_desc;
        node1.GetOutputDesc(0, output_desc);
        // 2. Update the input description of node 2.
        node2.UpdateInputDesc(0, output_desc);
        // 3. Deduce InferShape from node 2.
        operator2.InferShapeAndType();
    
  • kAfterAssignLogicStream: The customized pass is executed after the logical stream assignment phase. In this phase, only the pass allocated by the logical stream is received. (For details about how to register the execution function of the pass allocated by the customized logical stream, see CustomAllocateStreamPassFn.) A graph cannot be modified in this phase. If the graph is modified in other scenarios, an error is reported during pass verification.
  • kAfterBuiltinFusionPass: The customized pass can be executed after the built-in original graph fusion pass is executed.

Returns

Object of class FusionPassRegistrationData.

Constraints

None