This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 8312a17f87 [REFACTOR][Arith] Evaluate iterator domains through Var
maps (#20354)
8312a17f87 is described below
commit 8312a17f8734ddfd56e5f3977cd5df25b83ec49f
Author: Tianqi Chen <[email protected]>
AuthorDate: Tue Sep 15 21:06:17 2026 -0400
[REFACTOR][Arith] Evaluate iterator domains through Var maps (#20354)
Arithmetic evaluates integer sets over variables, so callers can supply
Var-keyed domains directly.
Remove the two IterVar-keyed EvalSet overloads, their projection helper,
and the unused arithmetic IterVar aliases. Reverse compute inline now
constructs the existing Var-keyed producer-domain map from each iterator
variable and its domain, preserving the existing coverage calculation.
---
include/tvm/arith/int_set.h | 20 --------------------
include/tvm/arith/int_solver.h | 2 --
src/arith/int_set.cc | 16 ----------------
src/s_tir/schedule/primitive/compute_inline.cc | 4 ++--
4 files changed, 2 insertions(+), 40 deletions(-)
diff --git a/include/tvm/arith/int_set.h b/include/tvm/arith/int_set.h
index 16a55bdf01..b2afdc8e9b 100644
--- a/include/tvm/arith/int_set.h
+++ b/include/tvm/arith/int_set.h
@@ -33,8 +33,6 @@
namespace tvm {
namespace arith {
-using tirx::IterVar;
-
class AnalyzerObj;
class Analyzer;
@@ -174,15 +172,6 @@ class IntSet : public ffi::ObjectRef {
* \return The converted map.
*/
ffi::Map<Var, IntSet> ConvertDomMap(const std::unordered_map<const VarNode*,
IntSet>& dom_map);
-/*!
- * \brief Find an symbolic integer set that contains all possible values of
- * e given the domain of each iteration variables.
- *
- * \param e The expression to be evaluated.
- * \param dom_map The domain of each variable.
- * \return An integer set that can cover all the possible values of e.
- */
-IntSet EvalSet(PrimExpr e, const ffi::Map<IterVar, IntSet>& dom_map);
/*!
* \brief Find an symbolic integer set that contains all possible values of
* e given the domain of each variables.
@@ -200,15 +189,6 @@ IntSet EvalSet(PrimExpr e, const ffi::Map<Var, IntSet>&
dom_map);
* \return An integer set that can cover all the possible values of e.
*/
IntSet EvalSet(PrimExpr e, const std::unordered_map<const VarNode*, IntSet>&
dom_map);
-/*!
- * \brief Find an symbolic integer set that contains is union over
- * all the possible conditional values in dom_map.
- *
- * \param r The initial range.
- * \param dom_map The domain of each variable.
- * \return An integer set that can cover all the possible values.
- */
-IntSet EvalSet(Range r, const ffi::Map<IterVar, IntSet>& dom_map);
/*!
* \brief Find an symbolic integer set that contains is union over
diff --git a/include/tvm/arith/int_solver.h b/include/tvm/arith/int_solver.h
index 92a790830e..ccca3dcbcb 100644
--- a/include/tvm/arith/int_solver.h
+++ b/include/tvm/arith/int_solver.h
@@ -36,8 +36,6 @@
namespace tvm {
namespace arith {
-using tirx::IterVar;
-
// According to experiments two best simplifications orders were can->rw and
rw->can->rw,
// but rw->can->rw is better for a couple of cases.
// Also we should end with rw because it factors multipliers out.
diff --git a/src/arith/int_set.cc b/src/arith/int_set.cc
index dd39c34775..34d96ad5b6 100644
--- a/src/arith/int_set.cc
+++ b/src/arith/int_set.cc
@@ -1044,14 +1044,6 @@ IntSet Intersect(const ffi::Array<IntSet>& sets) {
return IntervalSet(ana->Simplify(x->min_value), ana->Simplify(x->max_value));
}
-ffi::Map<Var, IntSet> ConvertDomMap(const ffi::Map<IterVar, IntSet>& dom_map) {
- ffi::Map<Var, IntSet> dmap;
- for (auto kv : dom_map) {
- dmap.Set(kv.first->var, kv.second);
- }
- return dmap;
-}
-
ffi::Map<Var, IntSet> ConvertDomMap(const std::unordered_map<const VarNode*,
IntSet>& dom_map) {
ffi::Map<Var, IntSet> dmap;
for (auto kv : dom_map) {
@@ -1077,10 +1069,6 @@ IntSet IntSet::Vector(PrimExpr x) {
}
}
-IntSet EvalSet(PrimExpr e, const ffi::Map<IterVar, IntSet>& dom_map) {
- return EvalSet(e, ConvertDomMap(dom_map));
-}
-
IntSet EvalSet(PrimExpr e, const std::unordered_map<const VarNode*, IntSet>&
dom_map) {
return EvalSet(e, ConvertDomMap(dom_map));
}
@@ -1148,10 +1136,6 @@ ExprIntSetMap EvalSetForEachSubExpr(PrimExpr e,
return m.expr_map;
}
-IntSet EvalSet(Range r, const ffi::Map<IterVar, IntSet>& dom_map) {
- return EvalSet(r, ConvertDomMap(dom_map));
-}
-
ffi::Map<Var, arith::IntSet> AsIntSet(const ffi::Map<Var, Range>& var_dom) {
ffi::Map<Var, arith::IntSet> result;
for (auto kv : var_dom) {
diff --git a/src/s_tir/schedule/primitive/compute_inline.cc
b/src/s_tir/schedule/primitive/compute_inline.cc
index f7f8c36f03..ed129d3768 100644
--- a/src/s_tir/schedule/primitive/compute_inline.cc
+++ b/src/s_tir/schedule/primitive/compute_inline.cc
@@ -817,9 +817,9 @@ class ReverseComputeInliner : public BaseInliner {
* \return Whether the consumer block iter domains are covered
*/
bool CheckConsumerCovered() {
- ffi::Map<IterVar, arith::IntSet> producer_iter_doms;
+ ffi::Map<Var, arith::IntSet> producer_iter_doms;
for (const IterVar& iter_var : producer_block_->iter_vars) {
- producer_iter_doms.Set(iter_var,
arith::IntSet::FromRange(iter_var->dom));
+ producer_iter_doms.Set(iter_var->var,
arith::IntSet::FromRange(iter_var->dom));
}
// For each block iter in the consumer block, find the corresponding
expression in the producer
for (const IterVar& iter : consumer_block_->iter_vars) {