Skip to content

BE-500, BE-501: HashQL: Unify mixed parameter resolution in data dependency analysis#8607

Open
indietyp wants to merge 3 commits into
bm/be-494-hashql-scc-loop-breaker-inliningfrom
bm/be-500-hashql-forward-substitution-unified-param-resolution
Open

BE-500, BE-501: HashQL: Unify mixed parameter resolution in data dependency analysis#8607
indietyp wants to merge 3 commits into
bm/be-494-hashql-scc-loop-breaker-inliningfrom
bm/be-500-hashql-forward-substitution-unified-param-resolution

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented Apr 5, 2026

🌟 What is the purpose of this PR?

This PR consolidates the parameter resolution logic in the data dependency analysis by unifying the handling of graph edges and constant bindings. Previously, these two sources of parameter values were handled by separate functions, but now they are processed together in a single unified approach that can handle mixed scenarios where parameters come from both sources.

🔍 What does this change?

  • Removes the resolve_params_const function and merges its functionality into resolve_params
  • Updates resolve_params to handle both graph edges and constant bindings simultaneously using try_reduce for consensus checking
  • Adds support for the iterator_try_reduce and maybe_uninit_uninit_array_transpose library features
  • Removes the unused assert_matches feature from multiple library modules
  • Adds a new test case load_param_mixed that validates parameter resolution when predecessors provide a mix of constants and projections
  • Improves documentation to clarify that parameter resolution now handles both graph edges and constant bindings

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?

  • New test case load_param_mixed validates the unified parameter resolution logic
  • Existing data dependency analysis tests continue to cover the refactored functionality

❓ How to test this?

  1. Checkout the branch
  2. Run the data dependency analysis tests
  3. Confirm that the new load_param_mixed test passes and validates mixed parameter resolution

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 5, 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:59pm
petrinaut Ready Ready Preview May 20, 2026 2:59pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
hashdotdesign Ignored Ignored Preview May 20, 2026 2:59pm
hashdotdesign-tokens Ignored Ignored Preview May 20, 2026 2:59pm

Copy link
Copy Markdown
Member Author

indietyp commented Apr 5, 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 5, 2026

Merging this PR will degrade performance by 11.37%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 23 untouched benchmarks
⏩ 56 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
diamond 15.8 µs 17.8 µs -11.37%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing bm/be-500-hashql-forward-substitution-unified-param-resolution (a308b78) with bm/be-494-hashql-scc-loop-breaker-inlining (8a0fbe0)

Open in CodSpeed

Footnotes

  1. 56 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@vercel vercel Bot temporarily deployed to Preview – petrinaut April 5, 2026 19:43 Inactive
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 96.25000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.39%. Comparing base (8a0fbe0) to head (a308b78).

Files with missing lines Patch % Lines
...l/mir/src/pass/analysis/data_dependency/resolve.rs 93.33% 1 Missing and 3 partials ⚠️
...hashql/mir/src/pass/transform/inst_simplify/mod.rs 0.00% 2 Missing ⚠️
Additional details and impacted files
@@                              Coverage Diff                               @@
##           bm/be-494-hashql-scc-loop-breaker-inlining    #8607      +/-   ##
==============================================================================
+ Coverage                                       63.38%   63.39%   +0.01%     
==============================================================================
  Files                                            1386     1384       -2     
  Lines                                          144850   144689     -161     
  Branches                                         5918     5908      -10     
==============================================================================
- Hits                                            91815    91731      -84     
+ Misses                                          52064    51991      -73     
+ Partials                                          971      967       -4     
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.71% <ø> (ø)
rust.hashql-mir 91.73% <96.25%> (+0.04%) ⬆️

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.

@vercel vercel Bot temporarily deployed to Preview – petrinaut April 6, 2026 19:28 Inactive
@indietyp indietyp changed the title BE-500: HashQL: Unify mixed parameter resolution in data dependency analysis BE-500, BE-501: HashQL: Unify mixed parameter resolution in data dependency analysis Apr 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 6, 2026

Benchmark results

@rust/hash-graph-benches – Integrations

