Repository navigation
feat: Add strict_local_numa to hard-exclude cross-NUMA RDMA rails - #3468
Conversation
4052d99 to
6cb5e34
Compare
alogfans
left a comment
There was a problem hiding this comment.
strict_local_numa still does not provide hard exclusion semantics in the current implementation.
There are three remaining paths where a cross-NUMA NIC can still be selected:
-
Baseline mode bypasses the flag entirely
Inquota.cpp, the!smart_selection_enabled_path iterates ranks until it finds the first non-empty one, but it does not apply anystrict_local_numafiltering. If all local ranks are empty, it will still pick the cross-NUMA tier. -
Smart-mode fallback re-adds cross-NUMA devices
InbuildCandidates(), the first pass skips the last rank whenstrict_local_numais enabled, but if the filtered candidate set becomes empty, the fallback path rebuilds candidates from all ranks. That means remote NUMA NICs are still reintroduced under strict mode. -
CUDA topology can hide cross-NUMA NICs inside rank 0
Incuda_probe.cpp, when no same-NUMA NIC exists, the fallback path places the closest remote NICs intodevice_list[0]. After that, the selector can no longer distinguish them from true local-NUMA devices, so rank-based filtering is no longer sufficient.
I think the intended strict-mode semantics should be:
- when
strict_local_numa == true, cross-NUMA NICs must never enter the eligible set; - if no same-NUMA NIC exists for the location, return
DeviceNotFoundinstead of falling back to a remote NIC; - baseline mode, smart selection, and fallback should all share the same rank-filtering rule.
In other words, this change currently implements a strong preference against cross-NUMA NICs, but not a true hard exclusion yet.
398bb67 to
d4ed89e
Compare
Thanks for the careful review — you're right that the original change was only a strong preference, not a hard exclusion. I've reworked it so strict_local_numa now enforces true hard-exclusion semantics across all three paths. |
Conflicts: mooncake-transfer-engine/tent/include/tent/transport/rdma/quota.h mooncake-transfer-engine/tent/src/transport/rdma/quota.cpp
d4ed89e to
52b1dde
Compare
staryxchen
left a comment
There was a problem hiding this comment.
Hard exclusion is incomplete in a few places outside DeviceSelector. Inline comments cover unknown NUMA/wildcard, the worker retry path, the unconditional CUDA rank-0 change, and the env-var bool parsing.
One item that cannot be attached to this diff: ROCm / MemoryProber still promote the closest-PCIe NIC into rank 0 even when it is remote (rocm_probe.cpp, memory_prober.cpp). On those paths a cross-NUMA NIC never reaches rank 2, so strict_local_numa does not exclude it. Please apply the same same-NUMA-only rank-0 rule used in cuda_probe.cpp, or the flag is CUDA-only.
| int dist = | ||
| getPciDistance(device.pci_bus_id.c_str(), pci_bus_id); | ||
| distance_map[dist].push_back(nic_id); | ||
| min_distance = std::min(min_distance, dist); | ||
| } |
There was a problem hiding this comment.
Hard exclusion currently treats “NUMA/location unknown” the same as “cross-NUMA”, so allocations that should still pick a NIC fail with DeviceNotFound.
isNumaRankEligible() drops the last rank whenever the flag is on. That is only correct when rank 2 means “known remote”. Two discovery paths put every NIC in that rank when information is missing:
numa_node == -1here: rank 0/1 are filled only when GPU and NIC NUMA are known and equal. If sysfs returns-1(VMs, some GPUs, oftenmlx5_bond_*), all NICs land in rank 2.- Wildcard
*frominsertFallbackMemEntry(): every NIC is placed indevice_list[2]. Workers also fall back to*when location cannot be resolved.
Please apply hard exclusion only when both the memory location and the NIC have a known NUMA id and they differ. If either side is unknown, keep the old soft-penalty path. A test for numa_node == -1 and one for allocate against * would cover this.
| params.strict_local_numa = | ||
| conf->get("transports/rdma/strict_local_numa", false); |
There was a problem hiding this comment.
strict_local_numa is not applied on the worker retry path, so a cross-NUMA NIC can still be posted after the first attempt fails.
| // collapse (ties / realpath failure) and would otherwise pick a remote | ||
| // NIC. Cross-NUMA NICs are never promoted here: when no same-NUMA NIC | ||
| // exists rank 0 stays empty and all NICs fall into the cross-NUMA rank, | ||
| // so strict_local_numa selection can hard-exclude them. | ||
| int min_distance = INT_MAX; |
There was a problem hiding this comment.
The CUDA rank-0 rewrite is not gated on strict_local_numa. A remote NIC that previously sat in rank 0 (closest PCIe / collapsed distance) now always sits in rank 2 and takes the default 10× numa_penalties hit even with the flag off. That may be desirable, but it contradicts the compatibility note that soft-penalty behavior is unchanged unless the flag is enabled. Please either gate the topology change on the flag, or document it as an intentional default ranking change.
| setConfig(config, "MC_STRICT_LOCAL_NUMA", | ||
| "transports/rdma/strict_local_numa"); |
There was a problem hiding this comment.
MC_STRICT_LOCAL_NUMA=1 will not turn the feature on. setFromString stores "1" as an integer; get(..., false) then fails the JSON bool conversion and returns the default false. Only "true"/"false" work. Please accept 1/0, or document that the env var must be true.
8f4618d to
a9b1839
Compare
|
Thanks—the source-side selector, unknown-NUMA handling, and env parsing concerns are addressed. One target-side escape remains in the production worker path.
The new tests cover |
Background
On dual-socket / multi-NUMA machines, selecting an RDMA NIC from a remote NUMA node for GPU buffer transfers can introduce unnecessary cross-socket traffic and unstable performance. In some deployments, it may also increase the chance of RDMA failures such as
LOC_PROTor QP transition errors.The existing
numa_penaltiessetting only provides a soft preference. A remote NUMA NIC can still be selected when its score is better due to EWMA bandwidth, inflight bytes, or probe / round-robin sampling. This is not strict enough for environments where GPU traffic must stay on the local NUMA node.Change
This MR adds a
strict_local_numaswitch for RDMA device selection.When enabled, the RDMA scheduler excludes the cross-NUMA tier from the normal candidate list, so weighted selection, probe mode, and round-robin selection will not actively pick a remote NUMA NIC. If no same-NUMA candidate is available, the existing fallback still retries all tiers to avoid making the node unusable.
The CUDA topology discovery path is also adjusted so GPU Tier-0 devices are limited to same-NUMA NICs. PCIe distance is now used only as a secondary ranking within the same NUMA node.
Example Configuration
{ "topology": { "rdma_whitelist": [ "mlx5_bond_1", "mlx5_bond_4", "mlx5_bond_3", "mlx5_bond_2", "mlx5_bond_7", "mlx5_bond_6", "mlx5_bond_8", "mlx5_bond_5" ] }, "transports": { "rdma": { "enable": true, "numa_penalties": [1.0, 5.0, 100000.0], "strict_local_numa": true } } }Compatibility
strict_local_numais disabled by default, so existing soft NUMA penalty behavior is preserved unless explicitly enabled.Description
Module
mooncake-transfer-engine)mooncake-store)mooncake-reshard)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Test commands:
# Example: bash scripts/run_ci_test.shTest results:
Checklist
./scripts/code_format.shAI Assistance Disclosure