[BugFix][Transform] Normalize vectorized loop domains - #2819
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! 🚀 |
📝 WalkthroughWalkthroughLoop vectorization now normalizes nonzero-minimum or non-unit-step loops before planning and rewriting. Regression tests cover structural legalization and CUDA execution for vectorized loops beginning at a nonzero index. ChangesLoop vectorization normalization
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
Plan vector widths against zero-based loop domains while preserving the original minimum and step in rewritten accesses. This lets nonzero-min loops select an alignment-safe width instead of failing legalization or emitting misaligned vector loads. Co-authored-by: dingsg <shengge.ding@enflame-tech.com>
7ae230b to
8b21175
Compare
Fixes #2669
Summary
The vectorization planner assumed that every
T.vectorizedloop had a zero minimum. A loop such asT.vectorized(2, 6)reached legalization withmin=2and trippedICHECK(is_zero(fnode->min)). Planning from the unnormalized base could also select a width that was misaligned at the first real access.Legalization now plans on a zero-based domain and keeps the original minimum and step when rewriting accesses. Nonzero bounds are valid frontend input, so the normalization is handled in the TileLang transform rather than imposed on kernel authors.
Changes
Review Notes
[2, 6).Validation
testing/python/issue/test_tilelang_issue_vectorized_nonzero_min.pypassed on NVIDIA A100 and NVIDIA H100.testing/python/transform/test_tilelang_transform_legalize_vectorized_loop.pypassed.git diff --checkpassed.