Skip to content

feat: add exit operation to prelude #2008

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

Merged
merged 2 commits into from
Mar 20, 2025
Merged

feat: add exit operation to prelude #2008

merged 2 commits into from
Mar 20, 2025

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Mar 20, 2025

Closes #1966

panic ends all shots, exit ends current shot and signals next shot can still run

By default they are handled identically with an abort in codegen - I am not sure if this is the right thing to do.

@ss2165 ss2165 requested a review from a team as a code owner March 20, 2025 11:53
@ss2165 ss2165 requested review from aborgna-q and doug-q and removed request for aborgna-q March 20, 2025 11:53
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 96.07843% with 2 lines in your changes missing coverage. Please review.

Project coverage is 83.73%. Comparing base (907acca) to head (523416f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hugr-llvm/src/extension/prelude.rs 94.28% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2008      +/-   ##
==========================================
+ Coverage   83.71%   83.73%   +0.01%     
==========================================
  Files         209      209              
  Lines       39217    39266      +49     
  Branches    35888    35937      +49     
==========================================
+ Hits        32831    32878      +47     
  Misses       4542     4542              
- Partials     1844     1846       +2     
Flag Coverage Δ
python 92.03% <ø> (ø)
rust 82.96% <96.07%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Copy link

codspeed-hq bot commented Mar 20, 2025

CodSpeed Performance Report

Merging #2008 will improve performances by 14.15%

Comparing ss/exit (ba26b62) with main (907acca)

Summary

⚡ 1 improvements
✅ 21 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
singleton_subgraph[1000] 6.1 µs 5.4 µs +14.15%

Copy link
Collaborator

@doug-q doug-q left a comment

Choose a reason for hiding this comment

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

Thanks, important comment inline

@@ -340,6 +340,26 @@ pub fn add_prelude_extensions<'a, H: HugrView<Node = Node> + 'a>(
args.outputs.finish(context.builder(), returns)
}
})
.extension_op(prelude::PRELUDE_ID, prelude::EXIT_OP_ID, {
Copy link
Collaborator

Choose a reason for hiding this comment

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

These closures are not customisable. I think you should add emit_exit to PreludeCodegen and call it here. Users can provide their own implementation of emit_exit.

ss2165 added 2 commits March 20, 2025 12:56
panic ends all shots, exit ends current shot and signals next shot can still run

By default they are handled identically with an abort in codegen - I am not sure if this is the right thing to do.
@ss2165 ss2165 enabled auto-merge March 20, 2025 12:59
@ss2165 ss2165 added this pull request to the merge queue Mar 20, 2025
Merged via the queue into main with commit 6bd7665 Mar 20, 2025
25 checks passed
@ss2165 ss2165 deleted the ss/exit branch March 20, 2025 13:07
This was referenced Mar 20, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2025
## 🤖 New release

* `hugr-model`: 0.18.0 -> 0.18.1 (✓ API compatible changes)
* `hugr-core`: 0.15.0 -> 0.16.0 (✓ API compatible changes)
* `hugr-llvm`: 0.15.0 -> 0.16.0 (✓ API compatible changes)
* `hugr-passes`: 0.15.0 -> 0.16.0 (✓ API compatible changes)
* `hugr`: 0.15.0 -> 0.16.0 (✓ API compatible changes)
* `hugr-cli`: 0.15.0 -> 0.16.0 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr-model`

<blockquote>

##
[0.18.0](hugr-model-v0.17.1...hugr-model-v0.18.0)
- 2025-03-14

### Bug Fixes

- Hugr-model using undeclared derive_more features
([#1940](#1940))

### New Features

- *(hugr-model)* [**breaking**] Add `read_from_reader` and
`write_to_writer` for streaming reads and writes.
([#1871](#1871))
- `hugr-model` AST ([#1953](#1953))

### Refactor

- *(hugr-model)* Reexport `bumpalo` from `hugr-model`
([#1870](#1870))
</blockquote>

## `hugr-core`

<blockquote>

##
[0.16.0](hugr-core-v0.15.0...hugr-core-v0.16.0)
- 2025-03-21

### Bug Fixes

- correct `CallIndirect` tag from `FnCall` to `DataflowChild`
([#2006](#2006))
- StaticArrayValue serialisation
([#2009](#2009))

### New Features

- traits for transforming Types/TypeArgs/etc.
([#1991](#1991))
- add exit operation to prelude
([#2008](#2008))
- Add llvm codegen for collections.static_array
([#2003](#2003))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.16.0](hugr-llvm-v0.15.0...hugr-llvm-v0.16.0)
- 2025-03-21

### Bug Fixes

- Remove return from val_or_panic
([#1999](#1999))

### New Features

- add exit operation to prelude
([#2008](#2008))
- Add llvm codegen for collections.static_array
([#2003](#2003))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.16.0](hugr-passes-v0.15.0...hugr-passes-v0.16.0)
- 2025-03-21

### Bug Fixes

- correct `CallIndirect` tag from `FnCall` to `DataflowChild`
([#2006](#2006))
</blockquote>

## `hugr`

<blockquote>

##
[0.16.0](hugr-v0.15.0...hugr-v0.16.0)
- 2025-03-21

### Bug Fixes

- correct `CallIndirect` tag from `FnCall` to `DataflowChild`
([#2006](#2006))
- StaticArrayValue serialisation
([#2009](#2009))

### New Features

- traits for transforming Types/TypeArgs/etc.
([#1991](#1991))
- add exit operation to prelude
([#2008](#2008))
- Add llvm codegen for collections.static_array
([#2003](#2003))
- *(hugr-py)* Support envelope compression
([#1994](#1994))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.16.0](hugr-cli-v0.15.0...hugr-cli-v0.16.0)
- 2025-03-21

### New Features

- *(hugr-cli)* Nicer error when passing a non-envelope file
([#2007](#2007))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: Douglas Wilson <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.11.2](hugr-py-v0.11.1...hugr-py-v0.11.2)
(2025-03-21)


### Features

* add exit operation to prelude
([#2008](#2008))
([6bd7665](6bd7665))
* Add llvm codegen for collections.static_array
([#2003](#2003))
([f3dd145](f3dd145))
* **hugr-py:** Add `StaticArray` to standard extensions
([#1985](#1985))
([cf860f3](cf860f3)),
closes [#1984](#1984)
* **hugr-py:** Support envelope compression
([#1994](#1994))
([434c563](434c563))


### Bug Fixes

* StaticArrayValue serialisation
([#2009](#2009))
([3fe6bf8](3fe6bf8))


### Reverts

* Revert breaking change to StaticArrayValue
([33a2b49](33a2b49))

---
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: hugrbot <[email protected]>
@hugrbot hugrbot mentioned this pull request Mar 21, 2025
github-merge-queue bot pushed a commit that referenced this pull request Mar 21, 2025
## 🤖 New release

* `hugr-core`: 0.15.1 -> 0.15.2 (✓ API compatible changes)
* `hugr-llvm`: 0.15.1 -> 0.15.2
* `hugr-passes`: 0.15.1 -> 0.15.2
* `hugr`: 0.15.1 -> 0.15.2 (✓ API compatible changes)
* `hugr-cli`: 0.15.1 -> 0.15.2

<details><summary><i><b>Changelog</b></i></summary><p>

## `hugr-core`

<blockquote>

##
[0.15.2](hugr-core-v0.15.1...hugr-core-v0.15.2)
- 2025-03-21

### Bug Fixes

- Don't enable envelope compression by default (yet)
([#2014](#2014))
- Inconsistent behaviour in `SiblingSubgraph::from_nodes`
([#2011](#2011))
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.15.1](hugr-llvm-v0.15.0...hugr-llvm-v0.15.1)
- 2025-03-21

### Bug Fixes

- Remove return from val_or_panic
([#1999](#1999))

### New Features

- add exit operation to prelude
([#2008](#2008))
- Add llvm codegen for collections.static_array
([#2003](#2003))
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.15.1](hugr-passes-v0.15.0...hugr-passes-v0.15.1)
- 2025-03-21

### Bug Fixes

- correct `CallIndirect` tag from `FnCall` to `DataflowChild`
([#2006](#2006))
</blockquote>

## `hugr`

<blockquote>

##
[0.15.2](hugr-v0.15.1...hugr-v0.15.2)
- 2025-03-21

### Bug Fixes

- Don't enable envelope compression by default (yet)
([#2014](#2014))
- Inconsistent behaviour in `SiblingSubgraph::from_nodes`
([#2011](#2011))
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.15.1](hugr-cli-v0.15.0...hugr-cli-v0.15.1)
- 2025-03-21

### New Features

- *(hugr-cli)* Nicer error when passing a non-envelope file
([#2007](#2007))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
@hugrbot hugrbot mentioned this pull request Mar 22, 2025
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.

All ConstErrors we define should have signals > 1000
2 participants