Skip to content

[jit][script] Make list literals construct ListType#10193

Closed
suo wants to merge 6 commits intomasterfrom
pr/lists
Closed

[jit][script] Make list literals construct ListType#10193
suo wants to merge 6 commits intomasterfrom
pr/lists

Conversation

@suo
Copy link
Member

@suo suo commented Aug 3, 2018

Previously, foo = [bar, baz] would construct a TupleType of fixed arity. This would cause code like:

foo = [2]
if True:
    foo = [2, 2]

to fail to compile, since (int) is not the same as (int, int).

This PR changes things so that list literals construct ListTypes, which can be resized.

Potentially breaking changes introduced:

  • Empty list literals are now disallowed, _constructEmptyFooList() builtins are required to replace them.
  • Iterable variable unpacking where the rhs is a list is now disallowed. (Tuples still work)
  • Lists must have a single type.

@suo suo added the oncall: jit Add this issue/PR to JIT oncall triage queue label Aug 3, 2018
@suo suo requested a review from jamesr66a August 3, 2018 03:28
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.

This looks good to me. Watch for langtech failures in fbcode. Small chance it affects that codepath.

DEFINE_INT_OP(aten::__and__, a&& b)
DEFINE_INT_OP(aten::__or__, a || b)

Operator("aten::_constructEmptyIntList() -> int[]",

This comment was marked as off-topic.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

zdevito has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

michaelsuo has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@suo suo deleted the pr/lists branch August 3, 2018 16:26
goodlux pushed a commit to goodlux/pytorch that referenced this pull request Aug 15, 2018
Summary:
Previously, `foo = [bar, baz]` would construct a TupleType of fixed arity. This would cause code like:
```
foo = [2]
if True:
    foo = [2, 2]
```
to fail to compile, since `(int)` is not the same as `(int, int)`.

This PR changes things so that list literals construct ListTypes, which can be resized.

Potentially breaking changes introduced:
- Empty list literals are now disallowed, `_constructEmptyFooList()` builtins are required to replace them.
- Iterable variable unpacking where the rhs is a list is now disallowed. (Tuples still work)
- Lists must have a single type.
Pull Request resolved: pytorch#10193

Differential Revision: D9147166

Pulled By: michaelsuo

fbshipit-source-id: bbd1b97b0b6b7cb0e6f9d6aefa1ee9c731e63039
@ezyang ezyang added the merged label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants