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

refactor: remove MutableIO #1866

Open
wants to merge 2 commits into
base: 1819-dfbs-need-add_inoutput-like-the-functionbuilder
Choose a base branch
from

Conversation

doug-q
Copy link
Collaborator

@doug-q doug-q commented Jan 16, 2025

No description provided.

@doug-q doug-q requested a review from a team as a code owner January 16, 2025 10:26
@doug-q doug-q requested review from acl-cqc and removed request for a team January 16, 2025 10:26
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

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

Please upload report for BASE (1819-dfbs-need-add_inoutput-like-the-functionbuilder@bdc709b). Learn more about missing BASE report.

Files with missing lines Patch % Lines
hugr-core/src/builder/dataflow.rs 97.10% 0 Missing and 5 partials ⚠️
Additional details and impacted files
@@                                   Coverage Diff                                   @@
##             1819-dfbs-need-add_inoutput-like-the-functionbuilder    #1866   +/-   ##
=======================================================================================
  Coverage                                                        ?   86.58%           
=======================================================================================
  Files                                                           ?      194           
  Lines                                                           ?    35249           
  Branches                                                        ?    32062           
=======================================================================================
  Hits                                                            ?    30521           
  Misses                                                          ?     2965           
  Partials                                                        ?     1763           
Flag Coverage Δ
python 92.31% <ø> (?)
rust 86.01% <97.10%> (?)

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.

@@ -331,6 +352,46 @@ impl<T> HugrBuilder for DFGWrapper<Hugr, T> {
}
}

/// TODO perhaps these should be on HugrMut?
Copy link
Collaborator

@aborgna-q aborgna-q Jan 16, 2025

Choose a reason for hiding this comment

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

Yes, it should probably go there.
I'd add a single function though, parametric on the direction. (And add specializations that cast the output type if needed)

Also, docs :)

//
// Replaces the DFG under construction with new_optype and mutates the
// Output node by appending `output_type``.
pub(crate) fn add_output_impl(&mut self, new_optype: impl Into<OpType>, output_type: Type) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the same as add_input_impl bar the returned wire, which can be computed in add_input directly.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's not the same. They look at output/input respectively in the signature, and they call different "insert port" functions. You want the insert port functions to be combined, after which combining these makes more sense. Nice, will do.

@acl-cqc
Copy link
Contributor

acl-cqc commented Jan 21, 2025

This targets @qartik's #1824 right? On its own it looks a little odd and I don't see quite why you're doing it (less parametricity), but maybe with some docs I might. Or perhaps if you retarget this at main and say "closes #1816"? (right?)

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.

3 participants