Skip to content

Conversation

croyzor
Copy link
Contributor

@croyzor croyzor commented Mar 19, 2025

We shouldn't have been emitting a ret in val_or_panic - this leads to behaviour where code that comes after the val_or_panic section isn't emitted.

For example, the test_s_to_u test has been altered to add a constant to the number after its converted. Before this fix it would always fail because the addition was skipped.

Copy link

codecov bot commented Mar 19, 2025

Codecov Report

Attention: Patch coverage is 87.32394% with 9 lines in your changes missing coverage. Please review.

Project coverage is 83.65%. Comparing base (5115bd5) to head (70cce10).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hugr-llvm/src/extension/int.rs 83.92% 6 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1999      +/-   ##
==========================================
- Coverage   83.66%   83.65%   -0.02%     
==========================================
  Files         209      209              
  Lines       38995    39020      +25     
  Branches    35666    35691      +25     
==========================================
+ Hits        32627    32643      +16     
- Misses       4528     4539      +11     
+ Partials     1840     1838       -2     
Flag Coverage Δ
python 92.03% <ø> (ø)
rust 82.87% <87.32%> (-0.02%) ⬇️

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.

@croyzor croyzor marked this pull request as ready for review March 19, 2025 09:32
@croyzor croyzor requested a review from a team as a code owner March 19, 2025 09:32
@croyzor croyzor requested review from doug-q and mark-koch and removed request for mark-koch March 19, 2025 09:32
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.

Looks good. Can you remove the libc emission as well? You'll need to pass a PreludeCodegen into the extension struct. e.g. https://github.com/CQCL/hugr-qir/blob/4fa0ed8565debf5c540fa2392e0eadb3e59de75d/src/rotation.rs#L25?

Unfortunately this is a breaking change, but I think we need to do it.

@croyzor
Copy link
Contributor Author

croyzor commented Mar 19, 2025

Looks good. Can you remove the libc emission as well? You'll need to pass a PreludeCodegen into the extension struct. e.g. https://github.com/CQCL/hugr-qir/blob/4fa0ed8565debf5c540fa2392e0eadb3e59de75d/src/rotation.rs#L25?

Unfortunately this is a breaking change, but I think we need to do it.

Yes! Sorry, forgot about that one

doug-q and others added 2 commits March 19, 2025 11:08
Co-authored-by: Craig Roy <craig.roy@quantinuum.com>
@croyzor croyzor requested a review from doug-q March 19, 2025 11:10
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!

@croyzor croyzor added this pull request to the merge queue Mar 19, 2025
Merged via the queue into main with commit f433b39 Mar 19, 2025
25 checks passed
@croyzor croyzor deleted the cr/fix-u<->s-conversions branch March 19, 2025 12:02
This was referenced Mar 19, 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 <douglas.wilson@quantinuum.com>
@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.

2 participants