feat: add @inline decorator#1976
Conversation
|
| Branch | acl/inline2 |
| Testbed | Linux |
Click to view all benchmark results
| Benchmark | hugr_bytes | Benchmark Result bytes x 1e3 (Result Δ%) | Upper Boundary bytes x 1e3 (Limit %) | hugr_nodes | Benchmark 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%) |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
cgh-qtnm
left a comment
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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"]]): |
There was a problem hiding this comment.
Literal["best_effort", "never"] is repeated several times, probably worth extracting it into a common def.
Heavily based on #1942, also with a test that tket optimizations do what we expect.