-
Notifications
You must be signed in to change notification settings - Fork 81
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
[RFC] Relax Language Specification #106
Open
slyubomirsky
wants to merge
7
commits into
apache:main
Choose a base branch
from
slyubomirsky:relax-spec
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Lunderberg
reviewed
Mar 14, 2024
@@ -276,12 +276,13 @@ To simplify the writing of Relax passes, we define a normal form for Relax progr | |||
|
|||
The normal form for Relax is very similar to ANF; differences will be noted. Here are the criteria required for a program to be in normal form: | |||
1. Within a `SeqExpr`, the right-hand side of any binding (the `value` field in the AST) must either be a "leaf expression" or a non-leaf expression where all subexpressions are leaf expressions. Leaf expressions are the following: Variables (`Var`, `DataflowVar`, or `GlobalVar`), `Constant`, `ShapeExpr`, `PrimValue`, `StringImm`, `DataTypeImm`, or (_unlike_ ANF) `Tuple`. `Tuple` nodes are considered "leaf" expressions even though they contain nesting purely for convenience in writing passes; many operators rely on grouping arguments using tuples, so that is a form of nesting permitted and expected. Otherwise, non-leaf expressions used as subexpressions must be bound to variables; this includes any non-leaf expressions nested inside a `Tuple`. | |||
2. `SeqExpr`s may appear only in the following locations: | |||
2. As an addition to the above, all variables of type `TupleStructInfo([])`, the unit tuple, are inlined during normalization. That is, all uses of variables with the type `TupleStructInfo([])` will be replaced directly with the value `Tuple([])` (the unit tuple). |
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.
Thank you for making the updates here, and this looks accurate to the changes after apache/tvm#16658
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rendered view.
Now that Unity has been merged into TVM's main branch, I have written an RFC to make my unofficial Relax specification an official one, akin to the TIR specification RFC. Since Relax is a much newer and less heavily used language than TIR, there are fewer unresolved questions in this RFC compared to that for the TIR specification. I welcome your review both on the specification draft itself and on the procedures proposed in the RFC.
Many thanks to those who have reviewed past versions of the draft Relax specification, including @YuchenJin, @psrivas2, @sunggg, @junrushao, @denise-k, and @yongwww.