-
Notifications
You must be signed in to change notification settings - Fork 72
[Passes] Consolidate DCE passes into common passes #2143
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
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 consolidates the dead code elimination passes by moving unused removal logic (nodes, functions, and opsets) into a common pass module, and it updates various parts of the codebase to reference these new passes.
- Consolidated removal passes into onnxscript.ir.passes.common.unused_removal.
- Refactored imports and function calls in rewriter, optimizer, and legacy optimizer/test files to use the new common passes.
- Removed deprecated modules related to unused removal.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
onnxscript/tools/benchmark/benchmark_helpers.py | Updated import for remove_unused_nodes to use the new optimizer API. |
onnxscript/rewriter/init.py | Refactored removal logic to instantiate and run a PassManager with the consolidated removal passes. |
onnxscript/optimizer/_remove_unused_function.py | Removed redundant implementation of unused functions removal. |
onnxscript/optimizer/_remove_unused.py | Removed deprecated module entirely. |
onnxscript/optimizer/_optimizer.py | Updated unused node removal call to use the consolidated implementation. |
onnxscript/optimizer/_legacy/_simple_function_folding_test.py | Updated tests to use the new removal functions instead of the old ones. |
onnxscript/optimizer/_legacy/_optimizer.py | Updated the legacy optimizer to reference the new removal functions. |
onnxscript/optimizer/init.py | Added new in-place removal functions that wrap the consolidated passes and updated imports accordingly. |
onnxscript/ir/passes/common/unused_removal.py | Introduced consolidated passes for removing unused nodes, functions, and opset imports. |
onnxscript/ir/passes/common/init.py | Added licensing headers for consistency. |
❌ 4 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 consolidates DCE passes into a common “unused_removal” pass to streamline the removal of unused nodes, functions, and opset imports. Key changes include:
- Updating import paths to use the new common passes.
- Refactoring the removal functions in optimizer and rewriter modules.
- Bumping the IR version in tests from 7 to 10.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
onnxscript/tools/benchmark/benchmark_helpers.py | Updated import path for remove_unused_nodes. |
onnxscript/rewriter/init.py | Replaced direct removal calls with a pass manager implementation. |
onnxscript/optimizer/_remove_unused_function.py and _remove_unused.py | Removed legacy implementations. |
onnxscript/optimizer/_optimizer.py and _legacy/_optimizer.py | Updated calls to removal functions with new import paths. |
onnxscript/optimizer/init.py | Added in-place removal functions that use the new passes. |
onnxscript/ir/passes/common/unused_removal_test.py | Updated IR versions in test examples. |
onnxscript/ir/passes/common/unused_removal.py | Added new passes for removing unused nodes, functions, and opsets. |
onnxscript/ir/passes/common/init.py | Minor update (copyright). |
Comments suppressed due to low confidence (1)
onnxscript/ir/passes/common/unused_removal.py:55
- [nitpick] The condition using 'len([o == 1 for o in optional_info]) == 0' can be less clear than explicitly checking for the presence of any True values (e.g., using 'if not any(optional_info):').
if len([o == 1 for o in optional_info]) == 0:
Consolidate DCE passes into common passes (unused_removal) for them to be available for pass users. Refactored usage. Added a pass to remove unused opset imports.
Consolidate DCE passes into common passes (unused_removal) for them to be available for pass users. Refactored usage. Added a pass to remove unused opset imports.
Consolidate DCE passes into common passes (unused_removal) for them to be available for pass users. Refactored usage. Added a pass to remove unused opset imports.
Consolidate DCE passes into common passes (unused_removal) for them to be available for pass users. Refactored usage. Added a pass to remove unused opset imports.