-
Notifications
You must be signed in to change notification settings - Fork 66
Updates to the rewriter tutorial #2397
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
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
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 updates the rewriter tutorial documentation by improving explanations and demonstrating an alternative class-based approach to defining rewrite rules.
- Introduces a class-based rewrite rule example in the tutorial.
- Enhances documentation on conditional rewrite rules and commutativity handling.
- Updates the index order and adjusts descriptive text in several markdown files.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
docs/tutorial/rewriter/simple_example.md | Refactored the tutorial to demonstrate an alternative class-based definition for rewrite rules. |
docs/tutorial/rewriter/rewrite_patterns.md | Updated text to indicate that rewrite rules are conditional. |
docs/tutorial/rewriter/examples/erfgelu.py | Added a new class-based rewrite rule implementation example. |
docs/tutorial/rewriter/conditional_rewrite.md | Revised explanation for condition checking with additional IR details. |
docs/tutorial/rewriter/commute.md | Expanded discussion on commutativity handling and introduced a warning regarding rule explosion. |
docs/tutorial/index.md | Adjusted the ordering for the toctree entries. |
Comments suppressed due to low confidence (1)
docs/tutorial/rewriter/simple_example.md:65
- Consider revising the sentence to include a verb, for example: 'This parameter is either a
Sequence[PatternRewriteRule]
or aRewriteRuleSet
.'
2. `pattern_rewrite_rules` : This parameter either a `Sequence[PatternRewriteRule]` or a `RewriteRuleSet`.
@@ -31,7 +31,11 @@ The target pattern in this case has 5 inputs `input_a`, `input_b`, `shape_a`, `s | |||
Similarly for writing the condition checking function, we require only `input_a`, `input_b` and `shape_c`. Use `**_` to represent all the unused parameters in the condition matching function signature. | |||
::: | |||
|
|||
In order to validate whether matmul broadcast is sufficient, we write a condition checking function as follows: | |||
In order to validate whether matmul broadcast is sufficient, we write a condition checking function as below. | |||
Note that the relevant inputs passed to the check function are all instances of `ir.Value`. These represent |
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 that the relevant inputs passed to the check function are all instances of `ir.Value`. These represent | |
Note that the relevant inputs passed to the check function are all instances of :class:`onnx_ir.Value`. These represent |
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.
Will this work, given that IR has moved to a different repo? Not sure if the old documentation still exists, but still ...
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 did add a reference to the overall documentation in the lines below.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Updates to the rewriter tutorial