-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[jit] support iteration tuple unpacking #21985
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
Conversation
[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
zdevito
left a comment
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.
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) { |
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.
Why is it necessary to create a list here vs just passing more than one target_expr to emitExprsAssign?
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.
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.
[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
Stack from ghstack:
Fixes #20239
Differential Revision: D15948549