Fix false positive grid_swizzle_conflict validation for Triton swizzled 1D grids#32
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates Xe-Forge’s Triton static validator to avoid false positives for grid_swizzle_conflict by replacing a line-based heuristic with an AST-based grid dimensionality check, and adds regression tests for 1D vs 2D swizzled grids.
Changes:
- Replaced the line-count/comma heuristic for detecting 2D grids (when swizzling is present) with an AST-based analysis of
gridassignments. - Added regression tests to ensure a 1D swizzled grid is allowed and a 2D swizzled grid is rejected.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/xe_forge/core/validator.py |
Switches grid_swizzle_conflict detection from a string/line heuristic to AST-based detection for more accurate 1D vs 2D classification. |
tests/test_validator.py |
Adds tests covering allowed 1D swizzled grids and rejected 2D swizzled grids. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Signed-off-by: Weilin Xu <weilin.xu@intel.com>
Collaborator
Author
|
@sandlbn ready to review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the validator’s line-based grid heuristic with an AST-based check so it only flags actual 2D grid launches when
GROUP_SIZE_Mswizzling is present. The previous implementation incorrectly treated a 1D single-tuple grid lambda as 2D whenever the line contained multipletriton.cdiv(...)calls.It also adds regression coverage for both cases:
Claude Code was smart enough to identify this false positive result, but it is better to fix the bug.