[Language] Unify contiguous stride construction using a single implem… - #3016
[Language] Unify contiguous stride construction using a single implem…#3016jjppp wants to merge 1 commit into
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! 🚀 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan includes up to 8 reviews per rolling hour; 7 remain after this review. 📝 WalkthroughWalkthrough
ChangesStride construction consistency
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This change centralizes stride construction without any identified current-head correctness or production risk; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
The Python frontend had 3 independent implementations of the same row-major stride computation, yet only
tilelang/language/proxy.py:TensorProxy._construct_stridesreturns(1,)when tensor with a rank-0 shape is passed in.This patch unifies the three python implementation of
construct_strides. The single source of truth now accepts anySequenceand iterates viareversed(shape), so it can also handle, e.g., FFI arrays returned bybuffer.shape.allow_prim_expris kept as-is.The rest two delegate to
construct_strides, using a function-local import.This matches the existing lazy-import convention already used elsewhere in proxy.py.
Fixes #3015
Summary
construct_strides.Sequence, including FFI-backed shapes.allow_prim_exprbehavior and rank-0 empty strides.TensorProxyandretrieve_strideto use the shared implementation.T.Tensor((), dtype)handling and validS[()]stores.PrimExpr, and rank-0 tensor cases.