-
Notifications
You must be signed in to change notification settings - Fork 59
[Gridsynth 1] Gridsynth decomposition #2140
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
base: main
Are you sure you want to change the base?
Conversation
.dep-versions
Outdated
| # For a custom PL version, update the package version here and at | ||
| # 'doc/requirements.txt' | ||
| pennylane=0.44.0.dev31 | ||
| pennylane=0.44.0.dev37 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the PL PR is merged, let's update to that dev version
| pennylane-lightning-kokkos==0.44.0-dev11 | ||
| pennylane-lightning==0.44.0-dev11 | ||
| pennylane==0.44.0.dev31 | ||
| git+https://github.com/PennyLaneAI/pennylane.git@rs-decomp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
| auto getSizeType = | ||
| rewriter.getFunctionType({f64Type, f64Type, i1Type}, {rewriter.getIndexType()}); | ||
| auto getSizeFunc = | ||
| catalyst::ensurefuncOrDeclare(rewriter, func, "rs_decomposition_get_size", getSizeType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know what is adding the _0 to the names? 🤔 doesn't seem to show up in the unit test for the pass, but seems like something in the end-to-end pipeline is adding it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparantly it's the --inline-nested-module pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Note: I have tried to use `MemRefT_int64_1d` directly from Types.h, but ran into | ||
| * C++ ABI errors (on macOS) leading to segmentation faults. Thus, we manually unpack the memref | ||
| * here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the reason might be that we usually pass a pointer to the memref descriptor, precisely to avoid abi issues with how structs are passed (apparently those can differ). We typically just use stack memory for this.
But since your use case is limited with a small signature, the direct approach might work well :)
sengthai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate this PR! @josephleekl
Here is part 1 of the review.
|
|
||
| void populateGridsynthPatterns(RewritePatternSet &patterns, double epsilon, bool pprBasis) | ||
| { | ||
| patterns.add<DecomposeCustomOpPattern>(patterns.getContext(), epsilon, pprBasis); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we include decomposing PPRotationArbitraryOp (e.g, qec.ppr.arbitrary ["Z"](%const) %q0,) in this PR as well? https://github.com/PennyLaneAI/catalyst/blob/3eefa0088455a088841631e80f621f89e717c22d/mlir/include/QEC/IR/QECDialect.td#L354C1-L355C1
Co-authored-by: Sengthai Heng <sengthai37@gmail.com>
Context:
This is the first of 2 PRs to implement the 'Gridsynth' pass in Catalyst. (Second PR). This PR only contains the MLIR pass itself, and a dummy implementation of the actual runtime discretization function in order to test the data transfer between the MLIR and the C++ runtime. The actual discretization runtime, along with python tests, will be part of the next PR.
This branch needs to be used in conjunction with the
rs-decompbranch in PennyLane.To test this:
Description of the Change:
Benefits:
Possible Drawbacks:
Related GitHub Issues:
[sc-102150]