Repository navigation
[BugFix][CuTeDSL] Elect one grid-barrier leader per block - #3400
Conversation
Signed-off-by: Xucheng Zhou <aden1350@outlook.com>
|
👋 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! 🚀 |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: tile-ai/tilelang/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughThe CuTeDSL grid synchronization barrier now uses all three thread coordinates to identify the block leader. A new CUDA test checks synchronization across two blocks for four thread configurations. ChangesCuTeDSL grid synchronization
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue remains from this review; the change is ready for normal merge checks. 🚥 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 |
|
would you mind taking a look @lucifer1004 ? |
|
The PR is generally sound, but I don't know if it is the most appropriate place to put this test. What do you think @LeiWang1999 |
|
I think testing/python/language/ is a reasonable place for this test: it exercises the runtime semantics of T.sync_grid() through the public API. merged:) |
sync_grid()currently selects every thread withtid.x == 0. With a 2D/3D block, multiple threads therefore publish the same block's arrival, allowing the grid barrier to release before another block has written its data.Elect only physical thread
(0, 0, 0)by combining all three thread coordinates. The counter/generation protocol, fences and cooperative launch remain unchanged.The regression delays block 1 using a finite device-clock loop, then checks the cross-block result for
32,(32, 2),(32, 1, 2)and(16, 2, 2)threads, including repeated barrier reuse.Validation on RTX 5090, Python 3.12, Torch 2.11.0+cu130 and CuTeDSL 4.7.0:
-x(2D result[1, 3]instead of[3, 3]); fixed helper 4 passed, repeated in a second fresh process.grid_sync.pyis byte-identical to main at994b44e. The candidate selected only the changed native Python DSL helper; this is not a full current-main C++ rebuild.git diff --checkpass.With a normal source build and CuTeDSL installed:
Found while investigating @dajiaohuang's #3386 report, but this is a separate multidimensional-thread bug. It does not resolve the concurrent-stream shared-state issue or make a performance claim. AI-assisted, with independent native reproduction.
Summary
sync_grid()now elects physical thread(0, 0, 0)as the sole grid-barrier arrival publisher for each block. The counter/generation protocol, fences, and cooperative launch remain unchanged.Validation
[1, 3]instead of[3, 3].git diff --check, passed.