Skip to content

Commit

Permalink
Remove copy_propagation passes
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhambhokare1 committed May 2, 2024
1 parent 496312c commit 7a9e68a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 152 deletions.
27 changes: 14 additions & 13 deletions docs/optimizer/optimize.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,20 @@ The `onnxscript.optimizer.optimize` call takes in several optional parameters th

## Description of optimizations applied by `onnxscript.optimizer.optimize`

```{eval-rst}
.. autosummary::
:nosignatures:
onnxscript.optimizer.constant_folding.fold_constants
onnxscript.optimizer.copy_propagation.do_copy_propagation
onnxscript.optimizer.copy_propagation.do_sequence_simplification
onnxscript.optimizer.remove_unused.remove_unused_nodes
onnxscript.optimizer.remove_unused_function.remove_unused_functions
onnxscript.optimizer.simple_function_folding.inline_functions_with_unused_outputs
onnxscript.optimizer.simple_function_folding.inline_simple_functions
```
:::{table}

Check warning

Code scanning / lintrunner

EDITORCONFIG-CHECKER/editorconfig Warning documentation

Trailing whitespace
:widths: auto
:align: center

| Optimization 'onnxscript.optimizer.` + .. | Description |
| - | - |
| **Constant folding** <br>`constant_folding.fold_constants` | Applies constant folding optimization to the model. |
| **Constant propagation** <br>`constant_folding.fold_constants` | Applies constant propagation optimization to the model. Applied as part of the constant folding optimization. |
| **Sequence simplification** <br>`constant_folding.fold_constants` | Simplifies Sequence based ops (SequenceConstruct, ConcatFromSequence) present in the model. Applied as part of the constant folding optimization. |
| **Remove unused nodes** <br>`remove_unused.remove_unused_nodes` | Removes unused nodes from the model. |
| **Remove unused functions** <br>`remove_unused_function.remove_unused_functions` | Removes unused function protos from the model. |
| **Inline functions with unused outputs** <br>`simple_function_folding.inline_functions_with_unused_outputs` | Inlines function nodes that have unused outputs. |
| **Inline simple functions** <br>`simple_function_folding.inline_simple_functions` | Inlines simple functions based on a node count threshold. |
:::

## List of pattern rewrite rules applied by `onnxscript.optimizer.optimize`

Expand Down
7 changes: 0 additions & 7 deletions onnxscript/optimizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

from onnxscript import rewriter
from onnxscript.optimizer.constant_folding import fold_constants
from onnxscript.optimizer.copy_propagation import (
do_copy_propagation,
do_sequence_simplification,
)
from onnxscript.optimizer.remove_unused import remove_unused_nodes
from onnxscript.optimizer.remove_unused_function import remove_unused_functions
from onnxscript.optimizer.simple_function_folding import (
Expand Down Expand Up @@ -108,14 +104,11 @@ def optimize(
node.name,
)

# do_sequence_simplification(model)
return model


__all__ = [
"fold_constants",
"remove_unused_nodes",
"optimize",
"do_copy_propagation",
"do_sequence_simplification",
]
83 changes: 0 additions & 83 deletions onnxscript/optimizer/copy_propagation.py

This file was deleted.

49 changes: 0 additions & 49 deletions onnxscript/optimizer/copy_propagation_test.py

This file was deleted.

0 comments on commit 7a9e68a

Please sign in to comment.