Skip to content

perf: use sparse updates for dataflow value rows - #1862

Draft
aborgna-q wants to merge 1 commit into
ab/const-fold-benchesfrom
ab/const-fold-perf-tuples
Draft

perf: use sparse updates for dataflow value rows#1862
aborgna-q wants to merge 1 commit into
ab/const-fold-benchesfrom
ab/const-fold-perf-tuples

Conversation

@aborgna-q

Copy link
Copy Markdown
Collaborator

Warning

This PR was mostly generated by an LLM as a proof of concept.
I'll rewrite it once we see the perf numbers.

The node_in_value_row rule previously allocated a full bottom-filled row for every input-wire update and joined every element into the stored row. For wide nodes this makes row assembly quadratic in the number of inputs and dominated constant-folding time.

Represent individual input updates sparsely while retaining dense rows for stored lattice values and operation results. Joining the common dense-plus-sparse case now touches only the updated slot.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.18110% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.46%. Comparing base (ce9846d) to head (a87a7da).

Files with missing lines Patch % Lines
tket/src/passes/dataflow/value_row.rs 50.79% 62 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           ab/const-fold-benches    #1862      +/-   ##
=========================================================
- Coverage                  86.59%   86.46%   -0.14%     
=========================================================
  Files                        202      202              
  Lines                      32692    32791      +99     
  Branches                   31206    31305      +99     
=========================================================
+ Hits                       28310    28353      +43     
- Misses                      3097     3152      +55     
- Partials                    1285     1286       +1     
Flag Coverage Δ
python 91.64% <ø> (ø)
qis-compiler 73.60% <ø> (ø)
rust 86.21% <51.18%> (-0.14%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

@codspeed-hq

codspeed-hq Bot commented Jul 17, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by ×2.4

⚠️ 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

⚡ 3 improved benchmarks
✅ 14 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
constant_fold/wide_tuple[512] 198.8 ms 35.2 ms ×5.6
constant_fold/wide_tuple[128] 17.2 ms 8.8 ms +94.73%
constant_fold/wide_tuple[32] 3.1 ms 2.5 ms +22.54%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ab/const-fold-perf-tuples (a87a7da) with ab/const-fold-benches (ce9846d)

Open in CodSpeed

The node_in_value_row rule previously allocated a full bottom-filled row for every input-wire update and joined every element into the stored row. For wide nodes this makes row assembly quadratic in the number of inputs and dominated constant-folding time.

Represent individual input updates sparsely while retaining dense rows for stored lattice values and operation results. Joining the common dense-plus-sparse case now touches only the updated slot.
@aborgna-q
aborgna-q force-pushed the ab/const-fold-perf-tuples branch from 2a5987d to a87a7da Compare August 18, 2026 11:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant