Expand description
Registering operators from Rust: C++ OpDef, with its signature descriptors (sig) and
attribute keys (op_attr), whose chains a tvm_ffi::static_init_block! runs to define
operators, as C++ defines them in a TVM_FFI_STATIC_INIT_BLOCK.
Every hook an operator gets here is native, as the C++ ones are: a Rust function compiled into
the C ABI adapter that C++ NativeFunctionView calls through a function pointer, without
packing arguments. A signature generates its validator from its argument types, as C++
OpDef::signature does from sig::arg<T>; each signature is its own compiled function.
A tvm_ffi::static_init_block! is gathered at link time, wherever in the program or library
it is, and runs when it loads, as a C++ static init block does, so that once Python loads a
library built on this crate, by any means, it sees the operators and types the block defines
as it sees those of a C++ library. A block that several libraries of a process have, as each
links its own copy of a crate they share, runs once.
Modules§
- The operator attributes of the shared IR (C++
tvm::op_attr). The hooks,FInferTypeand the region ones, have setters of their own onOpDef. - Signature descriptors, for
OpDef::signature(C++sig::arg<T>and friends): the arguments an operator takes, with their documentation and the types a generated validator checks.
Structs§
- C++
ffi::reflection::AttrKey<T>: the name of an operator attribute and the type of its values, whichOpDef::set_attrtakes.op_attrandtirx::op_attrhave the keys C++ declares, andAttrKey::newnames another. - C++
OpDef: register a new operator from Rust.
Enums§
- The runtime effect of an operator call (C++
CallEffectKind), the value ofop_attr::CALL_EFFECT_KIND.