Skip to content

[Bugfix] Improves the accuracy of dependency analysis in the storage access #1205

Merged
LeiWang1999 merged 2 commits intotile-ai:mainfrom
LeiWang1999:fix_1107
Nov 7, 2025
Merged

[Bugfix] Improves the accuracy of dependency analysis in the storage access #1205
LeiWang1999 merged 2 commits intotile-ai:mainfrom
LeiWang1999:fix_1107

Conversation

@LeiWang1999
Copy link
Member

@LeiWang1999 LeiWang1999 commented Nov 7, 2025

This pull request improves the accuracy of dependency analysis in the storage access visitor logic for if-statements. The main change ensures that memory accesses performed in the condition of an if statement are preserved and merged into the access summary for the entire if statement, allowing the planner to correctly insert synchronization when needed.

Enhancements to dependency analysis for if-statements:

  • In TileLangStorageAccessVisitor::VisitStmt_ (src/transform/storage_access.cc), accesses collected from the condition expression are now preserved instead of being cleared, ensuring they participate in dependency analysis.
  • The access summary from the condition is merged into the if-statement's access list, allowing the planner to insert a sync before the if-statement when necessary.

Summary by CodeRabbit

Bug Fixes

  • Fixed memory access tracking to properly preserve dependencies in conditional code paths, improving synchronization accuracy during code transformation.

…d maintainability. Organized includes, enhanced comments, and preserved access summaries during condition evaluations in IfThenElse statements. Adjusted handling of buffer accesses and thread invariance checks for better clarity.
@github-actions
Copy link

github-actions bot commented Nov 7, 2025

👋 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
Copy link
Contributor

coderabbitai bot commented Nov 7, 2025

Walkthrough

The change modifies IfThenElseNode handling in storage access analysis to preserve memory accesses derived from condition expressions. Previously discarded, these accesses are now captured and prepended to then-branch access lists, enabling proper dependency tracking and synchronization.

Changes

Cohort / File(s) Summary
IfThenElseNode condition access handling
src/transform/storage_access.cc
Changed to capture and preserve access entries from condition expressions instead of discarding them. Condition accesses are now prepended to then-branch results for dependency analysis and synchronization planning.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify the prepending logic correctly maintains access ordering and doesn't duplicate entries
  • Ensure condition accesses are captured before branch summarization occurs
  • Check that the change aligns with existing dependency analysis semantics

Poem

🐰 A rabbit hops through conditions with care,
No more lost accesses floating in air!
We capture, we prepend, we synchronize true,
Dependencies dance in the paths that we knew. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main change: preserving condition accesses in if-statement handling to improve dependency analysis accuracy in storage access tracking.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 556e87b and 110479a.

📒 Files selected for processing (1)
  • src/transform/storage_access.cc (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Quick Lint
🔇 Additional comments (2)
src/transform/storage_access.cc (2)

257-261: Excellent fix and clear documentation.

The change correctly preserves condition accesses that were previously discarded. Using std::move is efficient, and the detailed comments provide strong rationale with a concrete example of why this matters (write to shared memory followed by if-condition reading it).


274-278: Correct merging of condition accesses.

The implementation properly inserts condition accesses at the beginning of the if-statement's access list, maintaining the correct execution order (condition evaluated before branches). The empty check before insertion is a good efficiency practice.


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 and usage tips.

@LeiWang1999 LeiWang1999 merged commit c8ec346 into tile-ai:main Nov 7, 2025
7 checks passed
RubiaCx pushed a commit to RubiaCx/tilelang that referenced this pull request Nov 24, 2025
…access (tile-ai#1205)

* Refactor storage access visitor in TileLang to improve readability and maintainability. Organized includes, enhanced comments, and preserved access summaries during condition evaluations in IfThenElse statements. Adjusted handling of buffer accesses and thread invariance checks for better clarity.

* lint fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments