tvm
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
tvm::tirx::StructuralVisitorWithConstraintContextObj Class Reference

Visits values using their structural visit behavior while maintaining the constraint context relevant to each callback. More...

#include <structural_visit_with_constraint_context.h>

Inheritance diagram for tvm::tirx::StructuralVisitorWithConstraintContextObj:
Collaboration diagram for tvm::tirx::StructuralVisitorWithConstraintContextObj:

Public Types

using VisitorObjType = StructuralVisitorWithConstraintContextObj
 
using StateTupleType = std::tuple< const sym::ConstraintContext & >
 

Public Member Functions

 StructuralVisitorWithConstraintContextObj ()
 Construct a visitor using constraint-aware default descent.
 
void AppendConstraint (const sym::Constraint &constraint)
 Add a fact to the current scope, creating its child context on the first append.
 
template<typename F >
auto WithConstraintScope (F &&f) -> decltype(f())
 Run an Expected-returning callback in a constraint scope. Use AppendConstraint to add facts. Scopes without facts keep the incoming context. Success and visit interrupts restore the incoming position. Terminal errors propagate without restoration; discard the traversal context after failure.
 
ffi::Expected< ffi::Optional< ffi::VisitInterrupt > > DefaultVisitExpected (ffi::AnyView value) noexcept
 Descend with the sparse specialized hook, or the ordinary fallback. Call this from a Visit callback to descend its matched node exactly once. Calling it from that node's registered hook re-enters the same hook.
 
 TVM_FFI_DECLARE_OBJECT_INFO ("tirx.StructuralVisitorWithConstraintContext", StructuralVisitorWithConstraintContextObj, ffi::StructuralVisitorObj)
 

Public Attributes

sym::ConstraintContext constraints
 Active effective premises. Consumers must not append during traversal. Retain this handle and constraints->LocalSize() for a stable position, or use constraints->ToArray() for an independent sequence of handles. The context itself remains live.
 

Protected Member Functions

 StructuralVisitorWithConstraintContextObj (const ffi::StructuralVisitorVTable *vtable)
 
StateTupleType StateTuple () const noexcept
 

Detailed Description

Visits values using their structural visit behavior while maintaining the constraint context relevant to each callback.

See also
ffi::StructuralVisitor, sym::ConstraintContext

Member Typedef Documentation

◆ StateTupleType

◆ VisitorObjType

Constructor & Destructor Documentation

◆ StructuralVisitorWithConstraintContextObj() [1/2]

tvm::tirx::StructuralVisitorWithConstraintContextObj::StructuralVisitorWithConstraintContextObj ( )
inline

Construct a visitor using constraint-aware default descent.

◆ StructuralVisitorWithConstraintContextObj() [2/2]

tvm::tirx::StructuralVisitorWithConstraintContextObj::StructuralVisitorWithConstraintContextObj ( const ffi::StructuralVisitorVTable *  vtable)
inlineexplicitprotected

Member Function Documentation

◆ AppendConstraint()

void tvm::tirx::StructuralVisitorWithConstraintContextObj::AppendConstraint ( const sym::Constraint &  constraint)
inline

Add a fact to the current scope, creating its child context on the first append.

Parameters
constraintBinding, range, or predicate valid in the current scope.

◆ DefaultVisitExpected()

ffi::Expected< ffi::Optional< ffi::VisitInterrupt > > tvm::tirx::StructuralVisitorWithConstraintContextObj::DefaultVisitExpected ( ffi::AnyView  value)
inlinenoexcept

Descend with the sparse specialized hook, or the ordinary fallback. Call this from a Visit callback to descend its matched node exactly once. Calling it from that node's registered hook re-enters the same hook.

  • Bind and Assert add facts for later statements in the same sequence.
  • If, While, and lazy if_then_else add scalar boolean guards inside branches/bodies.
  • For and thread launch add ranges in their bodies; Let adds a binding in its body.
  • Binding values and loop bounds are visited before their facts are added.
  • Predicates retain their expressions (including likely). Only tirx.assume_always sets assume_always=true, guaranteeing truth throughout the containing scope, including mutations.
  • Branch predicates, binding values, range bounds, and explicit assume_always predicates are collected without effect filtering. Ordinary assertions require a pure condition. Only known positive loop steps yield ranges.
  • Binding values retain their original reads; eager Select adds no branch guards.
  • Call and RegionStmt use tirx::op_attr hooks with the complete containing node. Unregistered Ops use ordinary Call descent or isolated RegionStmt body scopes.

Semantic hooks assume well-formed IR. No analyzer is created. These expressions do not snapshot mutable reads: consumers need stable captured values or lifetime guarantees, invalidation, or skipped inference. An unchanged context does not imply unchanged memory. Do not use one visitor for overlapping traversals.

◆ StateTuple()

StateTupleType tvm::tirx::StructuralVisitorWithConstraintContextObj::StateTuple ( ) const
inlineprotectednoexcept

◆ TVM_FFI_DECLARE_OBJECT_INFO()

tvm::tirx::StructuralVisitorWithConstraintContextObj::TVM_FFI_DECLARE_OBJECT_INFO ( "tirx.StructuralVisitorWithConstraintContext"  ,
StructuralVisitorWithConstraintContextObj  ,
ffi::StructuralVisitorObj   
)

◆ WithConstraintScope()

template<typename F >
auto tvm::tirx::StructuralVisitorWithConstraintContextObj::WithConstraintScope ( F &&  f) -> decltype(f())
inline

Run an Expected-returning callback in a constraint scope. Use AppendConstraint to add facts. Scopes without facts keep the incoming context. Success and visit interrupts restore the incoming position. Terminal errors propagate without restoration; discard the traversal context after failure.

Member Data Documentation

◆ constraints

sym::ConstraintContext tvm::tirx::StructuralVisitorWithConstraintContextObj::constraints

Active effective premises. Consumers must not append during traversal. Retain this handle and constraints->LocalSize() for a stable position, or use constraints->ToArray() for an independent sequence of handles. The context itself remains live.


The documentation for this class was generated from the following file: