Fix shared memory boundary detection bug - #11
Conversation
📝 WalkthroughWalkthroughThe changes refactor internal IR transformation logic across three files: a new statement flattener preprocessor for sequence statements, refactored warpgroup partitioning with unified segment merging, and recursive boundary marker detection for shared-memory liveness tracking. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/transform/auto_schedule.cc`:
- Around line 873-901: Add an explicit include for the functional header so
std::function is not relied on transitively: in the file containing
SeqStmtFlattener, add `#include` <functional> near the other includes; this makes
the use of std::function<void(const Stmt&)> in the Flatten lambda and the
SeqStmtFlattener class declaration explicit and self-contained.
In `@src/transform/auto_schedule/warpgroup_partition.cc`:
- Around line 1184-1246: The ICHECK_EQ on wg0_segments.size() vs
wg1_segments.size() incorrectly aborts valid asymmetric clones created by
CloneIRStructureWithWarpgroupFilter; instead detect size mismatch before the
segmented-splitting loop and fall back to the old unsplit path by constructing
the full-stmt clones and calling MakeWarpgroupIf on them (e.g., use
ConvertIRStructureToStmt(wg0_structure.get(), outer_enable_epi) and
ConvertIRStructureToStmt(wg1_structure.get(), outer_enable_epi) or their
SegmentToStmt equivalents), set if_then_else to that result and skip the
segmented splitting logic; remove or replace the ICHECK_EQ with this conditional
fallback so the code only performs segmented splitting when wg0_segments.size()
== wg1_segments.size().
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0f072465-d7a3-4ae6-8b9b-f701c80ec1dc
📒 Files selected for processing (3)
src/transform/auto_schedule.ccsrc/transform/auto_schedule/warpgroup_partition.ccsrc/transform/merge_shared_memory_allocations.cc
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Summary by CodeRabbit