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

fix: supporting encoding const-parametrized ops #80

Merged
merged 6 commits into from
Sep 5, 2023
Merged

fix: supporting encoding const-parametrized ops #80

merged 6 commits into from
Sep 5, 2023

Conversation

ss2165
Copy link
Member

@ss2165 ss2165 commented Sep 4, 2023

Also refactor json tests to use fixtures (easier to add new ones)

Check some command equality in those tests for circuits with matching command ordering (could parametrise the comparison function in future to skip this)

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.

Awesome!

Comment on lines 107 to 109
optype
.static_input()
.map(|_| PortOffset::new_incoming(sig.input.len()).into()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we shouldn't need to access portgraph primitives, nor should we set here what's the offset of the static input.

I can add an issue in hugr to implement an OpType::static_input_port (similar to OpType::other_port).

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, sounds good

src/circuit/command.rs Outdated Show resolved Hide resolved
src/json/encoder.rs Outdated Show resolved Hide resolved

// TODO: Update op.params. Leave untouched the ones that contain free variables.
let mut op: circuit_json::Operation = op.into_operation();
if !params.is_empty() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

With this we recover all parameters that have been encoded as inputs. It should be easy to support transparent pass-through of parameters we don't understand yet (e.g. x+1) and retrieve them from the metadata here.

This is OK for now, but I'll add a followup issue.

ss2165 and others added 3 commits September 5, 2023 09:42
@ss2165 ss2165 merged commit 110841b into main Sep 5, 2023
7 checks passed
@ss2165 ss2165 deleted the fix/params branch September 5, 2023 10:58
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