-
Notifications
You must be signed in to change notification settings - Fork 2
[BugFix] Fix a bug in swizzle2D template by adding a default parameter #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nd streamline parser.py for better readability
|
👋 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! 🚀 |
WalkthroughAdded default template parameter Changes
Sequence Diagram(s)(omitted — changes do not introduce a new multi-component control flow requiring a sequence diagram) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ 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)
🔇 Additional comments (2)
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/tl_templates/cuda/threadblock_swizzle.htilelang/language/overrides/parser.py
🧰 Additional context used
🧬 Code graph analysis (1)
tilelang/language/overrides/parser.py (2)
tilelang/language/parser/parser.py (2)
bind_for_value(78-111)bind_assign_value(114-160)tilelang/language/tir/ir.py (1)
serial(25-66)
⏰ 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: format-check
🔇 Additional comments (3)
tilelang/language/overrides/parser.py (2)
167-170: LGTM! Clean refactoring that reduces nesting.Combining the two context managers into a single
withstatement improves readability while maintaining identical execution semantics.
198-206: LGTM! Consistent refactoring pattern.The consolidation of context managers follows the same clean pattern used in the fast path above, improving maintainability.
src/tl_templates/cuda/threadblock_swizzle.h (1)
26-27: Default offset parameter is correct and backward compatible.Both
rasterization2DColumnandrasterization2DRownow consistently definetemplate <int panel_width, int offset = 0>. All existing call sites instantiate or invoke these functions with only the panel_width argument, making them fully compatible with the new default parameter.
| namespace tl { | ||
|
|
||
| template <int panel_width, int offset> TL_DEVICE dim3 rasterization2DRow() { | ||
| template <int panel_width, int offset = 0> TL_DEVICE dim3 rasterization2DRow() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
rg -nP --type=cpp --type=cu --type=h -C3 'rasterization2DRow\s*<'Repository: tile-ai/tilescale
Length of output: 87
🏁 Script executed:
rg -nP --type=cpp --type=h -C3 'rasterization2DRow\s*<'Repository: tile-ai/tilescale
Length of output: 43
🏁 Script executed:
find . -name "threadblock_swizzle.h" -type f 2>/dev/null | head -20Repository: tile-ai/tilescale
Length of output: 151
🏁 Script executed:
cat -n ./src/tl_templates/cuda/threadblock_swizzle.h | head -50Repository: tile-ai/tilescale
Length of output: 2344
🏁 Script executed:
rg -n 'rasterization2DRow' --type cpp --type h -B2 -A2Repository: tile-ai/tilescale
Length of output: 956
🏁 Script executed:
rg 'rasterization2DRow\s*<' --type cpp --type h -C5Repository: tile-ai/tilescale
Length of output: 43
🏁 Script executed:
rg 'rasterization2DRow' --type cpp --type h | grep -v 'template' | head -20Repository: tile-ai/tilescale
Length of output: 43
🏁 Script executed:
rg 'rasterization2D' --type cpp --type h -C3Repository: tile-ai/tilescale
Length of output: 2416
🏁 Script executed:
rg 'rasterization2DRow' --type cpp --type h --glob '!threadblock_swizzle.h'Repository: tile-ai/tilescale
Length of output: 43
🏁 Script executed:
cat -n ./src/tl_templates/hip/threadblock_swizzle.hRepository: tile-ai/tilescale
Length of output: 2357
Address API inconsistency between CUDA and HIP implementations.
The default parameter offset = 0 was added to the CUDA version, but the HIP version in src/tl_templates/hip/threadblock_swizzle.h remains unchanged without the offset parameter. Both rasterization2DRow() and rasterization2DColumn() have diverged signatures. Update the HIP version to match the CUDA signature for API consistency, or document why they intentionally differ.
🤖 Prompt for AI Agents
In src/tl_templates/cuda/threadblock_swizzle.h around line 7 the CUDA template
signature template<int panel_width, int offset = 0> dim3 rasterization2DRow()
introduces a default offset parameter that the HIP implementation does not have;
to restore API consistency, update src/tl_templates/hip/threadblock_swizzle.h to
add the matching default template parameter (offset = 0) to the
rasterization2DRow() declaration (and make the same change for
rasterization2DColumn() if present) so both CUDA and HIP signatures match
exactly, keeping behavior identical and leaving a comment only if divergence is
intentional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tilelang/utils/sparse.py (1)
15-15: Excellent improvement for cache isolation.Version-aware cache paths prevent incompatible compiled extensions from different package versions from conflicting. This is the correct approach for managing native extension caches.
The only minor consideration is that old version caches will accumulate over time, but this is an acceptable tradeoff for cache safety.
Optional: Verify version format is filesystem-safe
While semantic versioning (e.g., "1.0.0") is typically safe for filesystem paths, you could optionally verify that
__version__doesn't contain problematic characters:#!/bin/bash # Verify that __version__ follows a safe format for filesystem paths python -c "from tilelang import __version__; import re; assert re.match(r'^[0-9]+\.[0-9]+\.[0-9]+', __version__), f'Version format may not be filesystem-safe: {__version__}'; print(f'Version format is safe: {__version__}')"
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tilelang/utils/sparse.py
🔇 Additional comments (1)
tilelang/utils/sparse.py (1)
9-11: LGTM!The import and comment clearly document the purpose of version-aware caching. This is a good practice for ensuring cache isolation between different package versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a4d8df2 to
189ed6f
Compare
…CI to address timeout issues
189ed6f to
75b67b0
Compare
|
closed as part of #40 |
Summary by CodeRabbit
Refactor
Chores
Tests / CI
✏️ Tip: You can customize this high-level summary in your review settings.