[jit][script] Distinguish TupleLiteral from ListLiteral#10128
Closed
[jit][script] Distinguish TupleLiteral from ListLiteral#10128
Conversation
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
michaelsuo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Member
Author
|
Looks I'll need to rebase this on top of #10027 and fix up the ListLiteral construction there as well. I guess I'll just wait until it properly lands. |
Previously, the parser was emitting list literals for tuples, but we were using TupleType as the internal representation, so it was okay. If we intend to handle lists of dynamic size, we can't use TupleType, since TupleTypes of different arity are different types. This diff switches over list literals to use ListType as their internal representation, and distinguishes tuple literals in the parser logic so they can be properly mapped to TupleTypes of known arity.
Contributor
facebook-github-bot
left a comment
There was a problem hiding this comment.
michaelsuo is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
goodlux
pushed a commit
to goodlux/pytorch
that referenced
this pull request
Aug 15, 2018
Summary: Previously, the parser was emitting list literals for tuples, but the IR was representing list literals internally with TupleTypes. For implementing most list operations, I think it will be helpful distinguish between lists (dynamic size, homogeneous types) and tuples (fixed arity, heterogeneous types) This diff modifies the parser logic to emit tuple literals. This frees us to represent lists as ListType in the IR, while still properly mapping tuple literals to TupleTypes. A following diff will actually switch over list literals to emit ListTypes. Pull Request resolved: pytorch#10128 Differential Revision: D9121305 Pulled By: michaelsuo fbshipit-source-id: e0cad07ae8bac680f7f8113d10e5129d5a1a511d
This file contains hidden or 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
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.
Previously, the parser was emitting list literals for tuples, but the IR was representing list literals internally with TupleTypes.
For implementing most list operations, I think it will be helpful distinguish between lists (dynamic size, homogeneous types) and tuples (fixed arity, heterogeneous types)
This diff modifies the parser logic to emit tuple literals. This frees us to represent lists as ListType in the IR, while still properly mapping tuple literals to TupleTypes.
A following diff will actually switch over list literals to emit ListTypes.