Skip to content

[Transform] Preserve tl.assume predicates that simplify to true - #3610

Open
sepcnt wants to merge 1 commit into
tile-ai:mainfrom
sepcnt:preserve-simplify-assumptions
Open

sepcnt wants to merge 1 commit into
tile-ai:mainfrom
sepcnt:preserve-simplify-assumptions

Conversation

@sepcnt

@sepcnt sepcnt commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Split assumption preservation out of #3265 for independent review.

Let $P$ be an assumption predicate and $\Gamma$ the current analyzer context. Simplifying $P$ to $\mathrm{true}$ establishes

$$ \Gamma \models P, $$

which does not imply unconditional validity, $\models P$. A later pass may use a different context $\Gamma'$ for which

$$ \Gamma' \not\models P. $$

Replacing $\mathrm{assume}(P)$ with $\mathrm{assume}(\mathrm{true})$ discards the explicit predicate that later passes could otherwise use.

Keep the original predicate when it simplifies to true. Other simplification results remain unchanged.

In the regression, the analyzer derives $n \ge 0$ from the buffer shape. This still allows

$$ \min(0,n)=0, $$

while preserving the explicit $\mathrm{assume}(n \ge 0)$ annotation.

Summary

  • Preserve the original tl.assume predicate when the current analyzer simplifies it to true. Other simplification results remain unchanged.
  • Extend test_buffer_shape_constraint to check that assume(n >= 0) remains explicit while min(0, n) simplifies to 0.

C++ style / lint notes

  • The PR changes C++, but the available evidence does not show changes to rules documented in docs/developer_guide/cpp_style.md.
  • CI runs the C++ API Style Audit (warning only). No audit results were provided.

Tests

  • Test execution results were not provided.

@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to the TileLang project.

Please remember to run pre-commit run --all-files in the root directory of the project to ensure your changes are properly linted and formatted. This will help ensure your contribution passes the format check.

We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between d99a7f3 and a6f944e.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 741bf8b and 95e3394.

📒 Files selected for processing: 2
  • src/transform/simplify.cc
  • testing/python/transform/test_tilelang_transform_simplify.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The simplifier now leaves a tl.assume node unchanged when its simplified predicate is constant one. The regression test checks that the assumption n >= 0 allows the store index to simplify to 0.

Changes: Assumption simplification

Layer / File(s) Summary
Preserve constant assumptions and test simplification
src/transform/simplify.cc, testing/python/transform/test_tilelang_transform_simplify.py
The simplifier updates the tl.assume attribute only when the simplified predicate is not constant one. The test adds n >= 0 to both functions and expects the store index to be 0.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: bug, arith

Suggested reviewers: siriusneo

Merge Risk: ⚪ Minimal · up to 95e33

No actionable merge risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving tl.assume predicates that simplify to true.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai
coderabbitai Bot requested a review from SiriusNEO October 22, 2026 11:18
@coderabbitai coderabbitai Bot added arith bug Something isn't working labels Oct 22, 2026
@sepcnt
sepcnt force-pushed the preserve-simplify-assumptions branch from 95e3394 to d99a7f3 Compare October 22, 2026 12:37
@sepcnt
sepcnt force-pushed the preserve-simplify-assumptions branch from d99a7f3 to a6f944e Compare October 22, 2026 15:47

@KellyFrog KellyFrog left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arith bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants