Skip to content

Acl/order effects#1883

Draft
acl-cqc wants to merge 25 commits into
effectsfrom
acl/order_effects
Draft

Acl/order effects#1883
acl-cqc wants to merge 25 commits into
effectsfrom
acl/order_effects

Conversation

@acl-cqc

@acl-cqc acl-cqc commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

NOTE: This is into the effects branch, i.e. based off #1723; needs reworking to go onto main.

  • Change builder add_op to take a OpWithEffects = Pure | (Op, Sequence[Effect]), update uses everywhere
  • _last_side_effect now a map from Effect, propagate_side_effects takes list of Effect too
  • also add some tests demonstrating current state of arrays: indexing (arr[3] i.e. array.__getitem__) is not permitted in pure functions - this may change as part of Define all known effects, update guppy funcs/@hugr_op's #1747.
  • Current op-level wiring does totally order array panics, consistent with previous, this causes many new Order edges to be added into the benchmarks, hence the increase in hugr size.

Need to add some tests that actually show things (in particular function calls) being wired up with parallel Order edges rather than sequential, both for pure functions, and for functions with different (nonzero) effects - the latter will probably require "cheating" and passing a non-Effect in (with typechecking turned off)...

Current typedef of OpWithEffects as a union is introduced in c4e0124, before that 'twas a class - felt a bit awkward, but suggestions welcome for better ways. (I wanted to make every add_op an error unless updated; given that's now the case, could make add_op take a hugr ExtOp or a tuple, but not sure that's good, an easy mistake to make)

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchacl/order_effects
TestbedLinux

🚨 4 Alerts

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_compilehugr_bytes
bytes x 1e3
📈 plot
🚷 threshold
🚨 alert (🔔)
189.80 x 1e3
(+23.23%)Baseline: 154.02 x 1e3
155.56 x 1e3
(122.01%)

tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compilehugr_bytes
bytes x 1e3
📈 plot
🚷 threshold
🚨 alert (🔔)
30.04 x 1e3
(+8.42%)Baseline: 27.71 x 1e3
27.99 x 1e3
(107.34%)

tests/benchmarks/test_queue_push_pop.py::test_queue_push_benchmark_compilehugr_bytes
bytes x 1e3
📈 plot
🚷 threshold
🚨 alert (🔔)
10.56 x 1e3
(+4.71%)Baseline: 10.09 x 1e3
10.19 x 1e3
(103.67%)

tests/benchmarks/test_queue_push_pop.py::test_queue_push_pop_benchmark_compilehugr_bytes
bytes x 1e3
📈 plot
🚷 threshold
🚨 alert (🔔)
14.27 x 1e3
(+4.17%)Baseline: 13.70 x 1e3
13.83 x 1e3
(103.14%)

Click to view all benchmark results
Benchmarkhugr_bytesBenchmark Result
bytes x 1e3
(Result Δ%)
Upper Boundary
bytes x 1e3
(Limit %)
hugr_nodesBenchmark Result
nodes
(Result Δ%)
Upper Boundary
nodes
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_compile📈 view plot
🚷 view threshold
🚨 view alert (🔔)
189.80 x 1e3
(+23.23%)Baseline: 154.02 x 1e3
155.56 x 1e3
(122.01%)

📈 view plot
🚷 view threshold
6,630.00
(0.00%)Baseline: 6,630.00
6,696.30
(99.01%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
🚨 view alert (🔔)
30.04 x 1e3
(+8.42%)Baseline: 27.71 x 1e3
27.99 x 1e3
(107.34%)

📈 view plot
🚷 view threshold
1,051.00
(0.00%)Baseline: 1,051.00
1,061.51
(99.01%)
tests/benchmarks/test_queue_push_pop.py::test_queue_push_benchmark_compile📈 view plot
🚷 view threshold
🚨 view alert (🔔)
10.56 x 1e3
(+4.71%)Baseline: 10.09 x 1e3
10.19 x 1e3
(103.67%)

📈 view plot
🚷 view threshold
301.00
(0.00%)Baseline: 301.00
304.01
(99.01%)
tests/benchmarks/test_queue_push_pop.py::test_queue_push_pop_benchmark_compile📈 view plot
🚷 view threshold
🚨 view alert (🔔)
14.27 x 1e3
(+4.17%)Baseline: 13.70 x 1e3
13.83 x 1e3
(103.14%)

📈 view plot
🚷 view threshold
420.00
(0.00%)Baseline: 420.00
424.20
(99.01%)
🐰 View full continuous benchmarking report in Bencher

@codecov-commenter

codecov-commenter commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.04878% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (effects@708e4e5). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...uppylang_internals/std/_internal/compiler/array.py 88.88% 3 Missing ⚠️
...pylang_internals/std/_internal/compiler/prelude.py 90.90% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             effects    #1883   +/-   ##
==========================================
  Coverage           ?   92.92%           
==========================================
  Files              ?      149           
  Lines              ?    14026           
  Branches           ?        0           
==========================================
  Hits               ?    13034           
  Misses             ?      992           
  Partials           ?        0           

☔ 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.

@acl-cqc acl-cqc force-pushed the acl/order_effects branch from 70e627e to 4db2d47 Compare June 17, 2026 22:15
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.

2 participants