Skip to content
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

Change list striding parameters to take optional integer (preceding work for #49352) #48719

Closed

Conversation

tugsbayasgalan
Copy link
Contributor

@tugsbayasgalan tugsbayasgalan commented Dec 2, 2020

Stack from ghstack:

Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison, the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change.

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: D25929902

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Dec 2, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 0f2eee98d29ba2ef3bbd8f53b2898ce92c6a7b82
Pull Request resolved: #48719
@facebook-github-bot facebook-github-bot added cla signed oncall: jit Add this issue/PR to JIT oncall triage queue labels Dec 2, 2020
@tugsbayasgalan tugsbayasgalan changed the title Striding for lists [WIP] Striding for lists Dec 2, 2020
@dr-ci
Copy link

dr-ci bot commented Dec 2, 2020

💊 CI failures summary and remediations

As of commit 23aaf43 (more details on the Dr. CI page):


  • 3/3 failures possibly* introduced in this PR
    • 2/3 non-CircleCI failure(s)

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build pytorch_xla_linux_bionic_py3_6_clang9_build (1/1)

Step: "Build" (full log | diagnosis details | 🔁 rerun)

Jan 12 01:57:23 Failed to generate ATEN bindings: ['/var/lib/jenkins/workspace/xla/scripts/generate_code.sh']
Jan 12 01:57:22 AtenXlaType function missed override: Tensor slice(const Tensor& self, int64_t dim, int64_t start, int64_t end, int64_t step); // slice(Tensor,int64_t,int64_t,int64_t,int64_t)->Tensor
Jan 12 01:57:22 Traceback (most recent call last):
Jan 12 01:57:22   File "/var/lib/jenkins/workspace/xla/scripts/gen.py", line 1195, in <module>
Jan 12 01:57:22     generate(args)
Jan 12 01:57:22   File "/var/lib/jenkins/workspace/xla/scripts/gen.py", line 1165, in generate
Jan 12 01:57:22     assert check_overrides(overrides, overridden)
Jan 12 01:57:22 AssertionError
Jan 12 01:57:23 Building torch_xla version: 1.6
Jan 12 01:57:23 XLA Commit ID: e62799edcc8ef199e3903ef778b6715aa8a16468
Jan 12 01:57:23 PyTorch Commit ID: 23aaf43192dc73da6a1b6c91648316f227d33e8f
Jan 12 01:57:23 Failed to generate ATEN bindings: ['/var/lib/jenkins/workspace/xla/scripts/generate_code.sh']
Jan 12 01:57:23 =================== sccache compilation log ===================
Jan 12 01:57:23 + cleanup
Jan 12 01:57:23 + retcode=1
Jan 12 01:57:23 + set +x
Jan 12 01:57:23 =========== If your build fails, please take a look at the log above for possible reasons ===========
Jan 12 01:57:23 Compile requests                    4738
Jan 12 01:57:23 Compile requests executed           4442
Jan 12 01:57:23 Cache hits                          3143
Jan 12 01:57:23 Cache hits (C/C++)                  3143
Jan 12 01:57:23 Cache misses                        1281

Extra GitHub checks: 2 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

This comment has been revised 98 times.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Dec 2, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 36634034caedb2cefdc9bcc26786c6c7bf62c77f
Pull Request resolved: #48719
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Dec 3, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: b8f40e468b77d1b93324fe21c8a2d8d9e7248c7e
Pull Request resolved: #48719
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Dec 8, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: fdf82e4c58b24e22ab5787490d26803537761de8
Pull Request resolved: #48719
Copy link
Collaborator

@albanD albanD left a comment

Choose a reason for hiding this comment

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

What is actually changing here? It would be nice to have the codemod in a separate PR.

@tugsbayasgalan tugsbayasgalan changed the title [WIP] Striding for lists Striding for lists Part 1 Dec 8, 2020
@eellison
Copy link
Contributor

eellison commented Dec 8, 2020

Yea, agreed with alban, it might be easier to review this once the whole stack is out

Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Dec 14, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 74bc6d79a75331aab5452d9034f8753891fe3ca3
Pull Request resolved: #48719
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Dec 14, 2020
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 548d1980f7bb99375e25a26e85c862c466c6e8a6
Pull Request resolved: #48719
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@eellison
Copy link
Contributor

cc @ailzhang XLA failure

@eellison
Copy link
Contributor

Some context: we are fixing the lists slicing logic with a negative index. Part of this change involves changing the ir emission for aten::slice to emit None for non-present step value instead of INT_MAX. Rather than have special case logic for all of the builtins type that may or may not support negative striding (lists, tensors, strs) we are updating their implementations so that they can all take in optionals. Actual negative slicing of Tensors is still NYI, but making the schema changes here makes future implementation easier and makes the logic in ir emission cleaner.

Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@eellison eellison mentioned this pull request Dec 15, 2020
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Copy link
Contributor

@eellison eellison left a comment

Choose a reason for hiding this comment

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

Looks great! Nice job wading through the tracer code.

I have two comments:

  • I don't think we actually need to make step optional, I think python just defaults it to 1
  • I'm not sure about the TenssorShape.cpp changes, I think it would be better to error at negative step within TensorShape instead of trying to implement it for this PR.

aten/src/ATen/BatchingRegistrations.cpp Show resolved Hide resolved
aten/src/ATen/native/TensorShape.cpp Outdated Show resolved Hide resolved
aten/src/ATen/native/TensorShape.cpp Show resolved Hide resolved
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
tugsbayasgalan added a commit that referenced this pull request Jan 6, 2021
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

ghstack-source-id: 97ed8fba46c77a185c586b35b23f081873207a67
Pull Request resolved: #48719
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
@tugsbayasgalan tugsbayasgalan mentioned this pull request Jan 6, 2021
Closed
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Copy link
Contributor

@eellison eellison left a comment

Choose a reason for hiding this comment

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

LGTM, Ship it! Great job! We might want to sanity check the same forward-compatibility checks we did previously with the newest changes, just to be safe. But up to you.

aten/src/ATen/native/TensorShape.cpp Outdated Show resolved Hide resolved
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Copy link
Contributor

@eellison eellison left a comment

Choose a reason for hiding this comment

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

LGTM, ship it! We should wait a couple weeks or so before landing PT2 so we dont run into FC issues.

Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

[ghstack-poisoned]
Summary: Attempt to break this PR (#33019) into two parts. As per our discussion with @eellison,  the first part is to make sure our aten::slice operator take optional parameters for begin/step/end. This will help with refactoring ir_emitter.cpp for genering handling for list and slice striding. Once this PR merged, we will submit a second PR with compiler change. 

Test Plan: None for this PR, but new tests will be added for the second part.

Reviewers:

Subscribers:

Tasks:

Tags:

Differential Revision: [D25929902](https://our.internmc.facebook.com/intern/diff/D25929902)

[ghstack-poisoned]
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 1a38fa9.

@facebook-github-bot facebook-github-bot deleted the gh/tugsbayasgalan/6/head branch January 23, 2021 15:16
@tugsbayasgalan tugsbayasgalan changed the title Striding for lists Part 1 Change list striding parameters to take optional Part 1 Feb 24, 2021
@tugsbayasgalan tugsbayasgalan changed the title Change list striding parameters to take optional Part 1 Change list striding parameters to take optional integer (preceding work for #49352) Feb 24, 2021
TORCH_CHECK(step == 1, "Slicing a string only supports step=1");

const int64_t size = string.size();
int64_t start_val = start.has_value() ? start.value() : INT64_MAX;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does this default to INT64_MAX? Why not just set it to 0? cc @eellison this is impeding SymInt-ification

Copy link
Contributor

Choose a reason for hiding this comment

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

Ugh, I forget, but I think that was mirroring how the python slice handling code went where None would be encoded as INT64_MAX

Copy link
Contributor

Choose a reason for hiding this comment

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

It may have also been a forward compatible thing because None support had to land in multiple parts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed 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.

None yet

6 participants