Skip to content
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

feat: add xor to logic extension #1911

Merged
merged 3 commits into from
Feb 6, 2025
Merged

feat: add xor to logic extension #1911

merged 3 commits into from
Feb 6, 2025

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Feb 6, 2025

Closes #1418

@ss2165 ss2165 requested a review from a team as a code owner February 6, 2025 14:38
@ss2165 ss2165 requested a review from aborgna-q February 6, 2025 14:38
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 83.77%. Comparing base (6489977) to head (ea71a57).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
hugr-llvm/src/extension/logic.rs 20.00% 0 Missing and 4 partials ⚠️
hugr-core/src/std_extensions/logic.rs 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1911   +/-   ##
=======================================
  Coverage   83.77%   83.77%           
=======================================
  Files         196      196           
  Lines       37380    37374    -6     
  Branches    34193    34187    -6     
=======================================
- Hits        31316    31311    -5     
+ Misses       4287     4285    -2     
- Partials     1777     1778    +1     
Flag Coverage Δ
python 92.34% <ø> (ø)
rust 82.97% <50.00%> (-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.

Copy link
Collaborator

@aborgna-q aborgna-q left a comment

Choose a reason for hiding this comment

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

🤖

Comment on lines 61 to 64
let mut acc = inputs[0];
for inp in inputs.into_iter().skip(1) {
acc = builder.build_xor(acc, inp, "")?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure why we do it generically instead of just

builder.build_xor(inputs[0], inputs[1], "")

and even for the n-inputs case, it could use a fold instead

inputs[1..].fold(Ok(inputs[0]), |a, b| builder.build_xor(a, b, ""))

(no try_reduce yet :/ )

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is vestigial from when the ops were generic, have simplified as a drive-by

Copy link
Collaborator

@aborgna-q aborgna-q Feb 6, 2025

Choose a reason for hiding this comment

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

Thanks! Looks like an insta test got some parameter order fixed (in equality).
I'll update the snapshot.

@ss2165 ss2165 enabled auto-merge February 6, 2025 14:56
@ss2165 ss2165 added this pull request to the merge queue Feb 6, 2025
Merged via the queue into main with commit 5e7c81e Feb 6, 2025
23 of 24 checks passed
@ss2165 ss2165 deleted the ss/xor branch February 6, 2025 15:52
github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.10.3](hugr-py-v0.10.2...hugr-py-v0.10.3)
(2025-02-17)


### Features

* add xor to logic extension
([#1911](#1911))
([5e7c81e](5e7c81e))
* **hugr-llvm:** Emit ipow
([#1839](#1839))
([89e671a](89e671a))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
github-merge-queue bot pushed a commit that referenced this pull request Feb 24, 2025
## 🤖 New release

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

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

## `hugr`

<blockquote>

##
[0.14.4](hugr-v0.14.3...hugr-v0.14.4)
- 2025-02-24

### Bug Fixes

- delegate default impls in HugrView (#1921)

### New Features

- add xor to logic extension (#1911)
- Add `Type::as_sum` and `SumType::variants`. (#1914)
- Add `HugrMutInternals::insert_ports` (#1915)
</blockquote>

## `hugr-core`

<blockquote>

##
[0.14.4](hugr-core-v0.14.3...hugr-core-v0.14.4)
- 2025-02-24

### Bug Fixes

- delegate default impls in HugrView (#1921)

### New Features

- add xor to logic extension (#1911)
- Add `Type::as_sum` and `SumType::variants`. (#1914)
- Add `HugrMutInternals::insert_ports` (#1915)
</blockquote>

## `hugr-llvm`

<blockquote>

##
[0.14.4](hugr-llvm-v0.14.3...hugr-llvm-v0.14.4)
- 2025-02-24

### New Features

- add xor to logic extension (#1911)
- *(hugr-llvm)* Add extension points to `PreludeCodegen` for customising
string lowering (#1918)
</blockquote>

## `hugr-passes`

<blockquote>

##
[0.14.3](hugr-passes-v0.14.2...hugr-passes-v0.14.3)
- 2025-02-05

### Bug Fixes

- Export `RemoveDeadFuncsError` (#1883)
- const-folding Module keeps at least "main" (#1901)

### Documentation

- Fix deprecation warning messages (#1891)
</blockquote>

## `hugr-cli`

<blockquote>

##
[0.14.1](hugr-cli-v0.14.0...hugr-cli-v0.14.1)
- 2024-12-18

### New Features

- Print `hugr-cli`'s correct version when using '--version' (#1790)
</blockquote>


</p></details>

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

Add Xor to the logic extension
2 participants