Device API V2 Improvements #11150
Conversation
| /* Migrate the constructed handle header to device memory */ | ||
| ucp_mem_type_unpack(ep->worker, mem->address, &handle, sizeof(handle), | ||
| ucp_mem_type_unpack(ep->worker, mem->address, handle, handle_size, | ||
| mem_type); |
| uct_cuda_ipc_device_mem_element_t cuda_ipc_mem_element; | ||
| }; | ||
|
|
||
| /* Base structure for all device memory elements */ |
| @@ -772,16 +767,13 @@ static ucs_status_t ucp_device_remote_mem_list_element_pack( | |||
| uct_rkey = ucp_rkey_get_tl_rkey(rkey, rkey_index); | |||
| ucs_assert(uct_rkey != UCT_INVALID_RKEY); | |||
|
|
|||
| UCS_F_DEVICE ucs_status_t ucp_device_check_params(const T mem_list_h, | ||
| unsigned index) | ||
| { | ||
| if (DEVICE_ENABLE_PARAMS_CHECK) { |
There was a problem hiding this comment.
this macro should have UCP_ prefix since it's compiled as part of user's code
| if (((mem_list_h)->version != UCP_DEVICE_MEM_LIST_VERSION_V1) || | ||
| ((index) >= (mem_list_h)->length)) { |
There was a problem hiding this comment.
extra () not needed it's not a macro
| if (DEVICE_ENABLE_PARAMS_CHECK) { | ||
| if (((mem_list_h)->version != UCP_DEVICE_MEM_LIST_VERSION_V1) || | ||
| ((index) >= (mem_list_h)->length)) { | ||
| printf("Invalid parameters for %p\n", mem_list_h); |
| #define UCS_F_DEVICE static inline | ||
| #endif /* __NVCC__ */ | ||
|
|
||
| #ifndef DEVICE_ENABLE_PARAMS_CHECK |
| uint32_t lkey; | ||
| uint32_t rkey; | ||
| } uct_rc_gdaki_device_mem_element_t; | ||
| } uct_ib_md_device_mem_element_t; |
There was a problem hiding this comment.
shall we move these structs to ib/cuda_ipc and not have them in uct common code?
There was a problem hiding this comment.
Will move in next PR after revert to query size from transport.
| } | ||
|
|
||
| static ucs_status_t | ||
| uct_ib_md_mlx5_devx_mem_elem_pack(uct_md_h md, uct_mem_h memh, uct_rkey_t rkey, |
There was a problem hiding this comment.
uct_ib_md_mlx5_devx_md_mem_elem_pack
| { | ||
| size_t handle_size = 0; | ||
| size_t uct_elem_size[UCP_DEVICE_MEM_LIST_MAX_EPS]; | ||
| const size_t uct_elem_size = sizeof(uct_device_mem_element_t); |
There was a problem hiding this comment.
Do we want to touch code we plan to remove?
| return UCS_ERR_NO_DEVICE; | ||
| } | ||
|
|
||
| handle_size *= params->num_elements; |
There was a problem hiding this comment.
maybe add variable like num_lanes, that we increment in line 381, and then
handle_size = sizeof(*handle) + (num_lanes * params->num_elements)
it's better that use same variable with different meanings over time
There was a problem hiding this comment.
Do we want to touch code we plan to remove?
| handle->local_addrs = (void**)UCS_PTR_BYTE_OFFSET( | ||
| mem->address, UCS_PTR_BYTE_DIFF(handle, local_addresses)); | ||
| handle->remote_addrs = (uint64_t*)UCS_PTR_BYTE_OFFSET( | ||
| mem->address, UCS_PTR_BYTE_DIFF(handle, remote_addresses)); | ||
| handle->lengths = (size_t*)UCS_PTR_BYTE_OFFSET(mem->address, |
There was a problem hiding this comment.
i guess we could remove these after removing v1 device api from ucx?
| status = ucp_mem_do_alloc(context, NULL, handle_size, | ||
| UCT_MD_MEM_ACCESS_LOCAL_READ | | ||
| UCT_MD_MEM_ACCESS_LOCAL_WRITE, | ||
| mem_type, local_sys_dev, | ||
| "ucp_device_remote_mem_list_handle_t", mem); | ||
| if (status != UCS_OK) { | ||
| ucs_error("failed to allocate ucp_device_remote_mem_list_handle_t: %s", | ||
| ucs_status_string(status)); | ||
| goto out; | ||
| } | ||
|
|
||
| return UCS_OK; | ||
| ucp_mem_type_unpack(ep->worker, mem->address, handle, handle_size, | ||
| mem_type); |
There was a problem hiding this comment.
can unite common code with create local mem list handle?
What?
Fix comments and improve implementation
Why?
Address open comments from #11123