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

PHIR generation #12

Merged
merged 8 commits into from
Oct 18, 2023
Merged

PHIR generation #12

merged 8 commits into from
Oct 18, 2023

Conversation

qartik
Copy link
Member

@qartik qartik commented Oct 18, 2023

Just a first pass. Perhaps can be improved a lot.

for shard in enumerate(shards):
s = shard[1]
for shard in shards:
s = shard
Copy link
Member Author

@qartik qartik Oct 18, 2023

Choose a reason for hiding this comment

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

I believe the typing issue in the above two lines was the root cause behind all previous type ignores below.

Copy link
Collaborator

Choose a reason for hiding this comment

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

huh interesting, mypy couldn't determine that shard had type (int, Shard) and s had type Shard?

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 don't think the problem originated from mypy. We needed to be more careful while writing the code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Definitely agree that enumerate shouldn't be used unless both the index and the element in the collection are both being used.

def place_and_route(
machine: Machine,
shards: list[Shard],
) -> list[tuple[list[int], list[Shard], float]]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks great, but as a note for later, we should definitely come up with some good type aliases for some of these things to make the dataflow a bit more readable.

Copy link
Collaborator

@peter-campora peter-campora 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 for getting us to having end to end QASM => PHIR for simple circuits!

@peter-campora peter-campora merged commit ac3c955 into main Oct 18, 2023
1 check passed
@qartik qartik deleted the phir-out branch October 19, 2023 16:02
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.

4 participants