[Feat] Allow dangling producer in wasp pipeline planning (#1263)#1647
[Feat] Allow dangling producer in wasp pipeline planning (#1263)#1647LeiWang1999 merged 3 commits intotile-ai:mainfrom
Conversation
…nchronization logic
|
👋 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! 🚀 |
📝 WalkthroughWalkthroughThe producer emission path was modified to emit transformed producer statements when the corresponding release pattern is empty: the statement is appended, a warning is logged, and an early continue skips mbarrier insertion instead of asserting. Changes
Sequence Diagram(s)(Skipped — changes are localized and do not introduce a new multi-component control flow requiring a sequence diagram.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (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). (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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
testing/python/issue/test_tilelang_issue_1263.py (2)
4-7: Consider adding a docstring to explain the regression test.The test function lacks documentation explaining what regression it validates. Adding a brief docstring would help maintainers understand the test's purpose and the specific scenario from issue #1263 (compilation failure with pipelined loops containing dangling producers).
📝 Suggested docstring
def test_issue_1263_pipeline_no_consumer(): + """Regression test for issue #1263. + + Validates that pipelined loops compile successfully when they contain + 'dangling producers' (operations whose outputs are not consumed by + subsequent statements). Previously failed with error: "variables X are + used, but are not passed in as API arguments". + """ @tilelang.jit() def test_kernel(M, N):
18-22: Core test logic correctly validates the dangling producer scenario.The pipelined loop implements the exact regression scenario from issue #1263:
- Two-level indirection (
ids[i]→ids2[id]) creates the "longer chain" that triggered the bug- Buffer A is written but never consumed
- Buffer B is cleared but never used
Both are intentional "dangling producers" that validate the fix. Consider adding a brief inline comment explaining this is the expected behavior being tested.
💭 Optional clarifying comment
for i in T.Pipelined(4, num_stages=1): id = ids[i] id2 = ids2[id] + # A and B are dangling producers (outputs not consumed) - validates fix for #1263 T.copy(KV[id2, :], A) T.clear(B)
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
testing/python/issue/test_tilelang_issue_1263.py
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-01-06T05:20:45.325Z
Learnt from: silentCoder-dev
Repo: tile-ai/tilelang PR: 1606
File: testing/python/transform/test_tilelang_transform_hoist_broadcast_values.py:30-30
Timestamp: 2026-01-06T05:20:45.325Z
Learning: In `testing/python/transform/test_tilelang_transform_hoist_broadcast_values.py`, the test validates that the `hoist_broadcast_values` transformation pass correctly identifies and hoists broadcast operations by checking for patterns in the generated kernel source code. The specific literal values used (e.g., 430) are not important for the test's purpose, as it does not validate numerical precision or actual stored tensor values.
Applied to files:
testing/python/issue/test_tilelang_issue_1263.py
📚 Learning: 2025-11-14T07:56:11.098Z
Learnt from: lucifer1004
Repo: tile-ai/tilelang PR: 1256
File: testing/python/jit/test_tilelang_jit_gemm_nvrtc.py:55-115
Timestamp: 2025-11-14T07:56:11.098Z
Learning: In `testing/python/jit/test_tilelang_jit_gemm_nvrtc.py`, the global function `tilelang_callback_cuda_postproc` registered via `tvm.register_global_func(..., override=True)` is intentionally not restored after the test completes, as the persistent behavior is expected.
Applied to files:
testing/python/issue/test_tilelang_issue_1263.py
📚 Learning: 2025-12-18T04:50:00.512Z
Learnt from: silentCoder-dev
Repo: tile-ai/tilelang PR: 1464
File: testing/python/language/test_tilelang_language_rand.py:14-14
Timestamp: 2025-12-18T04:50:00.512Z
Learning: In `testing/python/language/test_tilelang_language_rand.py`, the TileLang kernel uses `blk_M = M` (single block) and calls `rng_rand()` four times per element to align results with the Triton implementation, which uses `blk_M = 128` (multiple blocks) and calls the RNG once per element. These differences compensate for internal RNG behavior differences between TileLang and Triton.
Applied to files:
testing/python/issue/test_tilelang_issue_1263.py
🧬 Code graph analysis (1)
testing/python/issue/test_tilelang_issue_1263.py (5)
tilelang/language/proxy.py (1)
Tensor(233-233)tilelang/language/kernel.py (1)
threads(215-219)tilelang/language/allocate.py (1)
alloc_shared(39-54)tilelang/language/loop.py (1)
Pipelined(97-134)tilelang/language/fill_op.py (1)
clear(39-62)
🔇 Additional comments (4)
testing/python/issue/test_tilelang_issue_1263.py (4)
1-2: LGTM!Standard imports for tilelang testing are correctly structured.
8-16: LGTM!The function signature and tensor shapes are well-aligned:
- The
ids2parameter creates the multi-level indirection that triggered the original regression- Kernel lanes (4) matches both the tensor sizes and loop iteration count
- Shared buffer allocations are appropriate for the test scenario
24-25: LGTM!The test correctly validates compilation success by invoking the kernel. The absence of explicit assertions is appropriate here—the test passes if compilation completes without raising the "variables X are used, but are not passed in as API arguments" error from the original issue.
28-29: LGTM!Standard test main guard using tilelang's test runner.
This pr fix #1263 by allowing dangling producer, i.e. whose produced data is not consumed by other statment.
Summary by CodeRabbit
Bug Fixes
Tests
✏️ Tip: You can customize this high-level summary in your review settings.