policy_resolution_large

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2002 $$28.5 \mathrm{ms} \pm 196 \mathrm{μs}\left({\color{gray}-4.192 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$4.31 \mathrm{ms} \pm 45.4 \mathrm{μs}\left({\color{red}12.2 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1001 $$15.5 \mathrm{ms} \pm 154 \mathrm{μs}\left({\color{red}15.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 3314 $$46.3 \mathrm{ms} \pm 372 \mathrm{μs}\left({\color{gray}1.79 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$15.9 \mathrm{ms} \pm 141 \mathrm{μs}\left({\color{red}7.49 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 1526 $$25.5 \mathrm{ms} \pm 177 \mathrm{μs}\left({\color{gray}-4.810 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 2078 $$29.3 \mathrm{ms} \pm 207 \mathrm{μs}\left({\color{gray}-2.220 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.81 \mathrm{ms} \pm 22.5 \mathrm{μs}\left({\color{gray}-3.105 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 1033 $$14.2 \mathrm{ms} \pm 116 \mathrm{μs}\left({\color{gray}-0.823 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_medium

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 102 $$4.13 \mathrm{ms} \pm 31.7 \mathrm{μs}\left({\color{red}9.79 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.33 \mathrm{ms} \pm 27.1 \mathrm{μs}\left({\color{red}13.6 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 51 $$3.85 \mathrm{ms} \pm 37.3 \mathrm{μs}\left({\color{red}16.5 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 269 $$5.95 \mathrm{ms} \pm 63.4 \mathrm{μs}\left({\color{red}15.5 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$4.04 \mathrm{ms} \pm 42.1 \mathrm{μs}\left({\color{gray}1.27 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 107 $$4.80 \mathrm{ms} \pm 53.6 \mathrm{μs}\left({\color{red}11.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 133 $$5.35 \mathrm{ms} \pm 69.3 \mathrm{μs}\left({\color{red}19.6 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.82 \mathrm{ms} \pm 36.9 \mathrm{μs}\left({\color{red}11.7 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 63 $$5.03 \mathrm{ms} \pm 61.1 \mathrm{μs}\left({\color{red}21.8 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_none

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 2 $$2.95 \mathrm{ms} \pm 23.1 \mathrm{μs}\left({\color{gray}1.88 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.00 \mathrm{ms} \pm 30.1 \mathrm{μs}\left({\color{red}5.40 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 1 $$3.16 \mathrm{ms} \pm 60.3 \mathrm{μs}\left({\color{red}5.85 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 8 $$3.36 \mathrm{ms} \pm 37.2 \mathrm{μs}\left({\color{red}6.92 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.30 \mathrm{ms} \pm 41.5 \mathrm{μs}\left({\color{red}9.09 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 3 $$3.46 \mathrm{ms} \pm 32.9 \mathrm{μs}\left({\color{red}6.83 \mathrm{\%}}\right) $$ Flame Graph

policy_resolution_small

Function Value Mean Flame graphs
resolve_policies_for_actor user: empty, selectivity: high, policies: 52 $$3.49 \mathrm{ms} \pm 40.0 \mathrm{μs}\left({\color{red}9.62 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: low, policies: 1 $$3.29 \mathrm{ms} \pm 32.2 \mathrm{μs}\left({\color{red}8.97 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: empty, selectivity: medium, policies: 25 $$3.26 \mathrm{ms} \pm 28.5 \mathrm{μs}\left({\color{red}5.65 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: high, policies: 94 $$4.31 \mathrm{ms} \pm 53.4 \mathrm{μs}\left({\color{red}21.0 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: low, policies: 1 $$3.71 \mathrm{ms} \pm 43.9 \mathrm{μs}\left({\color{red}13.3 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: seeded, selectivity: medium, policies: 26 $$3.93 \mathrm{ms} \pm 45.9 \mathrm{μs}\left({\color{red}16.1 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: high, policies: 66 $$3.86 \mathrm{ms} \pm 40.2 \mathrm{μs}\left({\color{gray}2.85 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: low, policies: 1 $$3.21 \mathrm{ms} \pm 21.5 \mathrm{μs}\left({\color{gray}0.724 \mathrm{\%}}\right) $$ Flame Graph
resolve_policies_for_actor user: system, selectivity: medium, policies: 29 $$3.59 \mathrm{ms} \pm 25.9 \mathrm{μs}\left({\color{gray}2.10 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_complete

Function Value Mean Flame graphs
entity_by_id;one_depth 1 entities $$50.0 \mathrm{ms} \pm 458 \mathrm{μs}\left({\color{red}7.98 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 10 entities $$89.6 \mathrm{ms} \pm 609 \mathrm{μs}\left({\color{red}6.31 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 25 entities $$56.7 \mathrm{ms} \pm 482 \mathrm{μs}\left({\color{red}6.98 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 5 entities $$55.0 \mathrm{ms} \pm 369 \mathrm{μs}\left({\color{gray}3.49 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;one_depth 50 entities $$65.0 \mathrm{ms} \pm 459 \mathrm{μs}\left({\color{lightgreen}-12.502 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 1 entities $$47.8 \mathrm{ms} \pm 287 \mathrm{μs}\left({\color{lightgreen}-20.685 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 10 entities $$446 \mathrm{ms} \pm 1.05 \mathrm{ms}\left({\color{gray}1.69 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 25 entities $$107 \mathrm{ms} \pm 579 \mathrm{μs}\left({\color{red}10.7 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 5 entities $$93.4 \mathrm{ms} \pm 540 \mathrm{μs}\left({\color{gray}-2.372 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;two_depth 50 entities $$301 \mathrm{ms} \pm 913 \mathrm{μs}\left({\color{gray}1.74 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 1 entities $$20.2 \mathrm{ms} \pm 145 \mathrm{μs}\left({\color{gray}-3.775 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 10 entities $$23.0 \mathrm{ms} \pm 256 \mathrm{μs}\left({\color{gray}3.04 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 25 entities $$20.0 \mathrm{ms} \pm 117 \mathrm{μs}\left({\color{lightgreen}-11.598 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 5 entities $$23.8 \mathrm{ms} \pm 235 \mathrm{μs}\left({\color{red}11.7 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id;zero_depth 50 entities $$25.2 \mathrm{ms} \pm 165 \mathrm{μs}\left({\color{lightgreen}-5.690 \mathrm{\%}}\right) $$ Flame Graph

read_scaling_linkless

Function Value Mean Flame graphs
entity_by_id 1 entities $$20.5 \mathrm{ms} \pm 143 \mathrm{μs}\left({\color{gray}1.49 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10 entities $$19.9 \mathrm{ms} \pm 130 \mathrm{μs}\left({\color{gray}1.27 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 100 entities $$20.2 \mathrm{ms} \pm 182 \mathrm{μs}\left({\color{gray}1.62 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 1000 entities $$19.9 \mathrm{ms} \pm 141 \mathrm{μs}\left({\color{gray}0.088 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id 10000 entities $$26.6 \mathrm{ms} \pm 287 \mathrm{μs}\left({\color{gray}2.66 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity

Function Value Mean Flame graphs
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/block/v/1 $$35.5 \mathrm{ms} \pm 327 \mathrm{μs}\left({\color{gray}3.08 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/book/v/1 $$34.9 \mathrm{ms} \pm 277 \mathrm{μs}\left({\color{gray}-1.470 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/building/v/1 $$35.6 \mathrm{ms} \pm 374 \mathrm{μs}\left({\color{lightgreen}-6.543 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/organization/v/1 $$35.1 \mathrm{ms} \pm 305 \mathrm{μs}\left({\color{gray}-4.797 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/page/v/2 $$35.5 \mathrm{ms} \pm 321 \mathrm{μs}\left({\color{gray}1.09 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/person/v/1 $$36.0 \mathrm{ms} \pm 268 \mathrm{μs}\left({\color{gray}1.14 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/playlist/v/1 $$34.5 \mathrm{ms} \pm 316 \mathrm{μs}\left({\color{lightgreen}-7.698 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/song/v/1 $$34.5 \mathrm{ms} \pm 295 \mathrm{μs}\left({\color{gray}0.348 \mathrm{\%}}\right) $$ Flame Graph
entity_by_id entity type ID: https://blockprotocol.org/@alice/types/entity-type/uk-address/v/1 $$35.6 \mathrm{ms} \pm 297 \mathrm{μs}\left({\color{gray}-2.051 \mathrm{\%}}\right) $$ Flame Graph

representative_read_entity_type

Function Value Mean Flame graphs
get_entity_type_by_id Account ID: bf5a9ef5-dc3b-43cf-a291-6210c0321eba $$8.57 \mathrm{ms} \pm 50.2 \mathrm{μs}\left({\color{lightgreen}-15.874 \mathrm{\%}}\right) $$ Flame Graph

representative_read_multiple_entities

Function Value Mean Flame graphs
entity_by_property traversal_paths=0 0 $$100 \mathrm{ms} \pm 566 \mathrm{μs}\left({\color{lightgreen}-5.540 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$151 \mathrm{ms} \pm 563 \mathrm{μs}\left({\color{lightgreen}-12.281 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$110 \mathrm{ms} \pm 549 \mathrm{μs}\left({\color{gray}-1.060 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$122 \mathrm{ms} \pm 564 \mathrm{μs}\left({\color{gray}1.62 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$128 \mathrm{ms} \pm 474 \mathrm{μs}\left({\color{gray}0.057 \mathrm{\%}}\right) $$
entity_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$133 \mathrm{ms} \pm 471 \mathrm{μs}\left({\color{gray}-3.902 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=0 0 $$106 \mathrm{ms} \pm 455 \mathrm{μs}\left({\color{lightgreen}-5.481 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=255 1,resolve_depths=inherit:1;values:255;properties:255;links:127;link_dests:126;type:true $$132 \mathrm{ms} \pm 599 \mathrm{μs}\left({\color{gray}-0.340 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:0;link_dests:0;type:false $$113 \mathrm{ms} \pm 484 \mathrm{μs}\left({\color{gray}-4.684 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:0;links:1;link_dests:0;type:true $$121 \mathrm{ms} \pm 940 \mathrm{μs}\left({\color{gray}-3.671 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:0;properties:2;links:1;link_dests:0;type:true $$121 \mathrm{ms} \pm 575 \mathrm{μs}\left({\color{lightgreen}-5.127 \mathrm{\%}}\right) $$
link_by_source_by_property traversal_paths=2 1,resolve_depths=inherit:0;values:2;properties:2;links:1;link_dests:0;type:true $$121 \mathrm{ms} \pm 500 \mathrm{μs}\left({\color{gray}-0.686 \mathrm{\%}}\right) $$

scenarios

Function Value Mean Flame graphs
full_test query-limited $$140 \mathrm{ms} \pm 747 \mathrm{μs}\left({\color{gray}4.28 \mathrm{\%}}\right) $$ Flame Graph
full_test query-unlimited $$149 \mathrm{ms} \pm 603 \mathrm{μs}\left({\color{gray}2.32 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-limited $$109 \mathrm{ms} \pm 619 \mathrm{μs}\left({\color{gray}4.28 \mathrm{\%}}\right) $$ Flame Graph
linked_queries query-unlimited $$601 \mathrm{ms} \pm 3.22 \mathrm{ms}\left({\color{gray}3.75 \mathrm{\%}}\right) $$ Flame Graph

@indietyp indietyp force-pushed the bm/be-494-hashql-scc-loop-breaker-inlining branch from 95ef685 to 933ed9e Compare April 29, 2026 15:23
@indietyp indietyp force-pushed the bm/be-500-hashql-forward-substitution-unified-param-resolution branch from 7b45e45 to 04b51c5 Compare April 29, 2026 15:23
@indietyp indietyp force-pushed the bm/be-500-hashql-forward-substitution-unified-param-resolution branch from 04b51c5 to fb80624 Compare April 29, 2026 15:32
@indietyp indietyp force-pushed the bm/be-500-hashql-forward-substitution-unified-param-resolution branch from fb80624 to d2ad307 Compare April 29, 2026 15:40
@indietyp indietyp force-pushed the bm/be-494-hashql-scc-loop-breaker-inlining branch from 1bebdcc to 1cba715 Compare April 29, 2026 15:40
@indietyp indietyp force-pushed the bm/be-500-hashql-forward-substitution-unified-param-resolution branch from d2ad307 to 93fba40 Compare April 29, 2026 15:42
@indietyp indietyp force-pushed the bm/be-494-hashql-scc-loop-breaker-inlining branch from 1cba715 to 1da0f0a Compare April 29, 2026 15:42
@indietyp indietyp marked this pull request as ready for review April 29, 2026 15:42
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 29, 2026

PR Summary

Medium Risk
Changes core data-dependency resolution logic for Param edges (consensus, projection handling, and cycle/backtrack behavior), which could alter analysis results across MIR passes. Risk is mitigated by extensive new regression tests covering mixed sources and cycle scenarios.

Overview
Unifies block-parameter (Param) resolution in data-dependency analysis by treating predecessor graph edges and constant bindings as a single consensus set, removing the separate constant-only path.

Param consensus is now projection-aware (resolving each predecessor through the full projection suffix before comparing) and cycle-tolerant (filters cyclic Backtrack candidates so non-cyclic init edges can still determine a value). Several new tests + snapshot updates cover mixed constant/place predecessors, projected-field consensus, and cycle edge-cases.

Separately, InstSimplify adds a missing annihilator rule for bitwise AND: 0 & x => 0 (non-boolean case), and the crate enables the nightly iterator_try_reduce feature used by the new consensus implementation.

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

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.

@indietyp indietyp force-pushed the bm/be-500-hashql-forward-substitution-unified-param-resolution branch from ffe8840 to f3d71ce Compare April 30, 2026 08:53
Comment thread libs/@local/hashql/mir/src/pass/analysis/data_dependency/resolve.rs
try_trait_v2,
variant_count,
maybe_uninit_uninit_array_transpose
iterator_try_reduce
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Feature flag placed out of alphabetical order

Low Severity

The iterator_try_reduce feature flag is placed at the end of the library features list, breaking the otherwise alphabetical ordering. It belongs between iter_collect_into and likely_unlikely. Notably, this same PR correctly moved maybe_uninit_uninit_array_transpose into its proper alphabetical position, so the out-of-order placement of the new feature appears to be an oversight.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit d93d11b. Configure here.

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.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a308b78. Configure here.

// `None` when the closure short-circuits (predecessors disagree)
let mut backtrack_occurred = false;
let consensus = graph_edges
.chain(constant_edges)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-Param edges in consensus

Medium Severity

Unified resolve_params now runs when both Param graph edges and constant bindings exist, but graph_edges still walks every outgoing edge on the local. Structural Index/Field edges from tuple assignments on the same SSA local are treated as φ predecessors, so consensus can diverge or pick the wrong source; previously param resolution was skipped in that mixed case.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a308b78. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can't happen because of invariance violation. Well typed program (still)

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