Skip to content

UCP/RNDV: Fallback to PUT pipeline only if PUT protocol is supported - #6881

Merged
dmitrygx merged 1 commit into
openucx:masterfrom
dmitrygx:topic/ucp/rndv_put_pipe
Jun 29, 2021
Merged

dmitrygx merged 1 commit into
openucx:masterfrom
dmitrygx:topic/ucp/rndv_put_pipe

Conversation

@dmitrygx

@dmitrygx dmitrygx commented Jun 1, 2021 •

Copy link
Copy Markdown
Member

What

Fallback to PUT pipeline only if PUT protocol is supported.

Why ?

Fixes #6836.

How ?

When is going to fallback to PUT pipeline protocol, check PUT Zcopy support assuming symmetric configuration of sender and receiver, i.e. check that the length of the message is:

  • greater than minimum PUT Zcopy
  • maximum PUT Zcopy isn't 0

@dmitrygx

dmitrygx commented Jun 1, 2021

Copy link
Copy Markdown
Member Author

@bureddy

@dmitrygx

dmitrygx commented Jun 2, 2021

Copy link
Copy Markdown
Member Author

@Akshay-Venkatesh @bureddy @SeyedMir could you review pls?

Comment on lines +1289 to +1314
UCS_TEST_P(test_ucp_am_nbx_rndv_memtype_disable_zcopy, rndv_disable_put_zcopy)
{
disable_rndv_zcopy_config(sender(), UCT_IFACE_FLAG_PUT_ZCOPY);
disable_rndv_zcopy_config(receiver(), UCT_IFACE_FLAG_PUT_ZCOPY);

ucs_memory_type_t mt = static_cast<ucs_memory_type_t>(get_variant_value(0));
test_am_send_recv(64 * UCS_KBYTE, 8, 0, mt);
}

UCS_TEST_P(test_ucp_am_nbx_rndv_memtype_disable_zcopy, rndv_disable_get_zcopy)
{
disable_rndv_zcopy_config(sender(), UCT_IFACE_FLAG_GET_ZCOPY);
disable_rndv_zcopy_config(receiver(), UCT_IFACE_FLAG_GET_ZCOPY);

ucs_memory_type_t mt = static_cast<ucs_memory_type_t>(get_variant_value(0));
test_am_send_recv(64 * UCS_KBYTE, 8, 0, mt);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can define a common function for these tests with caps parameter

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done

Comment thread src/ucp/rndv/rndv.c
/* send FRAG RTR for sender to PUT the fragment. */
ucp_rndv_send_frag_rtr(worker, rndv_req, rreq, rndv_rts_hdr);
goto out;
} else if (is_get_zcopy_supported) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

isn't presence of remote addr in RTS already saying that get zcopy is supported?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it says that sender allows us to use GET Zcopy.
but we need to check local min/max of GET Zcopy to make sure GET Zcopy RNDV is supported by TLs

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

then should we set is_get_zcopy_failed to true if we do not get into this else if? Because we do not register recv buffer for AM flow

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

if we get here, it must be already set,
added assert() to document it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@dmitrygx shouldn't above check if (!is_get_zcopy_failed) ?
because is_get_zcopy_supported might be true but is_get_zcopy_failed is false because GDR not available at receiver?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@dmitrygx shouldn't above check if (!is_get_zcopy_failed) ?

I tried it, but it disables pipeline GET Zcopy then.
since we do GET Zcopy first and if it fails (e.g. GDR is not available)m it sets is_get_zcopy_failed to true and then we should fallback to pipeline GET protocol.

because is_get_zcopy_supported might be true but is_get_zcopy_failed is false because GDR not available at receiver?

yes, this check aims it. is_get_zcopy_supported should be true and since we get here it guarantees that is_get_zcopy_failed is true.

