Repository navigation
[rocshmem] GDA Multi-NIC support - #4652
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds host-side infrastructure to enable selecting and initializing multiple RDMA NICs per GPU (as a prerequisite for NIC fusion), including topology-based NIC ranking/filtering, env-var driven selection, and per-NIC RDMA resource allocation.
Changes:
- Introduces NIC path/merge concepts (PIX/PXB/PHB/SYS), parsing helpers, and multi-NIC selection via
GetClosestNicsToGpu(). - Refactors the GDA backend to manage per-NIC contexts/PDs/MRs and map QPs to the correct NIC (
nic_devices_,nic_for_qp()). - Adds/expands unit tests for topology helpers, NIC filtering, and multi-NIC selection behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| projects/rocshmem/tests/unit_tests/topology_gtest.cpp | Adds unit tests for merge-level parsing, NIC list parsing, filtered NIC address building, and multi-NIC selection. |
| projects/rocshmem/src/gda/topology.hpp | Adds NicPathType and new public APIs/helpers for merge parsing, NIC filtering, path classification, and multi-NIC selection. |
| projects/rocshmem/src/gda/topology.cpp | Implements new parsing/filtering/path classification helpers and GetClosestNicsToGpu(). |
| projects/rocshmem/src/gda/backend_gda.hpp | Introduces NicDevice, tracks multiple NICs, and adds QP→NIC mapping helpers. |
| projects/rocshmem/src/gda/backend_gda.cpp | Implements multi-NIC selection, per-NIC device open/PD/MR setup, QP init using per-NIC keys, and per-NIC teardown. |
| projects/rocshmem/src/gda/mlx5/backend_gda_mlx5.cpp | Routes MLX5 QP creation and key usage through the correct per-NIC context/PD/MR. |
| projects/rocshmem/src/gda/ionic/backend_gda_ionic.cpp | Routes IONIC CQ/QP creation and key usage through the correct per-NIC context/PD/MR; moves parent-domain setup per NIC. |
| projects/rocshmem/src/gda/bnxt/backend_gda_bnxt.cpp | Routes BNXT CQ/QP creation and key usage through the correct per-NIC context/PD/MR and port attributes. |
| projects/rocshmem/src/envvar.hpp | Declares new GDA env vars for multi-NIC behavior. |
| projects/rocshmem/src/envvar.cpp | Defines new GDA env vars (MERGE_NICS, NET_MERGE_LEVEL, NET_FORCE_MERGE). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
df87748 to
496bccb
Compare
9ee8b5e to
039d5a6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
039d5a6 to
7c12f1a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
7c12f1a to
ddaa80b
Compare
|
PR is ready for review |
1d08518 to
e216070
Compare
Yiltan
left a comment
There was a problem hiding this comment.
LGTM
Note: you may want to rebase on develop -Werror was introduce (just want to make sure things compile after merge)
e216070 to
5574d00
Compare
|
@Yiltan, @abouteiller, @edgargabriel, can I merge this PR, or are we waiting more reviews? |
|
@Yiltan, I rebased this PR and the build with -Werror passed |
Add topology-based multi-NIC selection and per-NIC IB resource allocation. Default behavior unchanged - single closest NIC is selected unless ROCSHMEM_GDA_MERGE_NICS=1 is set. Key changes: - NicDevice struct and nic_devices_ vector for per-NIC resources - PCIe topology functions (ComputeGpuNicPathType, GetClosestNicsToGpu) - NIC filtering (include/exclude lists, merge level, force-merge) - Enforce num_qps_per_pe >= num_nics_ so each NIC gets a QP row - Provider backends (BNXT, IONIC, MLX5) use nic_for_qp() for per-NIC access - Unit tests for topology and NIC selection helpers
Add ROCSHMEM_GDA_NIC_POLICY env var with two modes: - ROUND_ROBIN (default): QPs within a context spread across NICs - PER_CONTEXT: all QPs in a context use one NIC, multi-NIC via multiple contexts (ctx_id % num_nics) Extract ComputeNicIdxForQp() into nic_policy.hpp for testability. Remove auto-increase of num_qps_per_pe to max(env, num_nics). Add multi-context put functional test (MultiCtxPutTestType=94) that creates 4 contexts and performs put_nbi through each. Add unit tests for ComputeNicIdxForQp covering both modes. Made-with: Cursor
3defa04 to
5d6a521
Compare
5d6a521 to
bff376e
Compare
Motivation
rocSHMEM currently uses a single NIC per GPU. To enable NIC fusion (aggregating bandwidth across multiple NICs), the host-side infrastructure needs to support selecting, opening, and creating RDMA resources (PD, MR, CQ, QP) for more than one NIC. Additionally, users need control over how QPs are distributed across NICs.
Default behavior is unchanged: without new env vars, each PE selects exactly one NIC as before.
Technical Details
ROCSHMEM_GDA_MERGE_NICS- enables/disables multi-NIC selectionROCSHMEM_GDA_NET_MERGE_LEVEL- controls the merge level:PIX- same PCIe switchPXB- same PCIe root complexPHB- same NUMA nodeSYS- all available NICsROCSHMEM_GDA_NET_FORCE_MERGE- comma-separated list of NIC device names; semicolon-separated rank groups.Example:
"mlx5_0,mlx5_1;mlx5_2,mlx5_3"Local PE 0 will select
mlx5_0andmlx5_1Local PE 1 will select
mlx5_2andmlx5_3ROCSHMEM_GDA_NIC_POLICY- NIC-to-QP binding mode:ROUND_ROBIN(default): QP rows within a context are interleaved across NICsRequires
NUM_QPS_PER_PE_DEFAULT_CTXorNUM_QPS_PER_PE_USR_CTXto be set to at least the number of selected NICs. If fewer QP rows are available than NICs,num_nicsis automatically reduced to the max QP-per-PE count so that each active NIC has at least one QP row.Example with 4 NICs and 4 QPs per PE:
PER_CONTEXT: all QPs in a context use one NIC; multi-NIC usage is achieved via multiple contexts. Does not require multiple QPs per PE.Example with 4 NICs and 4 contexts:
GetClosestNicsToGpu(), which returns multiple NICs sorted by PCIe proximity and filtered by merge levelnic_devices_vector (NicDevicestruct with per-NIC context, PD, MR, port info, GID)nic_for_qp()/nic_idx_for_qp(), which map flat QP index to the correctNicDevicebased on active NIC policyopen_ib_device(),setup_heap_memory_rkey(), QP create/modify/destroy, and provider backends (BNXT, IONIC, MLX5)ComputeNicIdxForQp(both modes)JIRA ID
AICOMNET-69
AICOMNET-85 - functional and performance tests results
AIROCSHMEM-223
Test Plan
driver.sh all)MERGE_NICS=0(default, single NIC)MERGE_NICS=1withMERGE_LEVEL=PIX,PXB,PHB,SYSFORCE_MERGEwith explicit NIC namesNIC_POLICY=ROUND_ROBINandPER_CONTEXTtopology_gtest):Test Result
Passed
Submission Checklist