Skip to content

feat: add @inline decorator#1976

Open
acl-cqc wants to merge 4 commits into
mainfrom
acl/inline2
Open

feat: add @inline decorator#1976
acl-cqc wants to merge 4 commits into
mainfrom
acl/inline2

Conversation

@acl-cqc

@acl-cqc acl-cqc commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Heavily based on #1942, also with a test that tket optimizations do what we expect.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchacl/inline2
TestbedLinux
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
120.67 x 1e3
(0.00%)Baseline: 120.67 x 1e3
121.87 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
5,659.00
(0.00%)Baseline: 5,659.00
5,715.59
(99.01%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
36.19 x 1e3
(0.00%)Baseline: 36.19 x 1e3
36.55 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
1,582.00
(0.00%)Baseline: 1,582.00
1,597.82
(99.01%)
tests/benchmarks/test_queue_push_pop.py::test_queue_push_benchmark_compile📈 view plot
🚷 view threshold
9.95 x 1e3
(0.00%)Baseline: 9.95 x 1e3
10.05 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
347.00
(0.00%)Baseline: 347.00
350.47
(99.01%)
tests/benchmarks/test_queue_push_pop.py::test_queue_push_pop_benchmark_compile📈 view plot
🚷 view threshold
14.11 x 1e3
(0.00%)Baseline: 14.11 x 1e3
14.25 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
470.00
(0.00%)Baseline: 470.00
474.70
(99.01%)
🐰 View full continuous benchmarking report in Bencher

@codecov-commenter

codecov-commenter commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.14286% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.99%. Comparing base (90bd0f7) to head (130e61f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ternals/src/guppylang_internals/metadata/inline.py 70.58% 5 Missing ⚠️
...ternals/src/guppylang_internals/metadata/common.py 62.50% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1976      +/-   ##
==========================================
- Coverage   93.00%   92.99%   -0.01%     
==========================================
  Files         152      153       +1     
  Lines       14596    14627      +31     
==========================================
+ Hits        13575    13603      +28     
- Misses       1021     1024       +3     

☔ 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 marked this pull request as ready for review July 1, 2026 12:56
@acl-cqc acl-cqc requested a review from a team as a code owner July 1, 2026 12:56
@acl-cqc acl-cqc requested a review from cgh-qtnm July 1, 2026 12:56
@acl-cqc acl-cqc added this to the guppylang 1.x milestone Jul 1, 2026
@codspeed-hq

codspeed-hq Bot commented Jul 1, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 11 untouched benchmarks


Comparing acl/inline2 (130e61f) with main (2cd0459)

Open in CodSpeed

@cgh-qtnm cgh-qtnm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mostly looks good, a couple nits. You may also want to get a review from someone more familiar with Guppy compilation.

def set_expected_qubits(self, expected_qubits: int) -> None:
self._node_metadata[MetadataExpectedQubitsHint] = expected_qubits

def set_inline(self, inline: Literal["best_effort", "never"]) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be good to check the value of inline at runtime, to surface errors earlier for users who don't run type checkers.



@dataclass(frozen=True)
class MetadataInline(Metadata[Literal["best_effort", "never"]]):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Literal["best_effort", "never"] is repeated several times, probably worth extracting it into a common def.

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.

3 participants