Repository navigation
UCP/RNDV/PPLN: Advertise error handling capability for put_mtype/ppln protocols - #10075
Conversation
6109394 to
362dcc1
Compare
362dcc1 to
1218213
Compare
1218213 to
5d0fe20
Compare
| "Use two stage pipeline rendezvous protocol for intra-node GPU to GPU transfers", | ||
| ucs_offsetof(ucp_context_config_t, rndv_shm_ppln_enable), UCS_CONFIG_TYPE_BOOL}, | ||
|
|
||
| {"RNDV_PIPELINE_ERRH_ENABLE", "n", |
There was a problem hiding this comment.
An idea came to my mind that maybe it worth to introduce more common variable that allows using all the protocols which don't have implemented abort even if error handling is enabled. That control will allow customers to use all the protocols if they are OK that any abort call will cause hard error. Also it can be useful for testing and debugging from my point of view.
There was a problem hiding this comment.
I think this idea might be useful, but maybe it's out of scope of this PR. Because in this particular case we plan to implement proper support for error handling and therefore this env var will be removed in the subsequent commit. So for these protocols it's not gonna be used anymore, and for the other ones - it can be addressed separately with clear scope & testing
| [UCP_PROTO_RNDV_PPLN_STAGE_ACK] = ucp_proto_rndv_send_ppln_atp_progress, | ||
| }, | ||
| .abort = ucp_proto_abort_fatal_not_implemented, | ||
| .abort = ucp_proto_rndv_ppln_abort, |
There was a problem hiding this comment.
Maybe it would be better to leave that aborts pointers set to ucp_proto_abort_fatal_not_implemented so when it is called, user will get hard error instead of half-ready abortion implementation without memory invalidation?
There was a problem hiding this comment.
For now I would keep it for 2 reasons:
- As discussed on the meeting, we don't want to crash the application in case of remote peer failure.
- Current protocol selection logic explicitly requires that abort function pointer is set to a different function:
void ucp_proto_select_add_proto
...
if (init_params->ep_config_key->err_mode != UCP_ERR_HANDLING_MODE_NONE) {
ucs_assertv(ucp_protocols[proto_id]->abort !=
ucp_proto_abort_fatal_not_implemented,
"error handling is enabled, but %s doesn't support abort()",
proto_name);
}There was a problem hiding this comment.
maybe add warning message to ucp_proto_rndv_ppln_abort and ucp_proto_rndv_put_mtype_abort? BTW, they are 100% identical, so can be replaced with one common function, for example ucp_proto_ppln_abort
There was a problem hiding this comment.
Ok for warning message
Ok for common function
| "Use two stage pipeline rendezvous protocol for intra-node GPU to GPU transfers", | ||
| ucs_offsetof(ucp_context_config_t, rndv_shm_ppln_enable), UCS_CONFIG_TYPE_BOOL}, | ||
|
|
||
| {"RNDV_PIPELINE_ERRH_ENABLE", "n", |
There was a problem hiding this comment.
maybe
| {"RNDV_PIPELINE_ERRH_ENABLE", "n", | |
| {"RNDV_PIPELINE_ERROR_HANDLING", "n", |
to be consistent with UCX_POSIX_ERROR_HANDLING
| test_ucp_am_nbx_rndv_ppln() : m_mem_type(UCS_MEMORY_TYPE_HOST) { | ||
| } |
| bool is_ppln_supported(ucs_memory_type_t mem_type) | ||
| { | ||
| const auto ep = sender().ep(); | ||
| const auto config = ucp_ep_config(ep); | ||
|
|
||
| for (auto i = 0; i < config->key.num_lanes; ++i) { | ||
| const auto lane = config->key.rma_bw_lanes[i]; | ||
| if (lane == UCP_NULL_LANE) { | ||
| break; | ||
| } | ||
| if (ucp_ep_md_attr(ep, lane)->reg_mem_types & UCS_BIT(mem_type)) { | ||
| const auto iface_attr = | ||
| ucp_worker_iface_get_attr(sender().worker(), | ||
| ucp_ep_get_rsc_index(ep, lane)); | ||
| if (iface_attr->cap.flags & UCT_IFACE_FLAG_PUT_ZCOPY) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } |
There was a problem hiding this comment.
why is it needed?
there is ucp_test_base::entity::is_rndv_put_ppln_supported()
There was a problem hiding this comment.
Thanks for spotting this, this is not needed, and not actually used, it's just a leftover after rebasing on master
| static UCS_F_ALWAYS_INLINE void | ||
| ucp_proto_rndv_ppln_abort(ucp_request_t *req, ucs_status_t status) |
There was a problem hiding this comment.
minor: this function is supposed to be called by pointer on non-fast path, no need inline and static, i.e. it can be declared in some common .h and defined in .c
| "Use two stage pipeline rendezvous protocol for intra-node GPU to GPU transfers", | ||
| ucs_offsetof(ucp_context_config_t, rndv_shm_ppln_enable), UCS_CONFIG_TYPE_BOOL}, | ||
|
|
||
| {"RNDV_PIPELINE_ERROR_HANDLING", "n", |
There was a problem hiding this comment.
| {"RNDV_PIPELINE_ERROR_HANDLING", "n", | |
| {"MOCK_RNDV_PPLN_ERROR_HANDLING", "n", |
Not the perfect suggestion but I think it is important to represent in the name the fact that ppln error handling is just mocked but not really supported in this case.
There was a problem hiding this comment.
Personally I would not add "mock" prefix, but let's see what others think
There was a problem hiding this comment.
maybe RNDV_PPLN_IGNORE_FAILURES?
There was a problem hiding this comment.
I don't know, sounds a bit broad.. which failures?
maybe RNDV_PIPELINE_UNSAFE_ERROR_HANDLING?
There was a problem hiding this comment.
maybe RNDV_PPLN_ERROR_HANDLING?
The short form PPLN also appears in UCX_RNDV_SCHEME values
There was a problem hiding this comment.
[mikhailb@rock20 ucx]$ ucx_info -c | grep PIPELINE
UCX_RNDV_PIPELINE_SEND_THRESH=inf
UCX_RNDV_PIPELINE_SHM_ENABLE=y
[mikhailb@rock20 ucx]$ ucx_info -c | grep PPLN
[mikhailb@rock20 ucx]$
There was a problem hiding this comment.
wait, it's dissonant with previous vars:
{"RNDV_PIPELINE_SEND_THRESH", "inf",
"RNDV size threshold to enable sender side pipeline for mem type",
ucs_offsetof(ucp_context_config_t, rndv_pipeline_send_thresh), UCS_CONFIG_TYPE_MEMUNITS},
{"RNDV_PIPELINE_SHM_ENABLE", "y",
"Use two stage pipeline rendezvous protocol for intra-node GPU to GPU transfers",
ucs_offsetof(ucp_context_config_t, rndv_shm_ppln_enable), UCS_CONFIG_TYPE_BOOL},
{"RNDV_PPLN_ERROR_HANDLING", "n",| /* FIXME: Proper abort functionality is not implemented yet. | ||
| * This stub function is used to advertise error-handling capability for | ||
| * pipeline protocols, but proper implementation is to be done */ | ||
| ucs_warn("aborting ppln request %p with status %s", req, |
There was a problem hiding this comment.
WDYT about making warning more informative and describe what it can lead to?
| ucs_warn("aborting ppln request %p with status %s", req, | |
| ucs_warn("rndv ppln request %p was aborted with status %s. " | |
| "This may lead to memory leaks since rndv ppln abortion " | |
| "mocking was enabled", req, |
There was a problem hiding this comment.
My understanding is that it may lead to memory corruption rather than memory leak.
Because when we detect that EP is in failed state, we should invalidate the memh we exposed to prevent stale writes to it. Since we don't do invalidation yet, these writes may appear and damage chunk elements already used for different purpose.
So in worst case the same element is reused for some other operation and we can get data corrupted.
I can update the warning message with these details if you agree
There was a problem hiding this comment.
Yeah, AFAIK that is true too. I thought about memory leaks because we are using mempools and I am not sure that we are returning them back in case of this abortion stub calling.
Mentioning memory corruption is OK from my point of view.
There was a problem hiding this comment.
pls use ucs_diag instead of ucs_warn
There was a problem hiding this comment.
pls use
ucs_diaginstead ofucs_warn
why? AFAIU this callback is not expected to be called, IMO warning is ok here.
There was a problem hiding this comment.
+1 for leaving as warning (or at least debug message)
There was a problem hiding this comment.
+1 for leaving as warning (or at least debug message)
we are not going to remove it. We are duscussing the log level to be used
There was a problem hiding this comment.
if you are sure that connect-to-ep works as expected, then this message will only confuse with any level.
I see 2 potential issues here:
- completion if single fragment might be not enough to complete full ppl protocol. It may be relevant for any type of transport. (@iyastreb confirmed that this is not the case).
- invalidation flow is valid only for
connect-to-ifacetransport.
So,
- that's the reason to have it for
connect-to-ep? - invalidation flow may lead to hardly reproducible data corruption bug, IMO warning is preferable because on re-run (with log level diag) error flow may be not invoked at all or invoked but without data corruption.
There was a problem hiding this comment.
+1 for leaving as warning (or at least debug message)
we are not going to remove it. We are duscussing the log level to be used
I understand, but I think that we need to print a warning message instead of diag to explicitly show user that something went wrong and call that was not supposed to be called was called. FMPOV if we didn't print warning in that case in protov1 it doesn't mean that we should keep this behavior now.
There was a problem hiding this comment.
let's discuss it on meeting, this discussion becomes too long
| "Use two stage pipeline rendezvous protocol for intra-node GPU to GPU transfers", | ||
| ucs_offsetof(ucp_context_config_t, rndv_shm_ppln_enable), UCS_CONFIG_TYPE_BOOL}, | ||
|
|
||
| {"RNDV_PIPELINE_ERROR_HANDLING", "n", |
There was a problem hiding this comment.
maybe RNDV_PPLN_IGNORE_FAILURES?
7a65829 to
f9fa5ea
Compare
What
Using UCX in this combination: 1.18+proto_v2+CUDA async+error handling, causes memory transfer via host instead of bounce buffers, making transfers prohibitively slow. Unlike with proto_v1, pipeline protocol (rndv_ppln over rnvd_(put/rtr)_mtype) is not being selected, because it doesn't support error handling.
As a result, memory copy is done through host staging buffers which drastically affect performance. The proper solution would be to enable error handling for aforementioned protocols with rkey invalidation.
This PR is the first step towards the real solution: here we just advertise support for error handling without providing invalidation flow. Subsequent PR will provide the invalidation functionality.
Related PRs: #8666, #9999