Noncopyable temporary builder for a canonical Op; see Op for the example.
More...
#include <op.h>
|
| TVM_TIRX_DLL | OpDef (const ffi::String &name) |
| | Get or create the named Op without changing its documentation.
|
| |
| TVM_TIRX_DLL | OpDef (const ffi::String &name, const ffi::String &doc) |
| | Get or create the named Op and set its documentation.
|
| |
| | OpDef (const OpDef &)=delete |
| |
| OpDef & | operator= (const OpDef &)=delete |
| |
| | OpDef (OpDef &&)=delete |
| |
| OpDef & | operator= (OpDef &&)=delete |
| |
| Op | op () const |
| | Get the canonical operator.
|
| |
| TVM_TIRX_DLL OpDef & | add_arg (const ffi::String &name, const ffi::String &doc) |
| | Append a required value-argument descriptor.
|
| |
| template<typename AttrsType > |
| OpDef & | attrs_type () |
| | Set the attribute object type key and runtime index together.
|
| |
| TVM_TIRX_DLL OpDef & | set_attrs_type_key (const ffi::String &key) |
| | Resolve and set the attribute object type key and runtime index together.
|
| |
| TVM_TIRX_DLL OpDef & | add_ty_arg (const ffi::String &name, const ffi::String &doc) |
| | Append a descriptor for a type argument in Call.ty_args.
|
| |
| template<typename... Specs> |
| OpDef & | signature (const Specs &... specs) |
| | Register a complete typed Call signature and its validator.
|
| |
| template<typename ValueType > |
| OpDef & | set_attr (const ffi::String &attr_name, const ValueType &value, bool override=false) |
| | Register an extensible attribute, rejecting duplicates unless overridden.
|
| |
| OpDef & | set_validator (ffi::reflection::NativeFunctionView< void(const CallNode *)> validator, bool override=false) |
| | Register a validator that checks a Call with this operator.
|
| |
| TVM_TIRX_DLL OpDef & | reset_attr (const ffi::String &attr_name) |
| | Remove the current attribute value, with no priority fallback.
|
| |
Noncopyable temporary builder for a canonical Op; see Op for the example.
◆ OpDef() [1/4]
Get or create the named Op without changing its documentation.
- Parameters
-
| name | The canonical operator name. |
◆ OpDef() [2/4]
| TVM_TIRX_DLL tvm::OpDef::OpDef |
( |
const ffi::String & |
name, |
|
|
const ffi::String & |
doc |
|
) |
| |
Get or create the named Op and set its documentation.
- Parameters
-
| name | The canonical operator name. |
| doc | Operator documentation, replacing any existing documentation. |
◆ OpDef() [3/4]
| tvm::OpDef::OpDef |
( |
const OpDef & |
| ) |
|
|
delete |
◆ OpDef() [4/4]
| tvm::OpDef::OpDef |
( |
OpDef && |
| ) |
|
|
delete |
◆ add_arg()
| TVM_TIRX_DLL OpDef & tvm::OpDef::add_arg |
( |
const ffi::String & |
name, |
|
|
const ffi::String & |
doc |
|
) |
| |
Append a required value-argument descriptor.
- Parameters
-
| name | Argument name. |
| doc | Argument documentation. |
- Returns
- This builder. Without a variadic descriptor, this is part of the complete list.
◆ add_ty_arg()
| TVM_TIRX_DLL OpDef & tvm::OpDef::add_ty_arg |
( |
const ffi::String & |
name, |
|
|
const ffi::String & |
doc |
|
) |
| |
Append a descriptor for a type argument in Call.ty_args.
- Parameters
-
| name | Type-argument name. |
| doc | Type-argument documentation. |
- Returns
- This builder. Inference retains responsibility for type-argument counts.
◆ attrs_type()
template<typename AttrsType >
| OpDef & tvm::OpDef::attrs_type |
( |
| ) |
|
|
inline |
Set the attribute object type key and runtime index together.
- Template Parameters
-
| AttrsType | The attribute object node type. |
- Returns
- This builder.
◆ op()
| Op tvm::OpDef::op |
( |
| ) |
const |
|
inline |
Get the canonical operator.
- Returns
- A copied handle, safe after this builder dies.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ reset_attr()
Remove the current attribute value, with no priority fallback.
- Parameters
-
| attr_name | Attribute column name; missing columns and values are ignored. |
- Returns
- This builder. Existing cached maps observe the removal.
◆ set_attr()
template<typename ValueType >
| OpDef & tvm::OpDef::set_attr |
( |
const ffi::String & |
attr_name, |
|
|
const ValueType & |
value, |
|
|
bool |
override = false |
|
) |
| |
|
inline |
Register an extensible attribute, rejecting duplicates unless overridden.
- Template Parameters
-
| ValueType | The attribute value type. |
- Parameters
-
| attr_name | Attribute column name. |
| value | Non-null attribute value. |
| override | Whether to replace an existing value; no prior value is retained. |
- Returns
- This builder. Existing cached maps observe the new value.
◆ set_attrs_type_key()
Resolve and set the attribute object type key and runtime index together.
- Parameters
-
| key | A registered attribute object type key. |
- Returns
- This builder. An unknown key raises an error before modifying metadata.
◆ set_validator()
| OpDef & tvm::OpDef::set_validator |
( |
ffi::reflection::NativeFunctionView< void(const CallNode *)> |
validator, |
|
|
bool |
override = false |
|
) |
| |
|
inline |
Register a validator that checks a Call with this operator.
The callback accepts a const CallNode* and reports invalid input by throwing or returning an Expected<void> error. A native function pointer can be bound with NativeFunctionView::FromNative. A borrowed packed function may also be passed while it remains alive for this call. The setter retains an owning copy, so the original packed function may then be destroyed. Call::Validate invokes it explicitly; Relax normalization and well-formedness also validate when inputs are ready. A signature installs its generated validator only if none is registered, so a custom validator registered first takes precedence. Replacing a generated or custom validator requires override; duplicate registration without override raises ValueError. NativeFunctionView cannot be null.
- Parameters
-
| validator | Callback to install. |
| override | Whether to replace the current validator. |
- Returns
- This builder.
◆ signature()
template<typename... Specs>
| OpDef & tvm::OpDef::signature |
( |
const Specs &... |
specs | ) |
|
|
inline |
Register a complete typed Call signature and its validator.
Fixed descriptors require exactly one value/type argument each. A variadic tail accepts zero or more trailing arguments of its category. Validation throws on arity or class mismatch; it does not infer types or mutate the Call. Call::Validate invokes the validator separately from construction. Without call_attrs<T>, Call.attrs is unconstrained. Repeated registration replaces metadata but retains any existing validator, including a generated one. Replace the callback explicitly if its executable checks must change.
sig::arg("value"),
sig::arg<PrimExpr>("index"),
sig::var_args<PrimExpr>("rest"),
sig::ty_arg("T"),
sig::var_ty_args("Ts"),
sig::call_attrs<DictAttrsNode>());
Noncopyable temporary builder for a canonical Op; see Op for the example.
Definition op.h:440
OpDef & signature(const Specs &... specs)
Register a complete typed Call signature and its validator.
Definition op.h:514
The documentation for this class was generated from the following file: