BE-494: HashQL: Loop-breaker selection for recursive inlining#8600
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## bm/be-482-hashql-remove-logical-not-from-unary-operators #8600 +/- ##
============================================================================================
+ Coverage 63.65% 68.27% +4.62%
============================================================================================
Files 1271 987 -284
Lines 137660 93731 -43929
Branches 5482 4793 -689
============================================================================================
- Hits 87627 63996 -23631
+ Misses 49123 29073 -20050
+ Partials 910 662 -248
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
51195eb to
d6dbdd5
Compare
f66d5ce to
b4e6aaf
Compare
|
Deployment failed with the following error: |
933ed9e to
1bebdcc
Compare
68d7a83 to
1685178
Compare
1cba715 to
1da0f0a
Compare
PR SummaryMedium Risk Overview Updates the MIR inliner to handle mutually recursive SCCs via loop-breaker selection: it scores SCC members, greedily chooses a breaker set that makes the remainder acyclic (using the new DFS), reorders SCC members for processing, and changes both normal and aggressive inlining to inline within SCCs except when targeting selected breakers (and to skip self-calls). This also extends Tarjan SCC member utilities with iterators, adds Reviewed by Cursor Bugbot for commit 4ea12a3. Bugbot is set up for automated code reviews on this repo. Configure here. |
1c91f7b to
84e917d
Compare
1da0f0a to
979bf1e
Compare
🤖 Augment PR SummarySummary: Adds loop-breaker-aware inlining for mutually recursive HashQL MIR functions, enabling safe inlining within recursive SCCs without infinite expansion. Changes:
Technical Notes: Breaker selection uses repeated cycle checks over the remaining subgraph (filtered via DFS edge ignoring) to ensure the non-breaker remainder is acyclic before allowing within-SCC inlining. 🤖 Was this summary useful? React with 👍 or 👎 |
84e917d to
d7a892b
Compare
979bf1e to
3fe9df4
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 4ea12a3. Configure here.
|
|
||
| let target_component = self.state.components.scc(ptr); | ||
|
|
||
| // Skip if we've already inlined this SCC into this caller. |
There was a problem hiding this comment.
Aggressive inlining re-expands self-recursive non-breaker functions
Medium Severity
Self-recursive functions in trivial SCCs (size 1 with self-loop) receive no loop breaker because run_in skips SCCs with members.len() < 2. When such a function is called from a filter, the aggressive phase's FindCallsiteVisitor allows repeated inlining: the self-recursive apply @target inside the inlined body passes both checks (ptr == self.caller is false since the caller is the filter, and loop_breakers.contains(ptr) is false). The old SparseBitMatrix-based inlined tracking prevented this by marking the target's SCC after the first expansion; its removal means the aggressive phase re-inlines the same function up to aggressive_inline_cutoff times, causing unnecessary code bloat and a spurious diagnostic.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 4ea12a3. Configure here.



🌟 What is the purpose of this PR?
This PR implements a three-color depth-first search algorithm for directed graphs and integrates it with a loop-breaker selection system for the MIR inliner. The three-color DFS enables cycle detection and postorder traversal, while the loop-breaker system allows the inliner to handle mutually recursive functions by strategically selecting which functions to avoid inlining within strongly connected components (SCCs).
🔗 Related links
🔍 What does this change?
libs/@local/hashql/core/src/graph/algorithms/color/mod.rswith support for cycle detection and visitor callbackslibs/@local/hashql/mir/src/pass/transform/inline/loop_breaker.rsthat uses scoring heuristics to choose which functions in recursive SCCs should not be inlined!to~in MIR output formattingInlineLoopBreakerConfigfor tuning breaker selection heuristicsPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🛡 What tests cover this?
❓ How to test this?