Comment thread src/ucp/rndv/rndv.c
Comment on lines +1125 to +1070
lane = ucp_rndv_zcopy_get_lane(rndv_req, &uct_rkey,
UCP_REQUEST_SEND_PROTO_RNDV_GET);
if (lane == UCP_NULL_LANE) {
goto err;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when can it be NULL?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

like in normal GET Zcopy, it can be NULL if not able to select GET protocol due to RKEY
I had a reproducer for this. So, it was fixed in the same as in GET

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is the reproducer?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it was reproduced with some test case in our gtests

Comment thread src/ucp/rndv/rndv.c Outdated
Comment on lines +563 to +564
req->send.lane =
ucp_rndv_zcopy_get_lane(req, &uct_rkey,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: looks like it can fir single line now

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

unfortunately, no
the last argument UCP_REQUEST_SEND_PROTO_RNDV_GET breaks the 80 symbols per line rule

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i meant

req->send.lane = ucp_rndv_zcopy_get_lane(req, &uct_rkey,
                                         UCP_REQUEST_SEND_PROTO_RNDV_GET);

anyway it's minor comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it doesn't fit 80 symbols per line

Comment thread src/ucp/rndv/rndv.c Outdated
Comment on lines +584 to +589
if (req != rndv_req) {
/* If GET Zcopy operation was issued as a part of fragmented protocol,
* release the fragmented request which is no longer needed */
ucs_mpool_put_inline((void*)req->send.mdesc);
ucp_request_put(req);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it's not supposed to be supported for fragmented protocols at all, is it? Maybe better assert here then

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it's not supposed to be supported for fragmented protocols at all, is it?

it is supported by GET pipeline and GET protocols.
only PUT pipeline doesn't support it when doing GET GPU->HOST memory copy

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

are you sure AM rndv flow is supported for fragmented protos?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

RNDV AM isn't supported by fragmented protocol.
But we send RTR to start PUT (normal or pipeline, if supported) or AM instead of GET (normal or fragmented).

Comment thread src/ucp/rndv/rndv.c Outdated
{
ucp_request_t *rndv_req = ucs_container_of(self, ucp_request_t, send.uct);
ucp_request_t *req = ucs_container_of(self, ucp_request_t, send.uct);
ucp_request_t *rndv_req;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is changes in this func related to the reported issue (or) covering some other issue?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yes, it fixes issue appeared after fixing the original one.
normal GET Zcopy fallbacks to pipeline GET Zcopy, but it couldn't be done too, so it should send RTR. But need to correctly release all things allocated for GET.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

when is the pipeline GET ZCOPY can fail? it does GET on HOST memory which should always be a success with both IB and TCP. is it because you explicitly force disabled UCT_IFACE_FLAG_GET_ZCOPY in the gtest?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

when is the pipeline GET ZCOPY can fail? it does GET on HOST memory which should always be a success with both IB and TCP. is it because you explicitly force disabled UCT_IFACE_FLAG_GET_ZCOPY in the gtest?

yes, when there is no UCT_IFACE_FLAG_GET_ZCOPY capability on transports.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

in that case, isn't '"is_get_zcopy_supported" is false and ucp_rndv_recv_start_get_pipeline is not called?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

in that case, isn't '"is_get_zcopy_supported" is false and ucp_rndv_recv_start_get_pipeline is not called?,

if is_get_zcopy_supported - false, then ucp_rndv_recv_start_get_pipeline is not called, since GET operation can't be done

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@bureddy the changes is needed to release resources (mdesc, request) for fragmented GET protocol if it couldn't be used by some reason (i.e. ucp_rndv_zcopy_get_lane() returns UCP_NULL_LANE).

@dmitrygx

Copy link
Copy Markdown
Member Author

@brminich @yosefe could you review pls when you have time?

Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread test/gtest/ucp/test_ucp_am.cc Resolved
Comment thread test/gtest/ucp/test_ucp_am.cc Outdated
Comment on lines +1280 to +1285
if (zcopy_caps == UCT_IFACE_FLAG_PUT_ZCOPY) {
ucp_ep_config_rndv_zcopy_commit(0, &config->rndv.put_zcopy);
} else {
ASSERT_TRUE(zcopy_caps == UCT_IFACE_FLAG_GET_ZCOPY);
ucp_ep_config_rndv_zcopy_commit(0, &config->rndv.get_zcopy);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what use case does it represent? We already run it on various transports, so what is emulated by hacking caps?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

we are emulating that either GET Zcopy or PUT Zcopy isn't supported by the transport.
the idea is to check how pipeline and normal RNDV will handle it.

@dmitrygx

Copy link
Copy Markdown
Member Author

bot:pipe:retest

@dmitrygx

Copy link
Copy Markdown
Member Author

@brminich is it ok now?

@dmitrygx

Copy link
Copy Markdown
Member Author

@yosefe could you review pls?

Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c
Comment on lines +1125 to +1068
lane = ucp_rndv_zcopy_get_lane(rndv_req, &uct_rkey,
UCP_REQUEST_SEND_PROTO_RNDV_GET);
if (lane == UCP_NULL_LANE) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Don't we already check it inside ucp_rndv_progress_rma_get_zcopy, called from progress, as set by ucp_rndv_send_frag_get_mem_type in line 1137?
We can check if lanes are valid inside ucp_rndv_progress_rma_get_zcopy, or before it, but why need both?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

removed it from ucp_rndv_progress_rma_get_zcopy() - just added assertion to check that it is called when there are lanes to do GET Zcopy.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

upd: unfortunately, i found out that we still need this code to get GET Zcopy lane to get correct UCT rkey.
but it if (lane != UCP_NULL_LANE) replaced with assertion

Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
Comment thread test/gtest/ucp/test_ucp_am.cc Resolved
@dmitrygx

Copy link
Copy Markdown
Member Author

@yosefe could you review pls again?
the failure isn't related, it is docker issue

Comment thread src/ucp/core/ucp_ep.h Resolved
Comment thread src/ucp/rndv/rndv.c Resolved
@dmitrygx
dmitrygx force-pushed the topic/ucp/rndv_put_pipe branch from e61829c to b344a26 Compare June 28, 2021 21:10
@dmitrygx
dmitrygx merged commit a2f167d into openucx:master Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rndv pipepline fails if the iface does not support put_zcopy

4 participants