Repository navigation
Conversation
Memory is exported to other hosts only as fabric handles, which are imported over IMEX, so being in the same NVLink domain is not enough. Require fabric support on both peers for cross-node reachability, and add the IMEX channel to the MNNVL device address, so that peers with different channels are not reachable.
|
🤖 Starting review — findings will be posted here when done. |
|
|
||
| if (!imex_channel.found) { | ||
| ucs_debug("CUDA fabric IPC support on device %d is disabled: no " | ||
| "accessible IMEX channel", cu_device); |
There was a problem hiding this comment.
when a process has access to several channels, is the lowest one always the one the driver exports on? otherwise peers with overlapping but different channel sets (local {0,5} vs remote {5}) will be reported unreachable.
There was a problem hiding this comment.
the lowest channel matches the driver: "When the GPU driver needs to find the channel associated with a user, it will find the lowest channel accessible by the user and use that for all operations" (https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/imexchannels.html). maybe mention it in the comment of uct_cuda_ipc_md_check_imex_channel_cb()?
| return 0; | ||
| } | ||
|
|
||
| if ((mnnvl_addr != NULL) && |
There was a problem hiding this comment.
the IMEX channel is sent only when FLAG_MNNVL is set, so the cross-PID-namespace fabric check below (same host, different containers) still can't compare it. should the channel be part of the base device address whenever FLAG_FABRIC is set?
Also, the header comment /* Valid if FLAG_FABRIC is set */ reads as if the field is always present when fabric is supported, which is not the case.
| @@ -155,13 +171,20 @@ static int uct_cuda_ipc_md_check_fabric_support(void) | |||
|
|
|||
There was a problem hiding this comment.
| static const char channel_prefix[] = "channel"; | |
| uct_cuda_ipc_md_imex_channel_t *imex_channel = arg; |
minor: pls keep consecutive assignments aligned (docs/CodeStyle.md).
| * by editing the address of a local entity before passing it to the check. | ||
| * On systems without MNNVL, MNNVL support and the NVLink domain of the MD are | ||
| * emulated as well, so that the check runs on any CUDA system. */ | ||
| * address, so a peer on another host, in another NVLink domain or with another |
There was a problem hiding this comment.
minor: the fixture now covers fabric/IMEX reachability too, maybe rename it to test_cuda_ipc_iface_reachability.
|
Residual coverage gap: the new test emulates MNNVL/fabric by poking |
| typedef struct { | ||
| uct_cuda_ipc_device_addr_t super; | ||
| uint64_t nvlink_domain; | ||
| uint32_t imex_channel; /* Valid if FLAG_FABRIC is set */ |
There was a problem hiding this comment.
pls check the NVLink domain when dev_addr_len >= ucs_offsetof(uct_cuda_ipc_mnnvl_device_addr_t, imex_channel), check the IMEX channel only when dev_addr_len >= sizeof(uct_cuda_ipc_mnnvl_device_addr_t), and add a test with the 17-byte address. This address format is already released in v1.23.2 (#12142), so with the current sizeof check uct_cuda_ipc_iface_mnnvl_dev_addr() returns NULL for a v1.23.2 peer and the NVLink domain check is skipped.
There was a problem hiding this comment.
I'll handle it. I didn't take into account it's already part of a release.
|
🤖 CI Triage Agent — Summary: Unable to fetch logs — cannot diagnose without them.
|
| remote_fabric_supported = | ||
| uct_cuda_ipc_iface_remote_fabric_supported(dev_addr, | ||
| dev_addr_len); | ||
| if (!local_fabric_supported || !remote_fabric_supported) { |
There was a problem hiding this comment.
pls require FLAG_FABRIC from the peer only if it sent the NVLink domain, like the PID namespace check below does with pid_ns; v1.22 and older send a 9-byte address with only FLAG_MNNVL, so they become unreachable over MNNVL.
| mnnvl_addr = uct_cuda_ipc_iface_mnnvl_dev_addr(params->device_addr, | ||
| dev_addr_len); | ||
| if (mnnvl_addr == NULL) { | ||
| mnnvl_addr = (const uct_cuda_ipc_mnnvl_device_addr_t*) |
There was a problem hiding this comment.
pls update the PR description: the NVLink domain address is already in v1.23 (#12142), so this PR appends the IMEX channel and checks each field by address length.
| * the IMEX channel */ | ||
| static void set_older_peer(std::string &dev_addr) | ||
| { | ||
| dev_addr.resize(sizeof(uct_cuda_ipc_device_addr_t)); |
There was a problem hiding this comment.
| dev_addr.resize(sizeof(uct_cuda_ipc_device_addr_t)); | |
| dev_addr.resize(sizeof(uct_cuda_ipc_device_addr_t)); | |
| set_no_fabric(dev_addr); |
older UCX never sets FLAG_FABRIC, so older_peer passes now only because the truncated address keeps it.
| uint64_t nvlink_domain; /* Since v1.23.2 */ | ||
| uint32_t imex_channel; /* Not sent by v1.23.2, valid | ||
| if FLAG_FABRIC is set */ |
There was a problem hiding this comment.
| uint64_t nvlink_domain; /* Since v1.23.2 */ | |
| uint32_t imex_channel; /* Not sent by v1.23.2, valid | |
| if FLAG_FABRIC is set */ | |
| uint64_t nvlink_domain; /* Since v1.23 */ | |
| uint32_t imex_channel; /* Not sent by v1.23, valid | |
| if FLAG_FABRIC is set */ |
minor: v1.23.0-rc3 already sends the NVLink domain (#12142), maybe also rename the v1_23_2_peer test.
| mnnvl_addr->imex_channel = md->fabric_supported ? | ||
| md->imex_channel : 0; |
There was a problem hiding this comment.
| mnnvl_addr->imex_channel = md->fabric_supported ? | |
| md->imex_channel : 0; | |
| mnnvl_addr->imex_channel = md->imex_channel; |
minor: md is allocated with ucs_calloc() and imex_channel is set only when fabric is supported, so it is already 0 otherwise.
| /** IMEX channel used to export and import fabric handles, valid if | ||
| * fabric_supported. Fabric handles can be imported only by a process | ||
| * which has access to the same IMEX channel. */ |
There was a problem hiding this comment.
| /** IMEX channel used to export and import fabric handles, valid if | |
| * fabric_supported. Fabric handles can be imported only by a process | |
| * which has access to the same IMEX channel. */ | |
| /** IMEX channel used to export and import fabric handles, 0 if not | |
| * fabric_supported. Fabric handles can be imported only by a process | |
| * which has access to the same IMEX channel. */ |
minor: then the address packing can use it as is.
| /* Whether the peer sent the given field of the MNNVL device address */ | ||
| #define UCT_CUDA_IPC_MNNVL_ADDR_HAS_FIELD(_dev_addr_len, _field) \ | ||
| ((_dev_addr_len) >= \ | ||
| (ucs_offsetof(uct_cuda_ipc_mnnvl_device_addr_t, _field) + \ | ||
| ucs_field_sizeof(uct_cuda_ipc_mnnvl_device_addr_t, _field))) |
There was a problem hiding this comment.
maybe keep the uct_cuda_ipc_iface_mnnvl_dev_addr() helper from master and add one struct level for the IMEX channel, like ucs_cma_iface_ext_device_addr_t does for pid_ns? each struct is then one address version, checked by sizeof, and the per-field macro is not needed:
typedef struct {
uct_cuda_ipc_mnnvl_device_addr_t super;
uint32_t imex_channel;
} UCS_S_PACKED uct_cuda_ipc_fabric_device_addr_t;There was a problem hiding this comment.
I considered this too but wasn’t sure how stable the address is going to stay across versions and wanted avoid adding too many levels to it. On the other hand it may be more safe and consistent with other structs..
| local_fabric_supported = md->fabric_supported; | ||
| remote_fabric_supported = | ||
| uct_cuda_ipc_iface_remote_fabric_supported(dev_addr, | ||
| dev_addr_len); | ||
| if (!local_fabric_supported || !remote_fabric_supported) { | ||
| uct_iface_fill_info_str_buf( | ||
| params, | ||
| "different machine and FABRIC support local=%d remote=%d", | ||
| local_fabric_supported, remote_fabric_supported); | ||
| return 0; | ||
| } |
There was a problem hiding this comment.
pls move this check to a helper shared with the PID namespace check below, e.g. uct_cuda_ipc_iface_fabric_reachable(md, params, dev_addr, dev_addr_len, "different machine"); the two blocks differ only in the message, and local_fabric_supported is just md->fabric_supported.
|
|
||
| if (!imex_channel.found) { | ||
| ucs_debug("CUDA fabric IPC support on device %d is disabled: no " | ||
| "accessible IMEX channel", cu_device); |
There was a problem hiding this comment.
the lowest channel matches the driver: "When the GPU driver needs to find the channel associated with a user, it will find the lowest channel accessible by the user and use that for all operations" (https://docs.nvidia.com/multi-node-nvlink-systems/imex-guide/imexchannels.html). maybe mention it in the comment of uct_cuda_ipc_md_check_imex_channel_cb()?
| md->fabric_supported = uct_cuda_ipc_md_check_fabric_support( | ||
| &md->imex_channel); |
There was a problem hiding this comment.
| md->fabric_supported = uct_cuda_ipc_md_check_fabric_support( | |
| &md->imex_channel); | |
| md->fabric_supported = uct_cuda_ipc_md_check_fabric_support( | |
| &md->imex_channel); | |
| ucs_debug("CUDA fabric IPC support is %s, IMEX channel %u", | |
| md->fabric_supported ? "enabled" : "disabled", md->imex_channel); |
minor: maybe log once here, like uct_cuda_ipc_md_check_fabric_info() does for MNNVL, and drop the two logs inside? then the #else build and the silent paths (no fabric support on the device, no /dev/nvidia-caps-imex-channels) are logged too.
|
🤖 Starting review — findings will be posted here when done. |
| remote_fabric_supported = | ||
| uct_cuda_ipc_iface_remote_fabric_supported(dev_addr, | ||
| dev_addr_len); | ||
| if (!local_fabric_supported || !remote_fabric_supported) { |
There was a problem hiding this comment.
Wire compatibility: does a v1.23.2 peer set UCT_CUDA_IPC_DEVICE_ADDR_FLAG_FABRIC? It looks like the FABRIC flag came with the pid_ns iface address, i.e. after v1.23.2, while the new header comment states nvlink_domain ships "Since v1.23.2". Such a peer sends a 17-byte device address with flags = MNNVL and no FABRIC bit, so uct_cuda_ipc_iface_remote_fabric_supported() returns 0 and every cross-host MNNVL peer from v1.23.2 (or older) becomes unreachable. The rest of this function carefully preserves legacy behavior by length-gating new fields, but this check is not gated at all. Can we apply it only when the peer also sent the imex_channel, under UCT_CUDA_IPC_MNNVL_ADDR_HAS_FIELD(dev_addr_len, imex_channel)?
There was a problem hiding this comment.
v1.23.2 sets FLAG_FABRIC when fabric is supported (since v1.23.0-rc1), so a 17-byte peer with fabric passes. Requiring fabric on both sides for cross-host peers is intended: memory is exported to other hosts only as fabric handles, so a pair without fabric on either side fails at import anyway. v1.22 and older send 9 bytes and skip the check.
| * without the IMEX channel */ | ||
| static void set_v1_23_2_peer(std::string &dev_addr) | ||
| { | ||
| dev_addr.resize(ucs_offsetof(uct_cuda_ipc_mnnvl_device_addr_t, |
There was a problem hiding this comment.
The new v1_23_2_peer test hides the wire-compatibility issue above: set_v1_23_2_peer() only truncates the address, and the emulated flags byte still has UCT_CUDA_IPC_DEVICE_ADDR_FLAG_FABRIC set because the local MD had fabric_supported emulated to 1 when the address was packed. A real v1.23.2 peer cannot set that bit, so the test asserts reachability for an address no v1.23.2 peer can produce and the regression is not covered. Please also clear UCT_CUDA_IPC_DEVICE_ADDR_FLAG_FABRIC here.
| if (access(path, R_OK | W_OK) == 0) { | ||
| *found = 1; | ||
| if ((access(path, R_OK | W_OK) == 0) && | ||
| (!imex_channel->found || (channel < imex_channel->channel))) { |
There was a problem hiding this comment.
"Lowest accessible channel" may not match between peers that do share a channel: the comparison assumes both sides derive the same number. If a process has access to more than one channel (e.g. a world-accessible channel0 plus a job channel), the two peers can pick different lowest values while still sharing a channel, and reachability is wrongly refused. It also assumes the driver exports through the lowest accessible channel, which is the premise the new imex_channel field documents in cuda_ipc_md.h — does the driver always export through the lowest accessible channel?
|
🤖 Starting review — findings will be posted here when done. |
| return 0; | ||
| } | ||
| (ipc_addr.pid_ns != ucs_sys_get_ns(UCS_SYS_NS_TYPE_PID)) && | ||
| !uct_cuda_ipc_iface_fabric_reachable(md, params, dev_addr, |
There was a problem hiding this comment.
Why not compare the IMEX channel here too? Cross-PID-namespace peers import fabric handles as well, so a channel mismatch fails the same way when MNNVL is on and the channel is part of the address.
| typedef struct { | ||
| uct_cuda_ipc_device_addr_t super; | ||
| uint64_t nvlink_domain; | ||
| uint64_t nvlink_domain; /* Since v1.23 */ |
There was a problem hiding this comment.
Was nvlink_domain really released in v1.23? master is 1.24.0, so if it is new in this cycle too, the imex_channel prefix handling and the v1_23_peer test are not needed.
There was a problem hiding this comment.
Yes, nvlink_domain is sent by v1.23.2 (#12142), so the prefix handling is needed.
| /* Find the lowest IMEX channel accessible by the process. The GPU driver uses | ||
| * the lowest accessible channel for all fabric handle operations. */ | ||
| static ucs_status_t | ||
| uct_cuda_ipc_md_check_imex_channel_cb(const struct dirent *entry, void *arg) |
There was a problem hiding this comment.
Minor: pls rename to ..._find_imex_channel_cb, it no longer checks but selects the lowest channel for uct_cuda_ipc_md_get_imex_channel().
|
Residual coverage gap (already reported in the earlier review, not repeated as a new thread): the IMEX channel discovery/parsing path in |
|
🤖 Starting review — findings will be posted here when done. |
|
Wire compatibility — new Impact: cross-host MNNVL stops working between 1.23 and 1.24 in the common case (both sides in the root PID namespace, where the pre-existing cross-namespace fabric check never ran). The new At the
IMEX channel is not compared for same-host peers in different PID namespaces. The PR's premise is that fabric handles can only be imported by a process with access to the same IMEX channel. That constraint also applies to the same-host cross-PID-namespace path, which is exactly the path that already requires fabric handles, but there only Impact: two containers on one host with access to different IMEX channels are still reported reachable, and the import fails later. At the new
minor — IMEX check depends on an implicit ordering. The
minor: at the Residual coverage gap (already reported earlier, not re-posted): the IMEX discovery/parsing in |
|
🤖 CI Triage Agent — TL;DR: The ASAN "roce on worker 3" job failed on a single, PR-unrelated test — Full analysisSummary: Root cause: Evidence in the log: continuous test activity up to the end (no hangs, no ASAN/LSAN report, no SIGSEGV/abort trace), only the final gtest summary line Implicated commit: unknown — not the PR commit (2a16a81, Alma Mastbaum); the flaky test area was last touched by 69718f6 (Michal Shalev, retries + random sleep for MEMIC allocation) File: test/gtest/uct/test_atomic_key_reg_rdma_mem_type.cc:33 (allocation) and test/gtest/uct/uct_test.cc:1050 ( Suggested fix:
Related: PR #12339 (the PR under test, unrelated area); prior fixes for this same test: #10475 ("Increase retries and add random sleep when MEMIC allocation fails")
|
We need to open it at least for memory allocated by |
|
@ofirfarjun7 related to this, #11979 already queries the NVML P2P status in #12344 also changes this function and uses the open result to tell a NO_IPC buffer from missing P2P, so IMO if we remove the open, it should be a follow-up after #12344, not part of this PR. |
|
🤖 CI Triage Agent — TL;DR: The ASan gtest job failed on a single unrelated test, Full analysisSummary: Root cause: The build log shows Note: the per-assertion failure text is in the part of the Azure task log that is older than the retrievable tail, so the exact failing Implicated commit: 15e2185 — "UCT/IB/MLX5/RC: Complete SGL op with ep error status on peer failure (#12205)", dmitrygx (not the PR commit aa0ecc9) File: test/gtest/uct/test_peer_failure.cc:1632 (assertions in Suggested fix:
Related: #12205 (introduced the test and the SGL error-status behaviour); PR under test: #12339 |
We don't need to open mem handle in this case. We did not open it always, only for the first access to the GPU. Thus, we cannot say that is done for later put/get. It seems we need to review #11979 once again, as it's adds extra condition for the reachability check, but does not use the new information to its full potential. |
Yes, sure. |
|
🤖 Starting review — findings will be posted here when done. |
|
minor: pls skip the entry early when it cannot lower the result, to avoid a
minor: maybe pass the iface address into Already-open item (existing thread): requiring Already-open item (existing thread): Already-open item (existing thread): in Already-open item (existing thread): Residual coverage gap (unchanged): the IMEX discovery/parsing path ( |
|
🤖 Starting review — findings will be posted here when done. |
|
In v1.23 interop: requiring
Residual coverage gap: IMEX discovery/parsing (prefix match, |
|
🤖 Starting review — findings will be posted here when done. |
| @@ -30,13 +30,24 @@ typedef struct { | |||
| } UCS_S_PACKED uct_cuda_ipc_device_addr_t; | |||
There was a problem hiding this comment.
maybe add a short convention line to src/uct/cuda/AGENTS.md? This is the third generation of the cuda_ipc device address (uuid → mnnvl → imex), and the rule it relies on ("only append fields, never reorder, and length-check before reading an appended field"; same for the folded nvlink_domain value) is easy to break and is not documented anywhere in the guides.
|
Reply in the existing thread about Reply in the existing coverage-gap thread: for the discovery path, maybe add a test next to Still open (add Still open (add Still open (add Still open (add Still open (add |
| int local_fabric_supported = uct_cuda_ipc_md_fabric_supported(md); | ||
| int remote_fabric_supported = |
|
🤖 CI Triage Agent — Summary: Unable to fetch logs — cannot diagnose without them.
|
|
🤖 Starting review — findings will be posted here when done. |
|
minor: at +1 on the already-open thread about v1.23 interop: requiring +1 on the already-open thread: +1 on the already-open thread: the channel is not compared for peers in the same PID namespace, although VMM/mempool memory is exported as fabric handles there too.
+1 on the already-open thread: Residual coverage gap (already reported): the IMEX discovery path ( |
|
🤖 CI Triage Agent — TL;DR: Two gtest failures in the token-failover fault-tolerance suite ( Full analysisSummary: Root cause: The job log shows a clean run with no hang (continuous per-test output up to tear-down, largest gap ≈0.6 s) — the only failure signal is the two failed FT tests. Both failures are confined to the token-failover fixture
The PR under test (#12339, "UCT/CUDA_IPC: Require the same IMEX channel for MNNVL reachability") only touches cuda_ipc reachability and cannot influence rc_x token-mode failover lanes, so this is a master-side regression/flake in the FT token path, whose most recent change is Implicated commit: File: test/gtest/ucp/test_ucp_fault_tolerance.cc:1273 (worker_flush_during_recovery) and test/gtest/ucp/test_ucp_fault_tolerance.cc:422 / :603 (target_failure, PUT|AM|FLUSH); implementation side: src/ucp/core/ucp_ep.c (token-mode failover/recovery introduced by 427320e) Suggested fix:
|
+1, like |
What?
Require fabric support on both peers for cross-node
cuda_ipcreachability, and add the IMEX channel to the MNNVL device address so peers on different channels are not reachable.Why?
Cross-node memory is shared only as fabric handles, which are imported over IMEX. Being in the same NVLink domain is not enough: a process without an IMEX channel, or with a different one (e.g. another Slurm job on the same rack), fails only at rkey unpack/import, after lanes were already selected.
How?
fabric_supportedwithimex_channel, the lowest accessiblechannelN(the one the driver uses), orUCT_CUDA_IPC_IMEX_CHANNEL_INVALIDif fabric is not supported.imex_channelafternvlink_domain, which is already sent since v1.23 (UCT/CUDA_IPC: Restrict MNNVL reachability to the same NVLink domain - v1.23.x #12142). Each field is checked by the address length, so all released formats stay compatible:FLAG_FABRICare checked, IMEX channel is not.FLAG_FABRICand the IMEX channel are checked.is_reachable: share the fabric check between the cross-node and cross-PID-namespace paths.Tested on GB300 (2 nodes, same NVLink domain): with the IMEX channel hidden on one node, cuda_ipc is now unreachable and rc_gda is selected at wireup, instead of failing at mem list creation.