Skip to content

Support TorchScript call over remote API (RRef)#32466

Closed
xush6528 wants to merge 10 commits intogh/xush6528/62/basefrom
gh/xush6528/62/head
Closed

Support TorchScript call over remote API (RRef)#32466
xush6528 wants to merge 10 commits intogh/xush6528/62/basefrom
gh/xush6528/62/head

Conversation

@xush6528
Copy link
Contributor

@xush6528 xush6528 commented Jan 21, 2020

Stack from ghstack:

It's a follow-up work of #32197.

In #32197, rpc.sync_rpc(..) and rpc.rpc_async(..) support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making rpc.remote(..) support taking a TorchScript annotated Python function as well.

Differential Revision: D19440633

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` supports taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by make `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
@kostmo
Copy link
Member

kostmo commented Jan 21, 2020

💊 CircleCI build failures summary and remediations

As of commit 1633a86:

None of the build failures appear to be your fault.

  • 1/1 broken upstream at merge base e0ffe72 since Jan 25

    Please rebase on the viable/strict branch (expand for instructions)

    If your commit is newer than viable/strict, you can try basing on an older, stable commit:

    git fetch origin viable/strict
    git rebase --onto viable/strict $(git merge-base origin/master HEAD)
    

    If your commit is older than viable/strict:

    git fetch origin viable/strict
    git rebase viable/strict
    

    Check out the recency history of this "viable master" tracking branch.

Detailed failure analysis

One may explore the probable reasons each build failed interactively on the Dr. CI website.

🚧 1 upstream failure recognized by patterns:

These builds matched patterns, but were probably caused by upstream breakages:


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 on the GitHub issue tracker.

This comment has been revised 29 times.

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
@xush6528 xush6528 changed the title [WIP] Support TorchScript call over remote API (RRef) Support TorchScript call over remote API (RRef) Jan 22, 2020
It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
xush6528 added a commit that referenced this pull request Jan 22, 2020
Pull Request resolved: #32466

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97007290

Differential Revision: [D19440633](https://our.internmc.facebook.com/intern/diff/D19440633/)
Copy link
Contributor

@zhaojuanmao zhaojuanmao left a comment

Choose a reason for hiding this comment

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

overall looks good! thanks for working on this. also, would you please add a test in rpc_test.py that can show the remote script call can receive remote exception?

return futPtr;
}

PyRRef remoteTorchscript(
Copy link
Contributor

Choose a reason for hiding this comment

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

could we refactor pyRemoteBuiltin and make it to be used by both builtin and torchscript call?

Copy link
Contributor Author

@xush6528 xush6528 Jan 23, 2020

Choose a reason for hiding this comment

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

I tried, the inheritance setup about ScripCall, RemoteCall, ScriptCall makes it hard to consolidate in this PR. It's could be another PR's work to streamline them.

We want to consolidation

  • pyRpcBuiltin and rpcTorchscript.
  • pyRemoteBuiltin and remoteTorchscript.

Maybe after removing template on RRef classes is a good time to re-visit this wish.

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
xush6528 added a commit that referenced this pull request Jan 23, 2020
Pull Request resolved: #32466

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97137716

Differential Revision: [D19440633](https://our.internmc.facebook.com/intern/diff/D19440633/)
@xush6528
Copy link
Contributor Author

Update to resolve comments. Will wait for and rebase after #30630.

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
xush6528 added a commit that referenced this pull request Jan 24, 2020
Pull Request resolved: #32466

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97192240

Differential Revision: [D19440633](https://our.internmc.facebook.com/intern/diff/D19440633/)
Copy link
Contributor

@zhaojuanmao zhaojuanmao left a comment

Choose a reason for hiding this comment

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

lgtm, please address inline comments and make sure all tests are green before landing

@zhaojuanmao
Copy link
Contributor

test failures are real

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
xush6528 added a commit that referenced this pull request Jan 25, 2020
Pull Request resolved: #32466

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97207196

Differential Revision: [D19440633](https://our.internmc.facebook.com/intern/diff/D19440633/)
It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

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

[ghstack-poisoned]
xush6528 added a commit that referenced this pull request Jan 25, 2020
Pull Request resolved: #32466

It's a follow-up work of #32197.

In #32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97211168

Differential Revision: [D19440633](https://our.internmc.facebook.com/intern/diff/D19440633/)
@xush6528
Copy link
Contributor Author

The 2 failures are irrelevant to distributed module.

@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 6ad9e5c.

@facebook-github-bot facebook-github-bot deleted the gh/xush6528/62/head branch January 28, 2020 15:17
wuhuikx pushed a commit to wuhuikx/pytorch that referenced this pull request Jan 30, 2020
Summary:
Pull Request resolved: pytorch#32466

It's a follow-up work of pytorch#32197.

In pytorch#32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97211168

Test Plan:
# Unit tests

```
buck test mode/dev-nosan //caffe2/test/distributed/rpc:rpc_fork -- test_script_function_exception

buck build mode/dev-nosan //caffe2/test/distributed/rpc:rpc_fork

buck-out/gen/caffe2/test/distributed/rpc/rpc_fork\#binary.par -r test_script_function_exception
```

```
buck test mode/dev-nosan //caffe2/test/distributed/rpc:dist_autograd_fork -- test_backward_simple_script_call

buck build mode/dev-nosan //caffe2/test/distributed/rpc:dist_autograd_fork

buck-out/gen/caffe2/test/distributed/rpc/dist_autograd_fork\#binary.par -r test_backward_simple_script_call
```

Differential Revision: D19440633

fbshipit-source-id: d37f6dcdc0b80d35ac7bcba46ad6f9b831c3779b
ttumiel pushed a commit to ttumiel/pytorch that referenced this pull request Mar 4, 2020
Summary:
Pull Request resolved: pytorch#32466

It's a follow-up work of pytorch#32197.

In pytorch#32197, `rpc.sync_rpc(..) `and `rpc.rpc_async(..)` support taking a TorchScript annotated Python function as the user function for RPC.

This PR extend along this direction by making `rpc.remote(..)` support taking a TorchScript annotated Python function as well.

ghstack-source-id: 97211168

Test Plan:
# Unit tests

```
buck test mode/dev-nosan //caffe2/test/distributed/rpc:rpc_fork -- test_script_function_exception

buck build mode/dev-nosan //caffe2/test/distributed/rpc:rpc_fork

buck-out/gen/caffe2/test/distributed/rpc/rpc_fork\#binary.par -r test_script_function_exception
```

```
buck test mode/dev-nosan //caffe2/test/distributed/rpc:dist_autograd_fork -- test_backward_simple_script_call

buck build mode/dev-nosan //caffe2/test/distributed/rpc:dist_autograd_fork

buck-out/gen/caffe2/test/distributed/rpc/dist_autograd_fork\#binary.par -r test_backward_simple_script_call
```

Differential Revision: D19440633

fbshipit-source-id: d37f6dcdc0b80d35ac7bcba46ad6f9b831c3779b
xush6528 added a commit that referenced this pull request Apr 8, 2020
Pull Request resolved: #36266

RecordFunction starts but never ends at an appropriate location. Might be recording wrong time numbers.

This is following up on

#32197
and
#32466

ghstack-source-id: 101798149

Differential Revision: [D7857991](https://our.internmc.facebook.com/intern/diff/D7857991/)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants