This repository has been archived by the owner on Nov 25, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Arith] Updated BufferDomainTouched to use IRVisitorWithAnalyzer (ap…
…ache#11970) * [Arith] Allow binding of Var in IntSetAnalyzer The other four subanalyzers in `arith::Analyzer` can each be provided with variable bindings/constraints that are remembered internally. This adds the same capability to `IntSetAnalyzer`, rather than requiring users to independently track and maintain a `Map<Var, IntSet>` containing the domain of each variable, and applies bindings/constraints alongside the other subanalyzers. * [Arith] Updated IRVisitorWithAnalyzer to mimic IRMutatorWithAnalyzer Previously, `IRVisitorWithAnalyzer` did not allow subclassing, and could only be used to collect bounds of variables along an entire statement, and could not be used to perform scope-dependent analysis. This commit removes `final` from `IRVisitorWithAnalyzer` and provides the same scope-based constraints/bindings during iteration as are provided by `IRMutatorWithAnalyzer`. * [Arith] Moved IRVisitorWithAnalyzer to tvm::arith namespace Changing for consistency, since `IRVisitorWithAnalyzer` it is part of the `src/arith` directory and the analogous `IRMutatorWithAnalyzer` is already part of the `arith` namespace. * [Arith] Updated BufferDomainTouched to use IRVisitorWithAnalyzer This used the earlier changes to allow subclasses of `IRVisitorWithAnalyzer`, and to expose binding/constraints to `IntSetAnalyzer`. * Avoid accidental Bind with dynamic Range * [Arith] Do not visit SelectNode in IRVisitorWithAnalyzer Because both sides of a `Select` node are visited regardless of the condition, the `SelectNode::condition` should not be treated as a known value. * [Arith][IntSet] Track global and scope-dependent bounds separately Resolves a bug that was found in CI, where an earlier scope-dependent constraint was treated as a conflict by a later global bound. * [Arith] Recovery function for each subanalyzer This way, if a subanalyzer throws an exception during `EnterConstraint`, the other subanalyzers are still appropriately backed out of the constraint. * [Arith][IntSet] Use CanProve instead of CanProveGreaterEqual The `min_value - max_value` in the `CanProveGreaterEqual` argument can result in an exception being thrown for unsigned integers where subtraction would wrap. * [Arith] Allow vector expressions in IntSet::operator(PrimExpr) Since these are tracked when lowering expressions, should allow post-vectorization expressions. To maintain previous behavior, this only applies when using the automatically tracked `Map<Var, IntSet> dom_map_`. If an explicit domain map is passed, the previous behavior of raising an error for vectorized expressions still occurs. * Avoid comparisons between integer and handle datatypes * [Arith] IntSet, Combine() extension Previously, the Combine() method didn't handle values without a known lower bound, for boolean operators. * Added docstring * Naming consistency of `IntSetAnalyzer` methods. To be consistent with other subanalyzers, using "Update" when providing the analyzer with the same data structure as is used internally, and "Bind" used when providing it with something that must be converted to the internal data structure.
- Loading branch information