Skip to content

Why remove tolerate_dup_recv from LocaRendezvous. #11825

Closed

Description

@junshi15

I did not find a PR for this patch. Maybe this discussion belongs to that particular commit page. If so, I will move it there.

Can somebody explain the rationale behind this patch? Current contrib/verbs uses exactly this flag to transfer tensors. Note it is set true here. Removing it totally breaks verbs. I am asking if this patch is absolutely needed since there is no simple workaround for contrib/verbs without this flag.

Activity

  1. reedwm commented on Jul 27, 2017

    @reedwm
    Contributor

    /CC @zffchen78

  2. added
    stat:awaiting tensorflower
    on Jul 27, 2017
  3. shamoya commented on Aug 9, 2017

    @shamoya
    Contributor

    @junshi15 @reedwm @poxvoculi - How do we proceed here ?
    The tolerate_dup_recv is needed by the verbs code.

  4. junshi15 commented on Aug 9, 2017

    @junshi15
    ContributorAuthor

    Can we revert this patch? Just looking at the patch alone, I feel it is cosmetic (cleaning up a parameter that is not used in the core code). Or maybe I missed something important.

  5. junshi15 commented on Aug 9, 2017

    @junshi15
    ContributorAuthor

    While we are looking for the motivation behind this change, we will also investigate how to adapt verbs code to accommodate this change.

  6. poxvoculi commented on Aug 9, 2017

    @poxvoculi
    Contributor

    It was removed because we no longer needed it for our internal networking, where it was needed to deal with hardware errors in an earlier generation of machines. Turning this feature on comes at a cost of higher memory use, since tensors backing sent values cannot be garbage collected until the end of the step. Also, there may be some upcoming feature whose implementation was made more difficult by allowing this option.

    I should have noticed you were using this, and pinged you: sorry! How important is this feature to verbs support? It is a convenience, or is it not possible to make the service reliable without it?

  7. junshi15 commented on Aug 9, 2017

    @junshi15
    ContributorAuthor

    @poxvoculi This is a corner stone of the current verbs design, where the receiving side could make multiple Recv attempts. Since the pinned memory is shared, a single Recv attempt may not be successful if the shared memory is used by other transmission.

    But no worries, let us see if we can do without it.

  8. byronyi commented on Aug 9, 2017

    @byronyi
    Contributor

    @junshi15 You mentioned about shared pinned memory, and I am wondering if this could be resolved by increasing the amount of pinned memory permitted for multiple concurrent transmissions. For sake of easier implementation, a memory pool allowing growth may fit your needs, e.g. BFCAllocator or PoolAllocator.

  9. junshi15 commented on Aug 9, 2017

    @junshi15
    ContributorAuthor

    @byronyi Using more memory can alleviate memory access conflicts, but can not totally eliminate it, since we don't know a priori what is the max parallelism. Once a conflict happens, some kind of retry is needed. We have been relying on tolerate_dup_recv for the re-tries.

  10. shamoya commented on Aug 15, 2017

    @shamoya
    Contributor

    @junshi15
    Maybe I'm missing something, but I don't see where we have a shared pinned memory in the design.
    Each RdmaTensorBuffer (hashed by its name) has it's own pinned buffer on both sides.
    I thought the necessity of the tolerate_dup_recv in the verbs code is the RDMA_BUFFER_REQUEST (first Tensor transfer, change in tensor size) which will follow a second RecvAsyncLocal.

  11. junshi15 commented on Aug 15, 2017

    @junshi15
    ContributorAuthor

    @shamoya Yes, there are three cases we have multiple RecvAsyncLocal. You listed the first two.

    1. initial transfer, both sides need to step up the buffer first, then transfer. Two calls to RecvAsyncLocal.

    2. change of tensor size. similar to (1).

    3. concurrent transfer. Note the buffer is hashed by the tensor name, without the step_id. If the same tensor with two different step_ids need to be transferred at the same time, there will be a collision at the buffer. When this happens, one tensor needs a re-try. I think I have seen this kind of situation in Async training cases, but I did not dig deeper.

  12. shamoya commented on Aug 17, 2017

    @shamoya
    Contributor

    Thanks @junshi15 for explaining.

    So, how do we go from here?
    Assuming we don't have duplicated recv support, we need to send the Tensor in one shot in all cases.
    Maybe we can revert to RDMA_SEND on those cases ?

    Ido

  13. junshi15 commented on Aug 17, 2017

    @junshi15
    ContributorAuthor

    @shamoya With my limited understanding of RDMA_SEND, I do not see how it can solve the problem.
    With RDMA_SEND, the receiver specifies destination MR. But the MR needs to be created first. To create it, the receiver needs to know its size. The size is on the sender side. So it seems to me you still need to duplicate recv at least twice, first, get the size; second, send the tensor.

    Correct me if I am wrong, my understanding of RDMA_SEND is that it requires the same ordering at both sender and receiver. If the sender post_send A, B and C, in that order, but the receiver post_recv B, C and A. Then A goes to B's buffer, B goes to C's buffer, C goes to A's buffer. I do not know if we can enforce the ordering strictly.

    I do not have a simple solution to work around duplicate_recv. One solution will be to buffer the tensors and its callback, if any, inside RDMARendezvous. We do local_recv once, if that tensor can not be sent for any reason, i.e. MR not initialized, size changed, buffer busy, etc, we will just make a full copy of the tensor and put it in a table inside RDMARendezvous. For future recv of the same tensor, we look it up here instead of going to that waiter-table. Basically, we need to duplicate that waiter-table inside RDMARendezvous. Not a clean solution, but maybe doable.

    What do you think?

  14. shamoya commented on Aug 22, 2017

    @shamoya
    Contributor

    Thanks @junshi15 for the feedback.
    For the first issue I thought about maybe having some kind of a tensor buffers pools (max size), and maybe use it for the above cases, but you're about the second issue (ordering) and overall this is a not a good plan.

    Your idea sounds good and maybe we could progress with it.
    Let me try to do a quick check and get back to you.

  15. yanivbl6 commented on Aug 27, 2017

    @yanivbl6

    Do you want me to get in on this?
    I was thinking of duplicating the waiter table into the Tensor-Buffer, instead of the rendezvous.
    So the reaction to RDMA_MESSAGE_BUFFER_RESPONSE would be similar to SendNextItem() but would replace RecvLocalAsync with a lookup in it's local table.
    I think a seperate queue for items is also required for this to work.

  16. shamoya commented on Aug 27, 2017

    @shamoya
    Contributor

    @yanivbl6 @junshi15
    Since we are now buffer and the tensor (to be sent), need to think how to tell the device (in which the tensor reside) not to free the it (device->context->Ref() ) or we can already allocate the local buffer and copy it to there already ?

  17. junshi15 commented on Aug 27, 2017

    @junshi15
    ContributorAuthor

    @yanivbl6 Feel free to contribute. You may want to coordinate with @shamoya who has spent a lot time on this. I have been occupied by projects at work and won't have much time on this in the near future.
    @shamoya I think the waiter should handle reference counting. The original reference counting was wrong, as you pointed out. We need to fix this in the new patch.

  18. shamoya commented on Aug 28, 2017

    @shamoya
    Contributor

    Thanks @junshi15 , me and @yanivbl6 are working together.
    BTW, I found what did the missing UnRef() we had in the tolerate_dup_recv - Here
    At the end of the step, someone is pulling all the remaining items in the table and deleting them.

  19. tensorflowbutler commented on Dec 20, 2017

    @tensorflowbutler
    Member

    It has been 14 days with no activity and this issue has an assignee.Please update the label and/or status accordingly.

  20. junshi15 commented on Dec 20, 2017

    @junshi15
    ContributorAuthor

    This issue is addressed by #12705

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

stat:awaiting tensorflower

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions