[Bugfix] Avoid reusing local.var allocations (#1678)#1683
[Bugfix] Avoid reusing local.var allocations (#1678)#1683LudovicoYIN wants to merge 1 commit intotile-ai:mainfrom
Conversation
|
👋 Hi! Thank you for contributing to the TileLang project. Please remember to run We appreciate you taking this step! Our team will review your contribution, and we look forward to your awesome work! 🚀 |
📝 WalkthroughWalkthroughFixed a storage allocation bug in TileLang where multiple Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧹 Recent nitpick comments
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (3)📚 Learning: 2026-01-06T05:20:51.649ZApplied to files:
📚 Learning: 2025-12-18T04:50:00.512ZApplied to files:
📚 Learning: 2025-11-14T07:56:11.098ZApplied to files:
🧬 Code graph analysis (2)src/transform/storage_rewrite.cc (3)
testing/python/issue/test_tilelang_issue_1678.py (4)
🔇 Additional comments (2)
✏️ Tip: You can disable this entire section by setting 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. Comment |
|
Thanks for your contribution! We dug a bit deeper and decided to disable storage reuse to address the root cause of this issue. Therefore, we are closing this PR. We look forward to your future contributions! |
|
Thanks for the explanation and review! Looking forward to contributing again. |
Summary
This PR fixes incorrect local variable reuse in StorageRewrite that caused
multiple T.alloc_var() declarations to be merged into a single local variable,
leading to unexpected overwrites in generated CUDA code.
Root Cause
StorageRewrite previously allowed reuse of local.var allocations.
However, T.alloc_var() is semantically closer to a distinct scalar declaration
rather than a reusable buffer.
When multiple alloc_var are present in the same scope, reuse breaks
declaration and initialization ordering, producing invalid code such as:
Fix
This change only affects local.var and does not impact buffer or shared memory reuse.
Tests
Related Issue
Fixes #1678
Summary by CodeRabbit
Release Notes
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.