-
Notifications
You must be signed in to change notification settings - Fork 59
Migrate the unified compiler to Catalyst #2199
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
|
Oh, the +20k lines 🤖 |
I'm not really sure what the review procedure should be for this PR. Beyond linting and updates to which modules we're referencing ( |
…neAI/catalyst into migrate-unified-compiler
…_in_dim verify methods
.codecov.yml
Outdated
| ignore: | ||
| - "frontend/catalyst/python_interface" |
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.
So far, we have been omitting the unified compiler's source code from test coverage reports. I have open PRs in pennylane to work towards improving coverage, but until then, we need to keep omitting the unified compiler from coverage reports.
| # Install graphviz for testing the mlir-op-graph integration | ||
| sudo apt-get install -y graphviz | ||
| python3 -m pip install graphviz |
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.
If it is preferred to install graphviz in a different manner, please let me know.
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.
We should be able to get a green make tests locally when installing Catalyst from source by following the installation guide. The problem with this approach is that it installs graphviz for ci tests but locally you would get an error if you don't have it installed. So I think we should either add graphviz to the requirements.txt and update the installation guide or completely decouple the python_interface tests from current Catalyst test suit, so it wouldn't be run in a regular call to make tests. I am fine with both but maybe the latter is more in line with previous discussions about making python_interface independent from Catalyst. What do you think?
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.
Another solution is that instead of letting those tests fail, I could just pytest.importoskip("graphviz"). Thoughts? It wouldn't decouple visualization tests from catalyst CI, but there won't be any failures.
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.
That could work, but I just realized we want to include the visualization module in the release right? Then maybe should we actually have the related tests run in the CI or the wheels or both? Also after adding the pytest.importoskip("graphviz") let's trigger wheels to make sure the tests there don't fail.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2199 +/- ##
==========================================
+ Coverage 97.55% 97.72% +0.16%
==========================================
Files 93 93
Lines 11180 11180
Branches 1065 1065
==========================================
+ Hits 10907 10926 +19
+ Misses 208 192 -16
+ Partials 65 62 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Should I include wheel builds for this PR? |
| irdl_options = [ParsePropInAttrDict()] | ||
|
|
||
| # pylint: disable=too-many-branches | ||
| def verify_(self): |
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.
@mehrdad2m CodeFactor was complaining about DynamicBroadcastInDimOp.verify_ being too complex, so I broke it down into multiple smaller methods. Let me know if the split makes sense to you.
|
|
||
| # pylint: disable=no-member | ||
| # pylint: disable=too-many-branches | ||
| def verify_(self): |
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.
@mehrdad2m same thing here, CodeFactor was complaining about the method being too complex.
**Context:** Migrates the `chore/xdsl-utils` branch from PennyLane. **Description of the Change:** Renames the visualization module to inspection and improves several xDSL parsing utilities within the python interface. **Benefits:** Simplifies and augments existing utility functions within the ~visualization~ inspection module **Possible Drawbacks:** **Related GitHub Issues:** [sc-104851]
mehrdad2m
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 noticed there are still some remaining references to the Python compiler, so I added some suggestions for that.
frontend/catalyst/python_interface/doc/unified_compiler_cookbook.rst
Outdated
Show resolved
Hide resolved
frontend/test/pytest/python_interface/dialects/test_stablehlo_dialect.py
Outdated
Show resolved
Hide resolved
frontend/test/pytest/python_interface/inspection/test_draw_unified_compiler.py
Outdated
Show resolved
Hide resolved
| # Install graphviz for testing the mlir-op-graph integration | ||
| sudo apt-get install -y graphviz | ||
| python3 -m pip install graphviz |
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.
We should be able to get a green make tests locally when installing Catalyst from source by following the installation guide. The problem with this approach is that it installs graphviz for ci tests but locally you would get an error if you don't have it installed. So I think we should either add graphviz to the requirements.txt and update the installation guide or completely decouple the python_interface tests from current Catalyst test suit, so it wouldn't be run in a regular call to make tests. I am fine with both but maybe the latter is more in line with previous discussions about making python_interface independent from Catalyst. What do you think?
|
I have confirmed locally in a Python environment without |
This PR migrates all source code for the unified compiler to Catalyst.
Changes:
python_interfacesubmodule tofrontend/catalyst.python_interfacesubmodule tofrontend/test/pytest.pennylane.compiler.python_compiler.utils.pyfile tofrontend/test/pytestto house data that is used by multiple test files.Remaining work:
catalyst.python_interfaceinstead ofpennylane.compiler.python_compiler.Questions for reviewers:
xdslandxdsl-jaxbe hard dependencies?Future work:
frontend/test/pytestfolder and adapting them so that they can be moved to thefrontend/test/litfolder.[sc-99039] [sc-98172]