Skip to content

BE-512: HashQL: Allow cross-backend transitions for SwitchInt terminators#8696

Open
indietyp wants to merge 1 commit into
bm/be-524-hashql-remove-island-dagfrom
bm/be-512-hashql-switchint-allow-cross-backend-transitions
Open

BE-512: HashQL: Allow cross-backend transitions for SwitchInt terminators#8696
indietyp wants to merge 1 commit into
bm/be-524-hashql-remove-island-dagfrom
bm/be-512-hashql-switchint-allow-cross-backend-transitions

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented May 4, 2026

🌟 What is the purpose of this PR?

SwitchInt terminators were previously blocked from generating cross-backend transitions during terminator placement, based on an assumption that coordinating branches across backends would be too complex. This restriction has been lifted, allowing SwitchInt to behave the same as Goto and permit cross-backend transitions. This enables more flexible execution placement for conditional branching logic.

🔍 What does this change?

  • SwitchInt now calls add_goto_transitions instead of being a no-op, enabling cross-backend edge costs to be populated for blocks ending with a SwitchInt terminator.
  • The test switchint_blocks_cross_backend has been renamed to switchint_allows_cross_backend and updated to assert that the Interpreter -> Embedding transition is now reachable with the expected cost.
  • The switchint_edge_targets_are_branch_specific test has been updated to assert that cross-backend transitions are present rather than absent.
  • The terminator placement snapshot has been updated to reflect the newly populated I->E and P->E transitions on edge[1].

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Updated unit tests in terminator_placement/tests.rs covering SwitchInt cross-backend transition behaviour.
  • Updated snapshot test reflecting the new edge cost matrix output.

❓ How to test this?

  1. Run cargo test in libs/@local/hashql/mir.
  2. Confirm all terminator placement tests pass, including the renamed switchint_allows_cross_backend test.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment May 20, 2026 2:58pm
petrinaut Ready Ready Preview May 20, 2026 2:58pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 20, 2026 2:58pm

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 12:52 Inactive
@cursor
Copy link
Copy Markdown

cursor Bot commented May 4, 2026

PR Summary

Medium Risk
Changes execution-planning cost computation for conditional branches, which could alter backend selection and runtime behavior across many queries. Logic change is small and covered by updated unit and snapshot tests, but affects a core planning pass.

Overview
SwitchInt terminators now permit cross-backend transitions during terminator placement by treating them like Goto when populating per-edge transition matrices.

Tests were updated to reflect the new reachable I->E/P->E transitions (including renamed switchint_allows_cross_backend) and the UI snapshot was regenerated to include the newly populated edge cost entries.

Reviewed by Cursor Bugbot for commit 026ce7b. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels May 4, 2026
Copy link
Copy Markdown
Member Author

indietyp commented May 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 4, 2026

🤖 Augment PR Summary

Summary: Enables cross-backend transitions for blocks ending in SwitchInt terminators, aligning their behavior with Goto during terminator placement.
Changes: Updates the edge-cost matrix population logic and adjusts unit/snapshot tests to assert newly reachable cross-backend paths with expected costs.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.43%. Comparing base (bb97a73) to head (026ce7b).

Additional details and impacted files
@@                          Coverage Diff                           @@
##           bm/be-524-hashql-remove-island-dag    #8696      +/-   ##
======================================================================
- Coverage                               63.43%   63.43%   -0.01%     
======================================================================
  Files                                    1382     1382              
  Lines                                  144756   144753       -3     
  Branches                                 5902     5902              
======================================================================
- Hits                                    91823    91820       -3     
  Misses                                  51974    51974              
  Partials                                  959      959              
Flag Coverage Δ
apps.hash-ai-worker-ts 1.41% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-backend-utils 2.81% <ø> (ø)
local.hash-graph-sdk 9.63% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.52% <ø> (ø)
rust.hashql-compiletest 28.26% <ø> (ø)
rust.hashql-eval 79.70% <ø> (ø)
rust.hashql-mir 91.83% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 5eeec53 to 91d9bc3 Compare May 8, 2026 08:33
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 6e14a48 to 55f11e3 Compare May 8, 2026 08:33
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 91d9bc3 to f2fc415 Compare May 11, 2026 10:58
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 2ae4ba3 to 6fef8b9 Compare May 12, 2026 13:58
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from f2fc415 to 43c449a Compare May 12, 2026 13:58
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 6fef8b9 to 94f20af Compare May 13, 2026 09:38
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 43c449a to 59b8c62 Compare May 13, 2026 09:38
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 94f20af to 94254d8 Compare May 13, 2026 09:57
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 59b8c62 to 55e6316 Compare May 13, 2026 09:57
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 94254d8 to 78f76e2 Compare May 15, 2026 07:49
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 55e6316 to 2a95250 Compare May 15, 2026 07:49
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 2a95250 to 5203abe Compare May 19, 2026 15:43
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 11715f8 to bb97a73 Compare May 20, 2026 14:46
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 5203abe to 026ce7b Compare May 20, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

1 participant