- 
                Notifications
    
You must be signed in to change notification settings  - Fork 17
 
          feat!: Use borrow_array instead of value_array for array lowering
          #1166
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
borrow_array instead of value_array for array loweringborrow_array instead of value_array for array lowering
              
          
                guppylang-internals/src/guppylang_internals/std/_internal/compiler/array.py
          
            Show resolved
            Hide resolved
        
      …op) - break*2" This reverts commit f284ad6fc62b531474033d2a4b96a886569d232d.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks Good enough To Merge into main but must not release until #1306 is fixed.
| 
           This PR contains breaking changes to the public Python API. Breaking changes summary | 
    
          
 | 
    
| Branch | ts/borrow-arrays | 
| Testbed | Linux | 
🚨 2 Alerts
| Benchmark | Measure Units  | View | Benchmark Result (Result Δ%)  | Upper Boundary (Limit %)  | 
|---|---|---|---|---|
| tests/benchmarks/test_big_array.py::test_big_array_compile | hugr_nodes nodes x 1e3  | 📈 plot 🚷 threshold 🚨 alert (🔔)  | 6.59 x 1e3(+33.89%)Baseline: 4.92 x 1e3 | 4.97 x 1e3 (132.56%)  | 
| tests/benchmarks/test_big_array.py::test_big_array_compile | hugr_bytes bytes x 1e3  | 📈 plot 🚷 threshold 🚨 alert (🔔)  | 135.90 x 1e3(+5.14%)Baseline: 129.26 x 1e3 | 130.55 x 1e3 (104.10%)  | 
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 🚨 view alert (🔔)  | 135.90 x 1e3(+5.14%)Baseline: 129.26 x 1e3 | 130.55 x 1e3 (104.10%)  | 📈 view plot 🚷 view threshold 🚨 view alert (🔔)  | 6,590.00(+33.89%)Baseline: 4,922.06 | 4,971.28 (132.56%)  | 
| tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile | 📈 view plot 🚷 view threshold  | 19.77 x 1e3(-9.85%)Baseline: 21.92 x 1e3 | 22.14 x 1e3 (89.26%)  | 📈 view plot 🚷 view threshold  | 606.00(-12.24%)Baseline: 690.51 | 697.42 (86.89%)  | 
          Codecov Report❌ Patch coverage is  
 Additional details and impacted files@@            Coverage Diff             @@
##             main    #1166      +/-   ##
==========================================
- Coverage   93.50%   93.44%   -0.06%     
==========================================
  Files         123      123              
  Lines       11522    11432      -90     
==========================================
- Hits        10774    10683      -91     
- Misses        748      749       +1     ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
  | 
    
Part of quantinuum-dev/hugrverse#175 depends on: - CQCL/tket2#1170 - #1166
fixes #1306 The first part of the fix is to make affine-bounded type parameters (declared `[T : Drop]`) compile to Hugr TypeParams bounded by linear rather than Copyable; this fixes the error in the issue (invalid instantiation of Copyable-bounded function with type-arg `borrow_array<....>`), but raises a different problem: guppy does not insert the necessary `drop` operations, thus leading to `UnconnectedPort` validation errors (as the ports are now linear). This was because the `requires_drop` function used when inserting drops (#1090) inspects the `hugr_bound` property of type variables which also needs updating that affine-in-guppy things should become linear-in-Hugr. In this area, update some docs (RIP equatable), refactor using `super()`, and standardize use of `ht` for `hugr.tys`. Note that (contrary to python-semver-checks) this is not breaking: the APIs removed (optional extra parameter to TypeParam, and settable TypeParam::is_affine field) were only added in #1166, which has not yet been released.
🤖 I have created a release *beep* *boop* --- ## [0.25.0](guppylang-internals-v0.24.0...guppylang-internals-v0.25.0) (2025-10-28) ### ⚠ BREAKING CHANGES * (guppy-internals) Arrays are now lowered to `borrow_array`s instead of `value_array`s so elements do no longer need to be wrapped in options during lowering. * `checker.core.requires_monomorphization` renamed into `require_monomorphization` and now operating on all parameters simultaneously `tys.subst.BoundVarFinder` removed. Instead, use the new `bound_vars` property on types, arguments, and consts. `tys.parsing.parse_parameter` now requires a `param_var_mapping`. ### Features * compiler for modifiers ([#1287](#1287)) ([439ff1a](439ff1a)) * modifiers in CFG and its type checker (experimental) ([#1281](#1281)) ([fe85018](fe85018)) * Turn type parameters into dependent telescopes ([#1154](#1154)) ([b56e056](b56e056)) * update hugr, tket-exts and tket ([#1305](#1305)) ([6990d85](6990d85)) * Use `borrow_array` instead of `value_array` for array lowering ([#1166](#1166)) ([f9ef42b](f9ef42b)) ### Bug Fixes * compilation of affine-bounded type variables ([#1308](#1308)) ([49ecb49](49ecb49)) * Detect unsolved generic parameters even if they are unused ([#1279](#1279)) ([f830db0](f830db0)), closes [#1273](#1273) * Fix bug in symbolic pytket circuit loading with arrays ([#1302](#1302)) ([e6b90e8](e6b90e8)), closes [#1298](#1298) * Improve track_hugr_side_effects, adding Order edges from/to Input/Output ([#1311](#1311)) ([3c6ce7a](3c6ce7a)) * multiline loop arguments ([#1309](#1309)) ([836ef72](836ef72)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: Seyon Sivarajah <[email protected]>
🤖 I have created a release *beep* *boop* --- ## [0.21.6](guppylang-v0.21.5...guppylang-v0.21.6) (2025-10-29) ### Features * implement str() for PartialVector ([d85efc9](d85efc9)), closes [#1225](#1225) * **qsystem:** add `RNG.random_advance()` ([#1295](#1295)) ([f6271a2](f6271a2)) * Use `borrow_array` instead of `value_array` for array lowering ([#1166](#1166)) ([f9ef42b](f9ef42b)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: Seyon Sivarajah <[email protected]>
Closes #1072
BREAKING CHANGE: (guppy-internals) Arrays are now lowered to
borrow_arrays instead ofvalue_arrays so elements do no longer need to be wrapped in options during lowering.Requires a tket2 release with CQCL/tket2#975 for the execution tests to passRequires a hugr-llvm release for the lowering + hugr with copy discard handler + tket2 with adjustments + hugr-qis compiler with adjustments