-
Notifications
You must be signed in to change notification settings - Fork 72
[IR] Export all common passes in onnxscript.ir.passes.common
#2270
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
Conversation
❌ 20 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
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.
Pull Request Overview
This PR exposes all common passes under the common namespace (onnxscript.ir.passes.common) so that users no longer need to import passes from nested modules.
- Updated import statements throughout the codebase to reference the new common namespace.
- Adjusted usage of pass classes in optimizer, version converter, and tests to follow the unified import convention.
- Updated documentation to reflect the new API structure.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/function_libs/torch_lib/ops_test_common.py | Changed import to use the new common namespace. |
onnxscript/version_converter/init.py | Replaced deep imports with common namespace; introduced an error in an error message string. |
onnxscript/optimizer/_optimizer.py | Updated pass usage with new namespace. |
onnxscript/optimizer/init.py | Updated pass usage with new namespace. |
onnxscript/ir/passes/common/onnx_checker.py | Updated property annotations with Literal types. |
onnxscript/ir/passes/common/inliner.py | Added documentation for the InlinePass class. |
onnxscript/ir/passes/common/clear_metadata_and_docstring.py | Added docstring for the ClearMetadataAndDocStringPass. |
onnxscript/ir/passes/common/init.py | Reorganized exports and removed module-setting logic. |
docs/ir/ir_api/ir_passes_common.md | Updated documentation to use automodule. |
Summary
Expose all common passes in
onnxscript.ir.passes.common
. Original apis are retained and unchanged (so not bc breaking).Rational
In actual usage, exposing the passes under
onnxscript.ir.passes.common.[module_name]
make the passes harder to be discovered. In pytorch, nn modules are exposed under the same namespace,torch.nn
, making it easier for user to find and use them. We use the same idea and expose all common passes underonnxscript.ir.passes.common
.Before this change, users will need to do
With this change, uses can now do
without having to know the module name.
Updated documentation page