Skip to content

Update pattern rewrite tutorial's code listing to use matchAndRewrite #1783

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

Merged
merged 4 commits into from
Jun 11, 2025

Conversation

paul0403
Copy link
Member

@paul0403 paul0403 commented Jun 4, 2025

Context:
In the latest llvm update, the individual match and rewrite methods were removed.
We update pattern rewrite tutorial's code listing to use matchAndRewrite.

Benefits:
Code listing on tutorial is correct.

@paul0403 paul0403 requested a review from a team June 4, 2025 11:47
Copy link
Contributor

github-actions bot commented Jun 4, 2025

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@paul0403
Copy link
Member Author

paul0403 commented Jun 4, 2025

@dime10 Please delete the branch docs/merge-unitary-gates-pass, that one has the old individual match and rewrite methods.

Also please delete the branches docs/pattern-rewrite-merge-unitary-tutorial and docs/pattern-rewrite-pass-tutorial. These are just me messing something up :)))))) 😅 😅 😿

The only branch that is supposed to exist is the docs/pattern-rewrite (which I update the documentation to point to)

@dime10
Copy link
Contributor

dime10 commented Jun 4, 2025

@dime10 Please delete the branch docs/merge-unitary-gates-pass, that one has the old individual match and rewrite methods.

Also please delete the branches docs/pattern-rewrite-merge-unitary-tutorial and docs/pattern-rewrite-pass-tutorial. These are just me messing something up :)))))) 😅 😅 😿

The only branch that is supposed to exist is the docs/pattern-rewrite (which I update the documentation to point to)

This PR doesn't update references to those branches, have they already been updated where appropriate?

@paul0403
Copy link
Member Author

paul0403 commented Jun 5, 2025

This PR doesn't update references to those branches, have they already been updated where appropriate?

Yes, this link is updated:

---    in this section: https://github.com/PennyLaneAI/catalyst/commit/9afcc3500e12e5a51b78dda76cd4d27bdf4c8905
+++    in this section: https://github.com/PennyLaneAI/catalyst/commit/2c84b2402cb67c62a6de5137bbf5b41afaa5a328

This is the full code we link to for the merge-chained-unitary-gates pass we use as an example in the pattern rewrite tutorial: https://docs.pennylane.ai/projects/catalyst/en/stable/dev/transforms.html#invoking-transformation-patterns:~:text=point%20is%20reached.-,Note,described%20in%20this%20section%3A%20https%3A//github.com/PennyLaneAI/catalyst/commit/9afcc3500e12e5a51b78dda76cd4d27bdf4c8905,-Writing%20more%20general

Currently this link points to the commit on branch docs/merge-unitary-gates-pass. However the code there will no longer work due to mlir removing the individual match and rewrite in the last update.

The new link points to the docs/pattern-rewrite branch, which I have updated to use the matchAndRewrite.

The branches docs/pattern-rewrite-merge-unitary-tutorial and docs/pattern-rewrite-pass-tutorial are just my mistakes and can be deleted, they are not used anywhere.

Copy link
Contributor

@dime10 dime10 left a comment

Choose a reason for hiding this comment

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

Thanks Paul!

@dime10
Copy link
Contributor

dime10 commented Jun 10, 2025

Currently this link points to the commit on branch docs/merge-unitary-gates-pass. However the code there will no longer work due to mlir removing the individual match and rewrite in the last update.

I'm going to leave this branch until the new version is available as "stable" in the docs (i.e. next release).

I deleted the other ones though.

paul0403 and others added 2 commits June 11, 2025 09:35
Co-authored-by: David Ittah <dime10@users.noreply.github.com>
@paul0403 paul0403 merged commit 915a505 into main Jun 11, 2025
38 checks passed
@paul0403 paul0403 deleted the paul0403/match-and-rewrite-tut-code-link branch June 11, 2025 14:22
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