Skip to content

BE-304: HashQL: Terminator placement based on capabilities#8359

Merged
indietyp merged 9 commits into
mainfrom
bm/be-304-hashql-terminator-coloring-based-on-capabilities
Feb 23, 2026
Merged

BE-304: HashQL: Terminator placement based on capabilities#8359
indietyp merged 9 commits into
mainfrom
bm/be-304-hashql-terminator-coloring-based-on-capabilities

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented Feb 5, 2026

🌟 What is the purpose of this PR?

Adds terminator placement analysis to the MIR execution planning pipeline. This complements statement placement by analyzing control flow edges rather than individual statements, determining which backend transitions are valid at each edge and their associated transfer costs.

🔍 What does this change?

  • Introduces TransMatrix for encoding valid (source → destination) backend transitions per edge
  • Adds TerminatorCostVec to collect transition matrices for all edges in a body
  • Implements TerminatorPlacement analysis that computes costs based on:
    • Liveness analysis (which locals cross edges)
    • SCC detection (loop membership for Postgres restrictions)
    • Terminator-specific rules (GraphRead, SwitchInt, Goto)
  • Moves execution/ module from pass/analysis/ to pass/ (organizational)
  • Adds helper methods to BodyFootprint for computing average transfer costs

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?

  • 162 unit/integration tests + 41 doc tests passing
  • New snapshot tests for execution analysis integration scenarios
  • New unit tests for island placement and interpreter traversal costs
  • Existing CSP, splitting, and statement placement tests updated for allocator changes

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 5, 2026

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

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment Feb 21, 2026 10:04pm
petrinaut Ready Ready Preview Feb 21, 2026 10:04pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview Feb 21, 2026 10:04pm
hashdotdesign-tokens Ignored Ignored Preview Feb 21, 2026 10:04pm

@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 5, 2026

PR Summary

Medium Risk
Introduces new control-flow/back-end transition cost logic that will influence execution planning decisions; although well-tested, mistakes could change backend selection or produce overly conservative Cost::MAX transfers.

Overview
Adds terminator placement for MIR execution planning: a new TerminatorPlacement analysis computes, per control-flow edge, which backend transitions are allowed and their costs via a per-edge TransMatrix collected in TerminatorCostVec.

Transfer costs are derived from liveness + per-local BodyFootprint size estimates, with explicit transition rules for Goto/SwitchInt/GraphRead, plus Postgres restrictions (no incoming transitions; disabled in loops/self-loops). Execution-planning code is moved out of pass::analysis into pass::execution, Cost gains MAX and saturating_add, and size-estimation gains Estimate::eval and Footprint::average helpers (plus range/unit utilities) to support cost computation; adds list support to the rvalue! builder macro and snapshot/unit tests for the new analysis.

Written by Cursor Bugbot for commit 3927741. This will update automatically on new commits. Configure here.

TimDiekmann
TimDiekmann previously approved these changes Feb 19, 2026
@indietyp indietyp force-pushed the bm/be-304-hashql-terminator-coloring-based-on-capabilities branch from 2f02bbc to d1d3e0b Compare February 19, 2026 13:57
@indietyp indietyp force-pushed the bm/be-303-hashql-split-basic-blocks-depending-on-largest-available branch from d25735c to c40fc37 Compare February 19, 2026 13:57
@github-actions github-actions Bot dismissed TimDiekmann’s stale review February 19, 2026 13:58

Your organization requires reapproval when changes are made, so Graphite has dismissed approvals. See the output of git range-diff at https://github.com/hashintel/hash/actions/runs/22184745507

@graphite-app graphite-app Bot changed the base branch from bm/be-303-hashql-split-basic-blocks-depending-on-largest-available to graphite-base/8359 February 19, 2026 15:26
@indietyp indietyp force-pushed the bm/be-304-hashql-terminator-coloring-based-on-capabilities branch from d1d3e0b to 7554ef3 Compare February 20, 2026 17:02
@indietyp indietyp changed the base branch from graphite-base/8359 to bm/be-303-hashql-split-basic-blocks-depending-on-largest-available February 20, 2026 17:02
Base automatically changed from bm/be-303-hashql-split-basic-blocks-depending-on-largest-available to main February 21, 2026 01:35
@indietyp indietyp force-pushed the bm/be-304-hashql-terminator-coloring-based-on-capabilities branch from 7554ef3 to 719e74b Compare February 21, 2026 01:36
@vercel vercel Bot temporarily deployed to Preview – petrinaut February 21, 2026 01:36 Inactive
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app Bot commented Feb 21, 2026

Merge activity

  • Feb 21, 1:37 AM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

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.

@indietyp indietyp added this pull request to the merge queue Feb 23, 2026
Merged via the queue into main with commit 607b2a3 Feb 23, 2026
52 checks passed
@indietyp indietyp deleted the bm/be-304-hashql-terminator-coloring-based-on-capabilities branch February 23, 2026 04:18
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.

2 participants