feat(py, core, llvm): add is_borrowed op for BorrowArray#2610
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2610 +/- ##
==========================================
+ Coverage 83.32% 83.35% +0.02%
==========================================
Files 256 256
Lines 50491 50618 +127
Branches 46014 46141 +127
==========================================
+ Hits 42074 42195 +121
+ Misses 6065 6061 -4
- Partials 2352 2362 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3541254 to
eedf03d
Compare
is_borrowed op for BorrowArrayis_borrowed op for BorrowArray
91f42b2 to
439f09c
Compare
6556085 to
82ea2fe
Compare
5be9249 to
d5d5999
Compare
82ea2fe to
ed70a19
Compare
acl-cqc
left a comment
There was a problem hiding this comment.
Concerns about use of word "check" is pure pedantry, but I'm not convinced about including this as a MaskCheck
| DFGBuilder::new(Signature::new(vec![arr_ty.clone()], vec![qb_t(), arr_ty])) | ||
| .unwrap(); | ||
| let idx = builder.add_load_value(ConstUsize::new(2)); | ||
| let [arr] = builder.input_wires_arr(); |
There was a problem hiding this comment.
do an is-borrowed before too, and return two booleans
There was a problem hiding this comment.
don't see the reason, this is not an execution test, just of building the op
There was a problem hiding this comment.
Well I was thinking you could use this in the execution test...
There was a problem hiding this comment.
the general pattern is to keep the tests very independent and I would like to maintain that
ed70a19 to
bb9384d
Compare
chore: update extension
bb9384d to
af68efd
Compare
| vec![array_ty.clone(), usize_t], | ||
| vec![crate::extension::prelude::bool_t(), array_ty], |
There was a problem hiding this comment.
The type order is a bit weird, with the array in first place for the input but 2nd in the output.
But I see that we're doing the same with borrow so 🤷
## 🤖 New release * `hugr-model`: 0.23.0 -> 0.24.0 * `hugr-core`: 0.23.0 -> 0.24.0 (✓ API compatible changes) * `hugr-llvm`: 0.23.0 -> 0.24.0 (✓ API compatible changes) * `hugr-passes`: 0.23.0 -> 0.24.0 (✓ API compatible changes) * `hugr-persistent`: 0.3.0 -> 0.3.1 (✓ API compatible changes) * `hugr`: 0.23.0 -> 0.24.0 (✓ API compatible changes) * `hugr-cli`: 0.23.0 -> 0.24.0 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.23.0](hugr-model-v0.22.4...hugr-model-v0.23.0) - 2025-09-30 ### Bug Fixes - [**breaking**] Appease `cargo-audit` by replacing unmaintained dependencies ([#2572](#2572)) ### New Features - Documentation and error hints ([#2523](#2523)) </blockquote> ## `hugr-core` <blockquote> ## [0.24.0](hugr-core-v0.23.0...hugr-core-v0.24.0) - 2025-10-13 ### Bug Fixes - Preserve offset for CFG edges when serializing to JSON ([#2606](#2606)) ### New Features - LLVM lowering for borrow arrays using bitmasks ([#2574](#2574)) - *(py, core, llvm)* add `is_borrowed` op for BorrowArray ([#2610](#2610)) ### Refactor - [**breaking**] consistent inout order in borrow array ([#2621](#2621)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.24.0](hugr-llvm-v0.23.0...hugr-llvm-v0.24.0) - 2025-10-13 ### New Features - LLVM lowering for borrow arrays using bitmasks ([#2574](#2574)) - *(py, core, llvm)* add `is_borrowed` op for BorrowArray ([#2610](#2610)) ### Refactor - [**breaking**] consistent inout order in borrow array ([#2621](#2621)) </blockquote> ## `hugr-passes` <blockquote> ## [0.24.0](hugr-passes-v0.23.0...hugr-passes-v0.24.0) - 2025-10-13 ### New Features - Add handler for copying / discarding borrow arrays to default lineariser ([#2602](#2602)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.3.1](hugr-persistent-v0.3.0...hugr-persistent-v0.3.1) - 2025-10-13 ### Bug Fixes - *(test)* No extension serialisation in persistent-hugr testing ([#2612](#2612)) ### New Features - *(persistent)* Redesign CommitStateSpace, bound Commit lifetime ([#2534](#2534)) </blockquote> ## `hugr` <blockquote> ## [0.24.0](hugr-v0.23.0...hugr-v0.24.0) - 2025-10-13 ### Bug Fixes - Preserve offset for CFG edges when serializing to JSON ([#2606](#2606)) ### New Features - Add handler for copying / discarding borrow arrays to default lineariser ([#2602](#2602)) - LLVM lowering for borrow arrays using bitmasks ([#2574](#2574)) - *(py, core, llvm)* add `is_borrowed` op for BorrowArray ([#2610](#2610)) ### Refactor - [**breaking**] consistent inout order in borrow array ([#2621](#2621)) </blockquote> ## `hugr-cli` <blockquote> ## [0.24.0](hugr-cli-v0.23.0...hugr-cli-v0.24.0) - 2025-10-13 ### Documentation - update cli readme ([#2601](#2601)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
🤖 I have created a release *beep* *boop* --- ## [0.14.0](hugr-py-v0.13.1...hugr-py-v0.14.0) (2025-10-13) ### ⚠ BREAKING CHANGES * BorrowArray::{borrow, is_borrowed} return types have been swapped such that the array is first. ### Features * Add more options to `DotRenderer` config ([#2540](#2540)) ([45f7573](45f7573)) * Allow importing from model data to python. ([#2581](#2581)) ([4fb0a5e](4fb0a5e)) * **py, core, llvm:** add `is_borrowed` op for BorrowArray ([#2610](#2610)) ([1cd08ef](1cd08ef)), closes [#2569](#2569) ### Bug Fixes * Preserve offset for CFG edges when serializing to JSON ([#2606](#2606)) ([69a126d](69a126d)) ### Code Refactoring * consistent inout order in borrow array ([#2621](#2621)) ([8fc59f3](8fc59f3)) --- 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]>
## 🤖 New release * `hugr-model`: 0.24.0 -> 0.24.1 (✓ API compatible changes) * `hugr-core`: 0.24.0 -> 0.24.1 (✓ API compatible changes) * `hugr-llvm`: 0.24.0 -> 0.24.1 (✓ API compatible changes) * `hugr-passes`: 0.24.0 -> 0.24.1 (✓ API compatible changes) * `hugr-persistent`: 0.3.1 -> 0.3.2 (✓ API compatible changes) * `hugr`: 0.24.0 -> 0.24.1 (✓ API compatible changes) * `hugr-cli`: 0.24.0 -> 0.24.1 (✓ API compatible changes) <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.24.1](hugr-model-v0.24.0...hugr-model-v0.24.1) - 2025-11-03 ### Bug Fixes - Correct conversion of `table::Term::Tuple` to `ast::Term` ([#2653](#2653)) </blockquote> ## `hugr-core` <blockquote> ## [0.24.1](hugr-core-v0.24.0...hugr-core-v0.24.1) - 2025-11-03 ### Bug Fixes - validation outside entrypoint, normalize_cfgs w/ nonlocal edges ([#2633](#2633)) - SiblingSubgraph::try_from_nodes for non-entrypoint region ([#2655](#2655)) - Correct conversion of `table::Term::Tuple` to `ast::Term` ([#2653](#2653)) ### New Features - track package descriptions when loading ([#2639](#2639)) - *(cli)* describe sub-command ([#2650](#2650)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.24.0](hugr-llvm-v0.23.0...hugr-llvm-v0.24.0) - 2025-10-13 ### New Features - LLVM lowering for borrow arrays using bitmasks ([#2574](#2574)) - *(py, core, llvm)* add `is_borrowed` op for BorrowArray ([#2610](#2610)) ### Refactor - [**breaking**] consistent inout order in borrow array ([#2621](#2621)) </blockquote> ## `hugr-passes` <blockquote> ## [0.24.1](hugr-passes-v0.24.0...hugr-passes-v0.24.1) - 2025-11-03 ### Bug Fixes - validation outside entrypoint, normalize_cfgs w/ nonlocal edges ([#2633](#2633)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.3.2](hugr-persistent-v0.3.1...hugr-persistent-v0.3.2) - 2025-11-03 ### New Features - *(persistent)* More efficient HugrView iterators for PersistentHugr ([#2595](#2595)) </blockquote> ## `hugr` <blockquote> ## [0.24.1](hugr-v0.24.0...hugr-v0.24.1) - 2025-11-03 ### Bug Fixes - validation outside entrypoint, normalize_cfgs w/ nonlocal edges ([#2633](#2633)) - SiblingSubgraph::try_from_nodes for non-entrypoint region ([#2655](#2655)) - Correct conversion of `table::Term::Tuple` to `ast::Term` ([#2653](#2653)) ### New Features - track package descriptions when loading ([#2639](#2639)) - *(cli)* describe sub-command ([#2650](#2650)) </blockquote> ## `hugr-cli` <blockquote> ## [0.24.1](hugr-cli-v0.24.0...hugr-cli-v0.24.1) - 2025-11-03 ### New Features - track package descriptions when loading ([#2639](#2639)) - *(cli)* describe sub-command ([#2650](#2650)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
## 🤖 New release * `hugr-model`: 0.24.1 -> 0.24.2 * `hugr-core`: 0.24.1 -> 0.24.2 * `hugr-llvm`: 0.24.1 -> 0.24.2 * `hugr-passes`: 0.24.1 -> 0.24.2 (✓ API compatible changes) * `hugr`: 0.24.1 -> 0.24.2 (✓ API compatible changes) * `hugr-cli`: 0.24.1 -> 0.24.2 (✓ API compatible changes) * `hugr-persistent`: 0.3.2 -> 0.3.3 <details><summary><i><b>Changelog</b></i></summary><p> ## `hugr-model` <blockquote> ## [0.24.1](hugr-model-v0.24.0...hugr-model-v0.24.1) - 2025-11-03 ### Bug Fixes - Correct conversion of `table::Term::Tuple` to `ast::Term` ([#2653](#2653)) </blockquote> ## `hugr-core` <blockquote> ## [0.24.1](hugr-core-v0.24.0...hugr-core-v0.24.1) - 2025-11-03 ### Bug Fixes - validation outside entrypoint, normalize_cfgs w/ nonlocal edges ([#2633](#2633)) - SiblingSubgraph::try_from_nodes for non-entrypoint region ([#2655](#2655)) - Correct conversion of `table::Term::Tuple` to `ast::Term` ([#2653](#2653)) ### New Features - track package descriptions when loading ([#2639](#2639)) - *(cli)* describe sub-command ([#2650](#2650)) </blockquote> ## `hugr-llvm` <blockquote> ## [0.24.0](hugr-llvm-v0.23.0...hugr-llvm-v0.24.0) - 2025-10-13 ### New Features - LLVM lowering for borrow arrays using bitmasks ([#2574](#2574)) - *(py, core, llvm)* add `is_borrowed` op for BorrowArray ([#2610](#2610)) ### Refactor - [**breaking**] consistent inout order in borrow array ([#2621](#2621)) </blockquote> ## `hugr-passes` <blockquote> ## [0.24.2](hugr-passes-v0.24.1...hugr-passes-v0.24.2) - 2025-11-03 ### Bug Fixes - ReplaceTypes: operate on whole Hugr, with set_regions ([#2662](#2662)) </blockquote> ## `hugr` <blockquote> ## [0.24.2](hugr-v0.24.1...hugr-v0.24.2) - 2025-11-03 ### Bug Fixes - ReplaceTypes: operate on whole Hugr, with set_regions ([#2662](#2662)) </blockquote> ## `hugr-cli` <blockquote> ## [0.24.1](hugr-cli-v0.24.0...hugr-cli-v0.24.1) - 2025-11-03 ### New Features - track package descriptions when loading ([#2639](#2639)) - *(cli)* describe sub-command ([#2650](#2650)) </blockquote> ## `hugr-persistent` <blockquote> ## [0.3.2](hugr-persistent-v0.3.1...hugr-persistent-v0.3.2) - 2025-11-03 ### New Features - *(persistent)* More efficient HugrView iterators for PersistentHugr ([#2595](#2595)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/).
Closes #2569