graph LR
ONNX_Frontend["ONNX Frontend"]
PyTorch_FX_Translator["PyTorch FX Translator"]
IR_Module["IR Module"]
Relax_Block_Builder["Relax Block Builder"]
Call_TIR_Operator["Call TIR Operator"]
Relax_Expression["Relax Expression"]
TIR_Primitive_Function["TIR Primitive Function"]
ONNX_Frontend -- "utilizes" --> Relax_Block_Builder
ONNX_Frontend -- "generates" --> Relax_Expression
PyTorch_FX_Translator -- "uses" --> Relax_Block_Builder
PyTorch_FX_Translator -- "creates" --> Relax_Expression
IR_Module -- "manages" --> Relax_Expression
IR_Module -- "manages" --> TIR_Primitive_Function
Relax_Block_Builder -- "adds functions to" --> IR_Module
Relax_Block_Builder -- "emits and manipulates" --> Relax_Expression
Relax_Block_Builder -- "invokes" --> Call_TIR_Operator
Call_TIR_Operator -- "invokes" --> TIR_Primitive_Function
Call_TIR_Operator -- "takes arguments from" --> Relax_Expression
Relax_Expression -- "is manipulated by" --> Relax_Block_Builder
Relax_Expression -- "is generated by" --> ONNX_Frontend
Relax_Expression -- "is generated by" --> PyTorch_FX_Translator
Relax_Expression -- "is contained within" --> IR_Module
TIR_Primitive_Function -- "is invoked by" --> Call_TIR_Operator
TIR_Primitive_Function -- "is managed by" --> IR_Module
The TVM Relax subsystem facilitates the high-level representation and manipulation of computational graphs. Frontend components like the ONNX Frontend and PyTorch FX Translator ingest external model formats, translating them into Relax Expressions. These expressions, the fundamental building blocks of the Relax IR, are then managed within the IR Module, which serves as the central container for all IR functions. The Relax Block Builder provides an imperative API for constructing and manipulating these Relax Expressions and adding them to the IR Module. For low-level tensor computations, the Call TIR Operator acts as a bridge, allowing Relax functions to invoke TIR Primitive Functions, which represent the core of TVM's compute abstraction. This interconnected system enables a flexible and efficient compilation pipeline from high-level model descriptions to optimized low-level code.
Acts as a frontend adapter, ingesting ONNX models, parsing their computational graphs, and translating ONNX operators and data into equivalent Relax expressions and functions.
Related Classes/Methods:
Serves as another frontend adapter, specifically translating PyTorch FX computational graphs into Relax IR, mapping PyTorch operations to Relax equivalents.
Related Classes/Methods:
The primary container for all TVM IR functions (Relax functions and TIR PrimFuncs), managing their collection and providing a unified view of the compiled model throughout the compilation stages.
Related Classes/Methods:
Provides an imperative, Python-based API for constructing Relax functions and binding blocks, acting as the primary tool for programmatically building and manipulating Relax IR.
Related Classes/Methods:
A core Relax operator that enables calling a TensorIR (TIR) PrimFunc from within a Relax function, serving as the bridge between the high-level Relax graph and the low-level TIR computations.
Related Classes/Methods:
Represents the fundamental building blocks of the Relax IR, including variables, constants, function calls, and control flow constructs. It is the core data structure for the high-level computational graph.
Related Classes/Methods:
Represents a primitive function in TensorIR, which describes low-level tensor computations. These functions are the targets of call_tir from Relax and are the core of TVM's compute abstraction.
Related Classes/Methods: