Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
24edc00
Pass local and remote addrs to ucp_device_mem_list_create()
michal-shalev Sep 22, 2025
00b8a2b
Change local and remote addrs to offsets in post APIs
michal-shalev Sep 22, 2025
6b33ffb
fix clang format
michal-shalev Sep 22, 2025
2156ba1
Rename following PR fixes on UCX PR-10904
michal-shalev Sep 22, 2025
75ef1cd
Change signal addr to offset
michal-shalev Sep 28, 2025
8a9365b
Add channel_id
michal-shalev Sep 28, 2025
5bee4eb
Change void * to uint64_t
michal-shalev Sep 28, 2025
3687632
PR fixes
michal-shalev Sep 28, 2025
2619bdd
PR fixes 2.0
michal-shalev Sep 28, 2025
5001a67
PR fixes 3.0
michal-shalev Sep 28, 2025
1129da9
PR fixes 4.0
michal-shalev Sep 28, 2025
8624cc6
Fix clang format
michal-shalev Sep 28, 2025
840d888
Update test calls
michal-shalev Sep 28, 2025
772222b
Add channel_id to the UCX API calls according to UCX PR 10920
michal-shalev Sep 29, 2025
ecba188
Add length to UCP mem element according to UCX PR 10920
michal-shalev Sep 29, 2025
812c91c
Add channel_id to ucp_device_progress_req call
michal-shalev Sep 30, 2025
dbd82ca
Fix CI linker issue
michal-shalev Sep 30, 2025
a76525f
Update call to ucp_device_put_multi() according to UCX PR 10920
michal-shalev Sep 30, 2025
cde4916
PR fixes 5.0
michal-shalev Sep 30, 2025
6ab4463
Merge branch 'main' into device-api-changes
michal-shalev Sep 30, 2025
237d759
Update call to ucp_device_progress_req() according to UCX PR 10920
michal-shalev Oct 1, 2025
26d1a9d
Default channel_id 0 and fix tests
michal-shalev Oct 6, 2025
2a66b8f
Update channel_id param order according to UCX PR 10920
michal-shalev Oct 6, 2025
7383942
Merge branch 'main' into device-api-changes
michal-shalev Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 28 additions & 27 deletions src/api/gpu/ucx/nixl_device.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -74,29 +74,29 @@ nixlGpuConvertUcsStatus(ucs_status_t status) {
/**
* @brief Post a memory transfer request to the GPU.
*
* @param req_hndl [in] Request handle.
* @param index [in] Index of the memory descriptor in the transfer request.
* @param addr [in] Local address of the memory to be transferred.
* @param remote_addr [in] Remote address of the memory to be transferred to.
* @param size [in] Size of the memory to be transferred.
* @param is_no_delay [in] Whether to use no-delay mode.
* @param xfer_status [out] Status of the transfer. If null, the status is not reported.
* @param req_hndl [in] Request handle.
* @param index [in] Index of the memory descriptor in the transfer request.
* @param local_offset [in] Local offset of the memory to be transferred.
* @param remote_offset [in] Remote offset of the memory to be transferred to.
* @param size [in] Size of the memory to be transferred.
* @param is_no_delay [in] Whether to use no-delay mode.
* @param xfer_status [out] Status of the transfer. If null, the status is not reported.
*
* @return nixl_status_t Error code if call was not successful
*/
template<nixl_gpu_level_t level = nixl_gpu_level_t::THREAD>
__device__ nixl_status_t
nixlGpuPostSingleWriteXferReq(nixlGpuXferReqH req_hndl,
unsigned index,
const void *addr,
uint64_t remote_addr,
const void *local_offset,
uint64_t remote_offset,
size_t size,
bool is_no_delay = true,
nixlGpuXferStatusH *xfer_status = nullptr) {
const nixlGpuXferReqParams params{req_hndl, is_no_delay, xfer_status};

ucs_status_t status = ucp_device_put_single<static_cast<ucs_device_level_t>(level)>(
params.mem_list, index, addr, remote_addr, size, params.flags, params.ucp_request);
params.mem_list, index, local_offset, remote_offset, size, params.flags, params.ucp_request);

return nixlGpuConvertUcsStatus(status);
}
Expand All @@ -105,8 +105,8 @@ nixlGpuPostSingleWriteXferReq(nixlGpuXferReqH req_hndl,
* @brief Post a signal transfer request to the GPU.
*
* @param req_hndl [in] Request handle.
* @param index [in] Index of the signal to be transferred.
* @param signal [in] Signal to be sent.
* @param signal_index [in] Index of the signal to be transferred.
* @param is_no_delay [in] Whether to use no-delay mode.
* @param xfer_status [out] Status of the transfer. If null, the status is not reported.
*
Expand All @@ -115,14 +115,14 @@ nixlGpuPostSingleWriteXferReq(nixlGpuXferReqH req_hndl,
template<nixl_gpu_level_t level = nixl_gpu_level_t::THREAD>
__device__ nixl_status_t
nixlGpuPostSignalXferReq(nixlGpuXferReqH req_hndl,
unsigned index,
const nixlGpuSignal &signal,
unsigned signal_index,
bool is_no_delay = true,
nixlGpuXferStatusH *xfer_status = nullptr) {
const nixlGpuXferReqParams params{req_hndl, is_no_delay, xfer_status};

ucs_status_t status = ucp_device_counter_inc<static_cast<ucs_device_level_t>(level)>(
params.mem_list, index, signal.inc, signal.remote_addr, params.flags, params.ucp_request);
params.mem_list, signal_index, signal.inc, signal.remote_addr, params.flags, params.ucp_request);

return nixlGpuConvertUcsStatus(status);
}
Expand All @@ -132,12 +132,13 @@ nixlGpuPostSignalXferReq(nixlGpuXferReqH req_hndl,
*
* @param req_hndl [in] Request handle.
* @param count [in] Number of blocks to send. This is also the length of the arrays
* @a indices, @a sizes, @a addrs, and @a remote_addrs.
* @a indices, @a sizes, @a local_offsets, and @a remote_offsets.
* @param indices [in] Indices of the blocks to send.
* @param sizes [in] Sizes of the blocks to send.
* @param addrs [in] Addresses of the blocks to send.
* @param remote_addrs [in] Remote addresses of the blocks to send to.
* @param local_offsets [in] Local offsets of the blocks to send.
* @param remote_offsets [in] Remote offsets of the blocks to send to.
* @param signal [in] Signal to be sent.
* @param signal_index [in] Index of the signal to be sent.
* @param is_no_delay [in] Whether to use no-delay mode.
* @param xfer_status [out] Status of the transfer. If null, the status is not reported.
*
Expand All @@ -149,8 +150,8 @@ nixlGpuPostPartialWriteXferReq(nixlGpuXferReqH req_hndl,
size_t count,
const unsigned *indices,
const size_t *sizes,
void *const *addrs,
const uint64_t *remote_addrs,
void *const *local_offsets,
const uint64_t *remote_offsets,
const nixlGpuSignal &signal,
unsigned signal_index,
bool is_no_delay = true,
Expand All @@ -161,8 +162,8 @@ nixlGpuPostPartialWriteXferReq(nixlGpuXferReqH req_hndl,
ucp_device_put_multi_partial<static_cast<ucs_device_level_t>(level)>(params.mem_list,
indices,
count,
addrs,
remote_addrs,
local_offsets,
remote_offsets,
sizes,
signal_index,
signal.inc,
Expand All @@ -178,13 +179,13 @@ nixlGpuPostPartialWriteXferReq(nixlGpuXferReqH req_hndl,
*
* @param req_hndl [in] Request handle.
* @param sizes [in] Sizes of the blocks to send.
* @param addrs [in] Addresses of the blocks to send.
* @param remote_addrs [in] Remote addresses of the blocks to send to.
* @param offsets [in] Offsets of the blocks to send.
* @param remote_offsets [in] Remote offsets of the blocks to send to.
* @param signal [in] Signal to be sent.
* @param is_no_delay [in] Whether to use no-delay mode.
* @param xfer_status [out] Status of the transfer. If null, the status is not reported.
*
* @note The arrays @a sizes, @a addrs, and @a remote_addrs must have the same length, which
* @note The arrays @a sizes, @a offsets, and @a remote_offsets must have the same length, which
* corresponds to the number of blocks to transfer as specified in @a req_hndl.
*
* @return nixl_status_t Error code if call was not successful
Expand All @@ -193,17 +194,17 @@ template<nixl_gpu_level_t level = nixl_gpu_level_t::THREAD>
__device__ nixl_status_t
nixlGpuPostWriteXferReq(nixlGpuXferReqH req_hndl,
const size_t *sizes,
void *const *addrs,
const uint64_t *remote_addrs,
void *const *offsets,
const uint64_t *remote_offsets,
const nixlGpuSignal &signal,
bool is_no_delay = true,
nixlGpuXferStatusH *xfer_status = nullptr) {
const nixlGpuXferReqParams params{req_hndl, is_no_delay, xfer_status};

ucs_status_t status =
ucp_device_put_multi<static_cast<ucs_device_level_t>(level)>(params.mem_list,
addrs,
remote_addrs,
offsets,
remote_offsets,
sizes,
signal.inc,
signal.remote_addr,
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/ucx/ucx_backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1654,19 +1654,22 @@ nixlUcxEngine::createGpuXferReq(const nixlBackendReqH &req_hndl,

std::vector<nixlUcxMem> local_mems;
std::vector<const nixl::ucx::rkey *> remote_rkeys;
std::vector<uint64_t> remote_addrs;
local_mems.reserve(local_descs.descCount());
remote_rkeys.reserve(remote_descs.descCount());
remote_addrs.reserve(remote_descs.descCount());

for (size_t i = 0; i < static_cast<size_t>(local_descs.descCount()); i++) {
auto localMd = static_cast<nixlUcxPrivateMetadata *>(local_descs[i].metadataP);
auto remoteMdDesc = static_cast<nixlUcxPublicMetadata *>(remote_descs[i].metadataP);

local_mems.push_back(localMd->mem);
remote_rkeys.push_back(&remoteMdDesc->getRkey(workerId));
remote_addrs.push_back(static_cast<uint64_t>(remote_descs[i].addr));
}

try {
gpu_req_hndl = nixl::ucx::createGpuXferReq(*ep, local_mems, remote_rkeys);
gpu_req_hndl = nixl::ucx::createGpuXferReq(*ep, local_mems, remote_rkeys, remote_addrs);
return NIXL_SUCCESS;
}
catch (const std::exception &e) {
Expand Down
19 changes: 12 additions & 7 deletions src/utils/ucx/gpu_xfer_req_h.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,34 @@ namespace nixl::ucx {
nixlGpuXferReqH
createGpuXferReq(const nixlUcxEp &ep,
const std::vector<nixlUcxMem> &local_mems,
const std::vector<const nixl::ucx::rkey *> &remote_rkeys) {
const std::vector<const nixl::ucx::rkey *> &remote_rkeys,
const std::vector<uint64_t> &remote_addrs) {
nixl_status_t status = ep.checkTxState();
if (status != NIXL_SUCCESS) {
throw std::runtime_error("Endpoint not in valid state for creating memory list");
}

if (local_mems.empty() || remote_rkeys.empty()) {
throw std::invalid_argument("Empty memh or rkey lists provided");
if (local_mems.empty() || remote_rkeys.empty() || remote_addrs.empty()) {
throw std::invalid_argument("Empty memory, rkey, or address lists provided");
}

if (local_mems.size() != remote_rkeys.size()) {
throw std::invalid_argument("Local memh and remote rkey lists must have same size");
if (local_mems.size() != remote_rkeys.size() || local_mems.size() != remote_addrs.size()) {
throw std::invalid_argument(
"Local memory, remote rkey, and remote address lists must have same size");
}

std::vector<ucp_device_mem_list_elem_t> ucp_elements;
ucp_elements.reserve(local_mems.size());

for (size_t i = 0; i < local_mems.size(); i++) {
ucp_device_mem_list_elem_t ucp_elem;
ucp_elem.field_mask =
UCP_DEVICE_MEM_LIST_ELEM_FIELD_MEMH | UCP_DEVICE_MEM_LIST_ELEM_FIELD_RKEY;
ucp_elem.field_mask = UCP_DEVICE_MEM_LIST_ELEM_FIELD_MEMH |
UCP_DEVICE_MEM_LIST_ELEM_FIELD_RKEY | UCP_DEVICE_MEM_LIST_ELEM_FIELD_L_ADDR |
UCP_DEVICE_MEM_LIST_ELEM_FIELD_R_ADDR;
ucp_elem.memh = local_mems[i].getMemh();
ucp_elem.rkey = remote_rkeys[i]->get();
ucp_elem.l_addr = local_mems[i].getBase();
ucp_elem.r_addr = remote_addrs[i];
ucp_elements.push_back(ucp_elem);
}

Expand Down
7 changes: 4 additions & 3 deletions src/utils/ucx/gpu_xfer_req_h.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ namespace nixl::ucx {
class rkey;

nixlGpuXferReqH
createGpuXferReq(const nixlUcxEp &,
const std::vector<nixlUcxMem> &,
const std::vector<const nixl::ucx::rkey *> &);
createGpuXferReq(const nixlUcxEp &ep,
const std::vector<nixlUcxMem> &local_mems,
const std::vector<const nixl::ucx::rkey *> &remote_rkeys,
const std::vector<uint64_t> &remote_addrs);

void
releaseGpuXferReq(nixlGpuXferReqH gpu_req) noexcept;
Expand Down
5 changes: 5 additions & 0 deletions src/utils/ucx/ucx_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ class nixlUcxMem {
return memh;
}

[[nodiscard]] void *
getBase() const noexcept {
return base;
}

friend class nixlUcxWorker;
friend class nixlUcxContext;
friend class nixlUcxEp;
Expand Down
Loading