AscIR
An AscIR consists of the following parts:
- Type: determines the AscIR computation type, which is the fundamental information for distinguishing various IRs.
- Input and output: define the numbers of inputs and outputs and the meaning of each input and output.
- Attribute: Strictly speaking, attributes are also inputs of AscIR. However, unlike inputs, attribute values need to be determined during AscGraph construction and cannot be changed in the subsequent execution process.
For example, the IR is defined as follows:
1 2 3 4 5 | REG_ASC_IR(Load) .Input("T") .Output("T") .Attr<Expression>(offset, 0) .DataType("T", {DT_FLOAT, DT_FLOAT16}); |
The preceding code defines an IR of the Load type. The IR has the following:
- One input of type DT_FLOAT or DT_FLOAT16
- One output of the same type as the input
- One attribute named offset of type int64_t, with the default value 0
In addition to the preceding information, the following additional information about the AscIR must be provided: supported input and output memory hardware types. (The memory hardware type must strictly meet all requirements defined by AscIR during GM or UB construction. Otherwise, errors may occur in the subsequent process.) Generally, AscIRs are classified into the following types:
- Computing: It includes Load and Add, which indicate that a certain type of hardware unit participates in the work.
- Memory: It indicates a block of memory, such as Data, Output, or Workspace.
Parent topic: AscIR and AscGraph