Skip to content

Attach 'send' autograd function to the autograd graph as part of RPC.#24876

Closed
pritamdamania87 wants to merge 8 commits intogh/pritamdamania87/2/basefrom
gh/pritamdamania87/2/head
Closed

Attach 'send' autograd function to the autograd graph as part of RPC.#24876
pritamdamania87 wants to merge 8 commits intogh/pritamdamania87/2/basefrom
gh/pritamdamania87/2/head

Conversation

@pritamdamania87
Copy link
Contributor

@pritamdamania87 pritamdamania87 commented Aug 19, 2019

Stack from ghstack:

This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

  1. Define a very simple 'SendRpcBackwards' autograd function.
  2. Attach this function to appropriate tensors when we call an RPC.
  3. Store the send function in our distributed autograd context.

GitHub Issue: #23110
Differential Revision: D16903255

This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

1) Define a very simple 'SendRpcBackwards' autograd function.
2) Attach this function to appropriate tensors when we call an RPC.
3) Store the send function in our distributed autograd context.

Differential Revision: [D16903255](https://our.internmc.facebook.com/intern/diff/D16903255/)
@pytorchbot pytorchbot added module: autograd Related to torch.autograd, and the autograd engine in general module: build Build system issues oncall: distributed Add this issue/PR to distributed oncall triage queue module: pybind Related to our Python bindings / interactions with other Python libraries labels Aug 19, 2019
pritamdamania87 pushed a commit that referenced this pull request Aug 19, 2019
This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

1) Define a very simple 'SendRpcBackwards' autograd function.
2) Attach this function to appropriate tensors when we call an RPC.
3) Store the send function in our distributed autograd context.

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

ghstack-source-id: 88585551
Pull Request resolved: #24876
@pritamdamania87 pritamdamania87 requested a review from ezyang August 20, 2019 01:56
…art of RPC."


This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

1) Define a very simple 'SendRpcBackwards' autograd function.
2) Attach this function to appropriate tensors when we call an RPC.
3) Store the send function in our distributed autograd context.

GitHub Issue: #23110
Differential Revision: [D16903255](https://our.internmc.facebook.com/intern/diff/D16903255/)
pritamdamania87 pushed a commit that referenced this pull request Aug 21, 2019
Pull Request resolved: #24876

This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

1) Define a very simple 'SendRpcBackwards' autograd function.
2) Attach this function to appropriate tensors when we call an RPC.
3) Store the send function in our distributed autograd context.
ghstack-source-id: 88696420

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

ezyang commented Aug 21, 2019

When you get a chance please rebase past master failures

@aazzolini
Copy link
Contributor

@pritamdamania87 , how are we going to do this when the object containing the tensor is a python object?

@pritamdamania87
Copy link
Contributor Author

@aazzolini As we discussed offline, when we pickle python objects, we can hook into the pickler and whenever we see tensors, we can attach them to the send autograd function appropriately.

…art of RPC."


This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

1) Define a very simple 'SendRpcBackwards' autograd function.
2) Attach this function to appropriate tensors when we call an RPC.
3) Store the send function in our distributed autograd context.

GitHub Issue: #23110
Differential Revision: [D16903255](https://our.internmc.facebook.com/intern/diff/D16903255/)
pritamdamania87 pushed a commit that referenced this pull request Aug 24, 2019
Pull Request resolved: #24876

This contains very basic functionality of adding 'send' autograd
function to our autograd graph. The purpose of this change is to validate the
basic structure proposed here makes sense. Once this makes sense, we can build
upon this to address more complicated scenarios. At a high level we've added
the following functionality:

1) Define a very simple 'SendRpcBackwards' autograd function.
2) Attach this function to appropriate tensors when we call an RPC.
3) Store the send function in our distributed autograd context.
ghstack-source-id: 88916065

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

ezyang commented Aug 26, 2019

The purpose of this change is to validate the basic structure proposed here makes sense.

How do we actually validate this?

op->schema(), args, kwargs, c10::nullopt);

