Expand description
Re-exports§
pub use attrs::*;pub use base::*;pub use expr::*;pub use function::*;pub use global_info::*;pub use location::*;pub use module::*;pub use op::*;pub use op_def::*;pub use stmt::*;pub use type::*;pub use type_def::*;pub use unique_name_supply::*;
Modules§
- attrs
- Attributes. Calls, functions and modules carry metadata as
Attrs: a typed attribute object of an operator, or aDictAttrsmap of named values. - base
- Registry functions held by name. An
EnvFunckeeps a registered global function with its name, so IR that refers to it serializes the name and resolves it again when loaded. - dtype
- Data types. A [
DLDataType] is the DLPack element type of a tensor or a primitive value; these functions build them as plain values, usable in constants, andPrimTypeis the IR type of one. - expr
- Expressions. Every expression is an
Exprthat carries its type;PrimExprandIntExprare expressions known to have a primitive or scalar integer type, the operands of arithmetic (inprim). - function
- Functions. Every function is a
BaseFunc, an expression that carries the function’s attributes; a dialect defines the function itself, such asFunction, and anIRModulebinds it to a name. - global_
info - Module-level information. A
GlobalInfois information anIRModuleholds besides its functions, kept by name inglobal_infos. - location
- Source locations. Every IR node carries a
Locationfor diagnostics: anUnknownLoc, aSourceLocspan in a source, or aCallSiteLocthat pairs a location with its caller’s. - module
- Modules. An
IRModuleis the unit of compilation, the input and output of passes: it maps eachGlobalVarto a function (BaseFunc), and carries module attributes and module-level information. - op
- Operators. An
Opis a registry entry named once per process and called through aCall;OpDefregisters one, and anOpAttrMapreads one attribute of every operator, such as its call effect. - op_def
- Operator registration. An
OpDefregisters anOpwith a signature ofsigdescriptors, from which its call validator is generated, and attribute values keyed by anAttrKey, such as the shared ones inop_attr. - prim
- Primitive expressions. Each node, such as
AddorRamp, is aPrimExprwhosenewonly checks its operand types; the functions ofop, which operators such as&x + 1call, also match the operand types and fold constants. - stmt
- Statements. Every statement is a
Stmt; the body of a loop, conditional or region is aSeqStmt, so a single statement given as a body is wrapped in one, and aBindbinds a variable for the statements after it in the enclosing body. - transform
- Pass infrastructure. A
Passtransforms anIRModuleunder the currentPassContext, whose instruments observe each pass it runs. - type
- Types. Every expression carries a
Type; aPrimTypetypes the primitive scalars and vectors that arithmetic works on, and a dialect extendsTypewith its own kinds, asTensorTypedoes. - type_
def - Type registration. An IR type defined in Rust with
rs_objectcallsregister_typein atvm_ffi::static_init_block!, so Python can construct it once its library loads. - unique_
name_ supply - Unique names. A
UniqueNameSupplyhands out names that do not collide with the ones it has given out or reserved, for building and rewriting IR.