Skip to content

Conversation

@mcr229
Copy link
Contributor

@mcr229 mcr229 commented Sep 14, 2021

Stack from ghstack:

Differential Revision: D30941389

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Sep 14, 2021

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 1ee85d2 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


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.

Click here to manually regenerate this comment.

@facebook-github-bot facebook-github-bot added oncall: jit Add this issue/PR to JIT oncall triage queue cla signed labels Sep 14, 2021
mcr229 pushed a commit that referenced this pull request Sep 14, 2021
@mcr229 mcr229 requested a review from eellison September 14, 2021 20:49
@mcr229
Copy link
Contributor Author

mcr229 commented Sep 14, 2021

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 good!! a few comments from me. test ?

// Normalize rsub such that `rsub(x,y) = sub(x,y)`
bool normalizeRSub(graph_node_list_iterator& iter) {
ArrayRef<Value*> args = iter->inputs();
if (iter->kind() == aten::rsub) {
Copy link
Contributor

Choose a reason for hiding this comment

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

we all overloads for any particular symbol, so it's possible unlikely that there are other aten::rsub operators with different typed inputs for which this substitution isnt valid. just to be safe and future proof we should check the full schema here. you can use the node->matches("rsub.Tensor(Tensor self, Tensor other, *, Scalar alpha=1) -> Tensor") api.

See https://github.com/pytorch/pytorch/blob/master/aten/src/ATen/native/native_functions.yaml#L4880, for this operator what we're doing isnt valid


// Normalize rsub such that `rsub(x,y) = sub(x,y)`
bool normalizeRSub(graph_node_list_iterator& iter) {
ArrayRef<Value*> args = iter->inputs();
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: move args into the if block

bool normalizeRSub(graph_node_list_iterator& iter) {
ArrayRef<Value*> args = iter->inputs();
if (iter->kind() == aten::rsub) {
iter->replaceWithNewSymbol(aten::sub);
Copy link
Contributor

Choose a reason for hiding this comment

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

replaceWithNewSymbol returns the updated node, so the replacements we're doing in the following lines will not affect it but the existing node we're destroying

mcr229 pushed a commit that referenced this pull request Sep 15, 2021
@mcr229
Copy link
Contributor Author

mcr229 commented Sep 15, 2021

I tried running the test through buck:
buck test @mode/dev caffe2/test:jit -- 'test_normalized_rsub \(test_peephole\.TestPeephole\)'
and it seemed passes, but i don't think it was doing anything, so I will try testing by building and running
python3 test/test_jit.py

mcr229 pushed a commit that referenced this pull request Sep 16, 2021
@mcr229
Copy link
Contributor Author

mcr229 commented Sep 16, 2021

Ran tests

(pytorch) [[email protected] ~/pytorch] python3 test/test_jit.py TestPeephole
CUDA not available, skipping tests
monkeytype is not installed. Skipping tests for Profile-Directed Typing
........s......................
----------------------------------------------------------------------
Ran 31 tests in 0.393s

OK (skipped=1)
(pytorch) [[email protected] ~/pytorch] python3 test/test_jit.py TestPeephole.test_normalized_rsub
CUDA not available, skipping tests
monkeytype is not installed. Skipping tests for Profile-Directed Typing
.
----------------------------------------------------------------------
Ran 1 test in 0.015s

OK

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.

Nice! just one small comment

FileCheck().check("conv").check("dim").run(conv_dim.graph)

def test_normalized_rsub(self):
def convertible_rsub(x: int, y: int):
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we should be checking tensor inputs here

mcr229 pushed a commit that referenced this pull request Sep 16, 2021
mcr229 pushed a commit that referenced this pull request Sep 17, 2021
{aten::true_divide_, aten::div_},
{aten::concat, aten::cat},
{aten::row_stack, aten::vstack},
{aten::rsub, aten::sub},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the fix for this test
image
seemed to be that rsub could not be found within this map, so adding it to the map and making the appropriate changes seemed to make the test pass

mcr229 pushed a commit that referenced this pull request Sep 17, 2021
mcr229 pushed a commit that referenced this pull request Sep 21, 2021
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.

Awesome!! 🚢 🚢 🚢

if dtype == torch.float32:
# TODO: no reason why we cant run this with tracing graph
if support_script:
if support_script and op.name != "rsub":
Copy link
Contributor

Choose a reason for hiding this comment

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

@alanwaketan this is an example of an annoying test quirk that your PR will fix

@mcr229 mcr229 merged commit b9fa1b2 into gh/mcr229/1/base Sep 21, 2021
eellison added a commit that referenced this pull request Sep 21, 2021
mcr229 pushed a commit that referenced this pull request Sep 21, 2021
facebook-github-bot pushed a commit that referenced this pull request Sep 23, 2021
Summary:
Pull Request resolved: #65014

ghstack-source-id: 138656948

Test Plan:
```
(pytorch) [[email protected] ~/pytorch] python3 test/test_jit.py TestPeephole
CUDA not available, skipping tests
monkeytype is not installed. Skipping tests for Profile-Directed Typing
........s......................
----------------------------------------------------------------------
Ran 31 tests in 0.393s

OK (skipped=1)
(pytorch) [[email protected] ~/pytorch] python3 test/test_jit.py TestPeephole.test_normalized_rsub
CUDA not available, skipping tests
monkeytype is not installed. Skipping tests for Profile-Directed Typing
.
----------------------------------------------------------------------
Ran 1 test in 0.015s

OK
```

Reviewed By: eellison

Differential Revision: D30941389

fbshipit-source-id: 03f0416d99090845c9bfb1e5fcf771d5f1d7a050
khabinov added a commit to khabinov/glow that referenced this pull request Sep 23, 2021
Summary: After a recent optimization pytorch/pytorch#65014 we started to normalize `aten::rsub` as `aten::sub`, so the test started to fail. This diff makes sure the test is passing.

Reviewed By: wushirong

Differential Revision: D31153947

fbshipit-source-id: 3ea52f8b7b99d164084390548be22a82e9f09c8c
khabinov added a commit to khabinov/glow that referenced this pull request Sep 23, 2021
Summary:
Pull Request resolved: pytorch#5824

After a recent optimization pytorch/pytorch#65014 we started to normalize `aten::rsub` as `aten::sub`, so the test started to fail. This diff makes sure the test is passing.

Reviewed By: wushirong

Differential Revision: D31153947

fbshipit-source-id: b2a299274e5c440cd52342087cfcdb0b387cc4fb
khabinov added a commit to khabinov/glow that referenced this pull request Sep 23, 2021
Summary:
Pull Request resolved: pytorch#5824

After a recent optimization pytorch/pytorch#65014 we started to normalize `aten::rsub` as `aten::sub`, so the test started to fail. This diff makes sure the test is passing.

Reviewed By: wushirong

Differential Revision: D31153947

fbshipit-source-id: d7034b18c2e44f4ce76481ed68e7ebf94c1bcfa1
facebook-github-bot pushed a commit to pytorch/glow that referenced this pull request Sep 23, 2021
Summary:
Pull Request resolved: #5824

After a recent optimization pytorch/pytorch#65014 we started to normalize `aten::rsub` as `aten::sub`, so the test started to fail. This diff makes sure the test is passing.

Reviewed By: wushirong

Differential Revision: D31153947

fbshipit-source-id: 2aab03647a9910fddeb974a6d451ce3fa5376e4b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed 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