Skip to content

Conversation

@wanchaol
Copy link
Collaborator

@wanchaol wanchaol commented Jun 19, 2019

Stack from ghstack:

Fixes #20239

Differential Revision: D15948549

[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
Copy link
Contributor

@zdevito zdevito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one question.

emitExprsAssign(target_exprs, {sv}, range, n_binders);
// if target exprs are more than 1, it means iteration unpacking on LHS
// we create Tuple literal to wrap those target exprs for assignments
if (target_exprs.size() > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it necessary to create a list here vs just passing more than one target_expr to emitExprsAssign?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh it's because sv here is the root IterableTree (which create TupleConstruct in getelem) and need to call emitTupleAssign to unwrap the tuple using asTuple, but the target_exprs here is not a tupleliteral, so emitExprsAssign could not match these two together, and we need to create a TupleLiteral wrap here.

wanchaol added 5 commits June 21, 2019 12:09
[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
[jit] support iteration tuple unpacking

gh-metadata: pytorch pytorch 21985 gh/wanchaol/23/head
@zou3519 zou3519 deleted the gh/wanchaol/23/head branch June 24, 2019 03:52
@facebook-github-bot
Copy link
Contributor

@wanchaol merged this pull request in eab3575.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants