tvm_tirx.tirx.structural.structural_walk_with_constraint_context#
- tvm_tirx.tirx.structural.structural_walk_with_constraint_context(root, callback, *, order='post')#
Walk a value structurally with its active symbolic facts.
The walk visits each occurrence as a tree. Sequence statements and lazy if_then_else arguments are visited directly, without callbacks on their intermediate arrays. Deduplication can use a pre-order callback that returns
tvm_ffi.WalkResult.SKIPon repeats.- Parameters:
root (Any) – Root value to traverse.
callback (callable) – Called as
callback(value, constraints)for each visited value. The second argument is the activetvm_tirx.sym.ConstraintContext; callbacks must not append to it. ReturnNoneortvm_ffi.WalkResult.ADVANCEto continue,tvm_ffi.WalkResult.SKIPto prune a pre-order subtree, ortvm_ffi.VisitInterrupt(payload)to stop traversal.order ({"post", "pre"}, optional) – Visit children before their parent (the default), or the parent before its children. A scoped node’s post-order callback sees the outer facts after its body scope has ended.
- Returns:
result (tvm_ffi.VisitInterrupt or None) – The interrupt returned by a callback, or
Noneif traversal completes.- Raises:
ValueError – If
orderis neither"pre"nor"post".