refactor: do tracing during checking - #2104
Conversation
add abstractproperty CompiledCallableDef.call_effects, some breaks + typeignore modifier_compiler: grab effects out of FunctionBuilder (via private field) WIP what LocalCalls are there add effects= to hugr_op, order QAlloc/QFree - fixes test_array.py::test_take_put
…IDE_EFFECTS This reverts commit 99b58d5.
| #: Reference to the global compilation context. | ||
| ctx: CompilerContext | ||
| #: Context used to translate Guppy types into HUGR types. | ||
| ctx: ToHugrContext |
There was a problem hiding this comment.
We might wanna get rid of this first; None implements ToHugrContext 😆
| TraceableCall: TypeAlias = GlobalCall | AbortExpr | StateOutputExpr | ||
|
|
||
|
|
||
| @dataclass(frozen=True) |
There was a problem hiding this comment.
Ok, so a bunch of these dataclasses were written by AI...I have tidied them up a bit (and fixed its TraceCall which was totally wrong ;-) )...I think they are correct now!
There was a problem hiding this comment.
Moreover, these might be better in a separate tracing/builder.py; I did start off with that and had circular-import problems but these could be solved (just, all the four methods in TraceBuilder will have to locally import from state.py)
|
| Project | guppylang |
| Branch | acl/tracing_refactor |
| 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 | 66.41 x 1e3(0.00%)Baseline: 66.41 x 1e3 | 67.07 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 4,595.00(0.00%)Baseline: 4,595.00 | 4,640.95 (99.01%) |
| tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile | 📈 view plot 🚷 view threshold | 28.78 x 1e3(0.00%)Baseline: 28.78 x 1e3 | 29.06 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 1,301.00(0.00%)Baseline: 1,301.00 | 1,314.01 (99.01%) |
| tests/benchmarks/test_queue_push_pop.py::test_queue_push_benchmark_compile | 📈 view plot 🚷 view threshold | 7.84 x 1e3(0.00%)Baseline: 7.84 x 1e3 | 7.92 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 310.00(0.00%)Baseline: 310.00 | 313.10 (99.01%) |
| tests/benchmarks/test_queue_push_pop.py::test_queue_push_pop_benchmark_compile | 📈 view plot 🚷 view threshold | 10.77 x 1e3(0.00%)Baseline: 10.77 x 1e3 | 10.88 x 1e3 (99.01%) | 📈 view plot 🚷 view threshold | 411.00(0.00%)Baseline: 411.00 | 415.11 (99.01%) |
| returns = self.compile_abort(node) | ||
| return self._pack_returns(returns, get_type(node)) | ||
|
|
||
| def compile_abort(self, node: AbortExpr) -> list[Wire]: |
There was a problem hiding this comment.
These helpers are a bit ugly....could do with a neater way
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2104 +/- ##
==========================================
+ Coverage 93.27% 93.28% +0.01%
==========================================
Files 154 154
Lines 14807 14966 +159
==========================================
+ Hits 13811 13961 +150
- Misses 996 1005 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 99.14%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
Big step towards #1592, but perhaps not a total solution - at the least, I expect/hope this to enable more cleanups, but perhaps they could follow in later PRs....
The "99%" performance degradation is for a benchmark that just calls
check()so since this now executes the user's python code (whereas it didn't before)....that's expected. (Albeit 😆 🤣 )