From 8dbb064e156e64c5b789964aa80dfb0d825e9dd7 Mon Sep 17 00:00:00 2001 From: sbinabdullah <49330057+sbinabdullah@users.noreply.github.com> Date: Mon, 13 Jul 2026 23:52:56 +0930 Subject: [PATCH 1/2] [Tests] Update test_adaptive_pooling_window expected IR for const-int-bound fix Followup to apache/tvm#19978: the const-int-bound modular-set fix correctly prevents the simplifier from over-folding the adaptive pool window extent. The previous expected IR used the simplified closed form (v_ax2 % 3 * 4 + 16) // 12 + 1, which was only reachable because the buggy bound let CanProve prove an invalid predicate. After the fix the generated IR retains the correct T.Select form, so update the expected IR to match and remove the xfail marker. --- tests/python/te/test_te_create_primfunc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/python/te/test_te_create_primfunc.py b/tests/python/te/test_te_create_primfunc.py index 48f9c1bf7b54..38eef4f79561 100644 --- a/tests/python/te/test_te_create_primfunc.py +++ b/tests/python/te/test_te_create_primfunc.py @@ -921,11 +921,11 @@ def tir_workload( # fmt: off adaptive_pool_sum = T.sblock_alloc_buffer((1, 1024, 12, 30)) for ax0, ax1, ax2, ax3 in T.grid(1, 1024, 12, 30): - with T.sblock("adaptive_pool_sum_1"): + with T.sblock("adaptive_pool_sum_l1"): v_ax0, v_ax1, v_ax2, v_ax3 = T.axis.remap("SSSS", [ax0, ax1, ax2, ax3]) T.reads(x[v_ax0, v_ax1, v_ax2 * 16 // 12:v_ax2 * 16 // 12 + ((v_ax2 % 3 * 4 + 16) // 12 + 1), v_ax3 * 40 // 30:v_ax3 * 40 // 30 + ((v_ax3 % 3 * 10 + 40) // 30 + 1)]) T.writes(adaptive_pool_sum[v_ax0, v_ax1, v_ax2, v_ax3]) - for rv0, rv1 in T.grid((v_ax2 % 3 * 4 + 16) // 12 + 1, (v_ax3 % 3 * 10 + 40) // 30 + 1): + for rv0, rv1 in T.grid(T.Select((v_ax2 * 16 + 4) % 12 == 0, (v_ax2 * 16 + 16) // 12, (v_ax2 * 16 + 16) // 12 + 1) - v_ax2 * 16 // 12, T.Select((v_ax3 * 40 + 10) % 30 == 0, (v_ax3 * 40 + 40) // 30, (v_ax3 * 40 + 40) // 30 + 1) - v_ax3 * 40 // 30): with T.sblock("adaptive_pool_sum"): v_ax0_1 = T.axis.spatial((v_ax0, v_ax0 + 1), v_ax0) v_ax1_1 = T.axis.spatial((v_ax1, v_ax1 + 1), v_ax1) @@ -943,7 +943,7 @@ def tir_workload( T.reads(adaptive_pool_sum[v_ax0, v_ax1, v_ax2, v_ax3]) T.writes(adaptive_pool_avg[v_ax0, v_ax1, v_ax2, v_ax3]) T.sblock_attr({"schedule_rule": "meta_schedule.adaptive_pool_avg"}) - adaptive_pool_avg[v_ax0, v_ax1, v_ax2, v_ax3] = adaptive_pool_sum[v_ax0, v_ax1, v_ax2, v_ax3] / (T.Cast("float32", (v_ax2 % 3 * 4 + 16) // 12 + 1) * T.Cast("float32", (v_ax3 % 3 * 10 + 40) // 30 + 1)) + adaptive_pool_avg[v_ax0, v_ax1, v_ax2, v_ax3] = adaptive_pool_sum[v_ax0, v_ax1, v_ax2, v_ax3] / (T.Cast("float32", T.Select((v_ax2 * 16 + 4) % 12 == 0, (v_ax2 * 16 + 16) // 12, (v_ax2 * 16 + 16) // 12 + 1) - v_ax2 * 16 // 12) * T.Cast("float32", T.Select((v_ax3 * 40 + 10) % 30 == 0, (v_ax3 * 40 + 40) // 30, (v_ax3 * 40 + 40) // 30 + 1) - v_ax3 * 40 // 30)) # fmt: on def te_workload(): From 46a676bf5212a7a2c9b82350544b63486e834182 Mon Sep 17 00:00:00 2001 From: Syeam Bin Abdullah <49330057+sbinabdullah@users.noreply.github.com> Date: Fri, 17 Jul 2026 13:46:57 +0930 Subject: [PATCH 2/2] [Tests] Update test_adaptive_pooling_window expected IR for const-int-bound fixRemove xfail marker and update expected IR to match the T.Select form produced after the const-int-bound fix in #19978.