auto& autogradContainer = DistAutogradContainer::getInstance();
if (autogradContainer.hasValidContext()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. So if there is no current valid context, we just silently don't attach any autograd edges. That doesn't sound right to me: if there is no valid context, we had better error if we try to backpropagate.

Basically, if I don't do a context, and then I attend to rpc and backward through it, what error message do I get? That's something you should be testing for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can raise an appropriate error as part of our new backward() and optimizer() API. Basically, when the user calls torch.distributed.backward(), either that API takes a context_id as input (then the user is forced to use the with wrapper). Or that API can use the current context id and it will fail if it doesn't find one.

if (current_context_id_ == context_id) {
// Reset the thread_local current context id, since it is no longer valid.
current_context_id_ = -1;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not part of this PR per se, but do we have a C++-side RAII guard for allocating and releasing thread local context? It seems like a logical thing that should be part of the C++ API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think we should have support for a user facing C++ API? I feel we can invest there once there is a need. It is quite an overhead to maintain two APIs with good docs and tutorials.

Copy link
Contributor

Choose a reason for hiding this comment

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

C++ API is non-goal for now, but let's add a TODO here in case we forgot.

pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
…uiltin operators RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
… RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
…uiltin operators RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
… RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
…uiltin operators RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
… RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 19, 2019
Pull Request resolved: #25527

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
ghstack-source-id: 90403466

Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)
pritamdamania87 pushed a commit that referenced this pull request Sep 20, 2019
…uiltin operators RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 20, 2019
… RPC."

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 20, 2019
Pull Request resolved: #25527

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
ghstack-source-id: 90478263

Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)
pritamdamania87 pushed a commit that referenced this pull request Sep 21, 2019
…uiltin operators RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interfaces to ensure we have a RpcBase class which 
all RPC messages inherit from. This is useful since we create a RpcWithAutograd 
message which can wrap regular RPC messages and augment them with additional 
autograd information.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 21, 2019
… RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interfaces to ensure we have a RpcBase class which 
all RPC messages inherit from. This is useful since we create a RpcWithAutograd 
message which can wrap regular RPC messages and augment them with additional 
autograd information.

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

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 21, 2019
Pull Request resolved: #25527

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
ghstack-source-id: 90545822

Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)
pritamdamania87 pushed a commit that referenced this pull request Sep 23, 2019
…uiltin operators RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 23, 2019
… RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 23, 2019
Pull Request resolved: #25527

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
ghstack-source-id: 90623247

Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)
pritamdamania87 pushed a commit that referenced this pull request Sep 26, 2019
…uiltin operators RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 26, 2019
… RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 26, 2019
Pull Request resolved: #25527

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
ghstack-source-id: 90877831

Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)
pritamdamania87 pushed a commit that referenced this pull request Sep 28, 2019
…uiltin operators RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 28, 2019
Pull Request resolved: #25527

Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
ghstack-source-id: 90989582

Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)
pritamdamania87 pushed a commit that referenced this pull request Sep 28, 2019
… RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 30, 2019
…uiltin operators RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Sep 30, 2019
… RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Oct 1, 2019
…uiltin operators RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
pritamdamania87 pushed a commit that referenced this pull request Oct 1, 2019
… RPC."


Master GH issue: #23110.

This change builds upon #24876 and
provides all the autograd hooks needed for a forward pass with distributed rpc
for builtin operators. This change does not address distributed rpc for python
UDFs and that will be addressed in follow up PRs.

Summary of changes:
1. Attach send autograd functions when a request is sent from the client and
response is sent from the server.
2. Attach receive autograd functions when a request is received on the server
and a response is received on the client.
3. Generate a globally unique autograd_message_id for each send/recv autograd
function pair to uniquely identify them.
4. Major re-work of the RPC interface to support autograd seamlessly:
    * Ensure all RPC messages inherit from a base class `RpcCommandBase`. 
    * `RpcCommandBase` allows us to build a wrapper class `RpcWithAutograd` which basically holds a `RpcCommandBase` object and some additional autograd information.
    * Added a `RequestCallback` interface which we need to implement to handle RPCs. The abstract class `RequestCallback` performs operations that would be common across all implementations.
    * Moved PythonUDF handling to an appropriate class which can plug into the `RpcCommandBase` interface. This would allows us to easily attach autograd information to PythonUDF calls. 
Differential Revision: [D17148077](https://our.internmc.facebook.com/intern/diff/D17148077/)

[ghstack-poisoned]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

caffe2 Merged module: autograd Related to torch.autograd, and the autograd engine in general module: build Build system issues module: cpp Related to C++ API module: pybind Related to our Python bindings / interactions with other Python libraries oncall: distributed Add this issue/PR to distributed oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants