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 Python TASO pass #180

Merged
merged 4 commits into from
Oct 10, 2023
Merged

feat: Add Python TASO pass #180

merged 4 commits into from
Oct 10, 2023

Conversation

lmondada
Copy link
Contributor

This is a useful Python binding to create the pytket-hyper extension on top of.

@lmondada lmondada requested a review from aborgna-q October 10, 2023 05:49
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.

Nice!

pyrs/src/pass.rs Outdated
/// This requires a `nam_6_3.rwr` file in the current directory. The location
/// can alternatively be specified using the `rewriter_dir` argument.
#[pyfunction]
fn nam_taso_optimise(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This has almost the same doc as taso_optimise. The fact that one rebases and the other doesn't should be clear there.

Perhaps just have a rebase optional parameter that defaults to true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I've removed the nam_ variant (I had originially thought I would write some of this in Python, but chose to have it all in Rust in the end).

1 => (vec![1], vec![timeout]),
_ => unreachable!(),
};
let optimiser = PyDefaultTasoOptimiser::load_precompiled(rewrite_dir.join("nam_6_3.rwr"));
Copy link
Collaborator

Choose a reason for hiding this comment

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

The hardcoded file is sketchy... add a TODO to remove it for now.

@lmondada lmondada requested a review from aborgna-q October 10, 2023 15:13
@lmondada lmondada enabled auto-merge October 10, 2023 15:16
@lmondada lmondada added this pull request to the merge queue Oct 10, 2023
Merged via the queue into main with commit fadb2c4 Oct 10, 2023
7 checks passed
@lmondada lmondada deleted the feat/taso-pass-py branch October 10, 2023 15:24
@lmondada lmondada mentioned this pull request Oct 10, 2023
github-merge-queue bot pushed a commit that referenced this pull request Oct 31, 2023
In hindsight this should have been part of #180.

However, note that the Python tests currently fail: I get a segmentation
fault, no idea why!

drive by: renamed `PyDefaultTasoOptimiser` -> `PyTasoOptimiser`.

---------

Co-authored-by: Agustin Borgna <[email protected]>
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