@@ -44,18 +44,27 @@ struct ncclIbMrCache {
44
44
int capacity , population ;
45
45
};
46
46
47
+ #define NCCL_IB_MAX_DEVS_PER_NIC 2
48
+ #define MAX_MERGED_DEV_NAME (MAXNAMESIZE*NCCL_IB_MAX_DEVS_PER_NIC)+NCCL_IB_MAX_DEVS_PER_NIC
49
+ struct ncclIbMergedDev {
50
+ int ndevs ;
51
+ int devs [NCCL_IB_MAX_DEVS_PER_NIC ]; // Points to an index in ncclIbDevs
52
+ int speed ;
53
+ char devName [MAX_MERGED_DEV_NAME ]; // Up to NCCL_IB_MAX_DEVS_PER_NIC * name size, and a character for each '+'
54
+ } __attribute__((aligned (64 )));
55
+
47
56
struct ncclIbRequest {
48
- struct ncclIbVerbs * verbs ;
57
+ struct ncclIbNetCommBase * base ;
49
58
int type ;
50
- int events ;
51
59
struct ncclSocket * sock ;
52
- struct ncclIbGidInfo * gidInfo ;
60
+ int events [NCCL_IB_MAX_DEVS_PER_NIC ];
61
+ struct ncclIbNetCommDevBase * devBases [NCCL_IB_MAX_DEVS_PER_NIC ];
53
62
int nreqs ;
54
63
union {
55
64
struct {
56
65
int size ;
57
66
void * data ;
58
- uint32_t lkey ;
67
+ uint32_t lkeys [ NCCL_IB_MAX_DEVS_PER_NIC ] ;
59
68
int offset ;
60
69
} send ;
61
70
struct {
@@ -64,56 +73,57 @@ struct ncclIbRequest {
64
73
};
65
74
};
66
75
67
- struct ncclIbVerbs {
68
- int dev ;
69
- struct ibv_pd * pd ; // duplicate of ncclIbDevs[dev].pd
76
+ // Retain local RoCE address for error logging
77
+ struct ncclIbGidInfo {
78
+ uint8_t link_layer ;
79
+ union ibv_gid localGid ;
80
+ };
81
+
82
+ typedef struct ncclIbNetCommDevBase {
83
+ int ibDevN ;
84
+ struct ibv_pd * pd ;
70
85
struct ibv_cq * cq ;
71
86
uint64_t pad [1 ];
72
- struct ncclIbRequest reqs [ MAX_REQUESTS ] ;
73
- };
87
+ struct ncclIbGidInfo gidInfo ;
88
+ } ncclIbNetCommDevBase ;
74
89
75
90
typedef struct ncclIbDev {
76
91
pthread_mutex_t lock ;
77
92
int device ;
78
93
uint64_t guid ;
79
- uint8_t port ;
94
+ uint8_t portNum ;
80
95
uint8_t link ;
81
96
uint8_t isSharpDev ;
82
97
int speed ;
83
98
struct ibv_context * context ;
84
99
int pdRefs ;
85
100
struct ibv_pd * pd ;
86
- struct ncclIbVerbs verbs ;
87
101
char devName [MAXNAMESIZE ];
88
102
char * pciPath ;
89
103
int realPort ;
90
104
int maxQp ;
91
105
struct ncclIbMrCache mrCache ;
92
106
int ar ; // ADAPTIVE_ROUTING
93
- } __attribute__((aligned (64 ))) nccl_ib_dev_t ;
107
+ struct ibv_port_attr portAttr ;
108
+ } __attribute__((aligned (64 ))) ncclIbDev ;
94
109
95
- #define MAX_IB_PORT 15
96
- struct userIbDev {
97
- char devName [MAXNAMESIZE ];
98
- uint16_t port_en ;
99
- };
100
110
101
111
#define MAX_IB_DEVS 32
112
+ struct ncclIbMergedDev ncclIbMergedDevs [MAX_IB_DEVS ];
102
113
extern struct ncclIbDev ncclIbDevs [MAX_IB_DEVS ];
103
- extern struct ncclIbDev userIbDevs [MAX_IB_DEVS ];
104
114
/* Detect whether GDR can work on a given NIC with the current CUDA device
105
115
* Returns :
106
116
* ncclSuccess : GDR works
107
117
* ncclSystemError : no module or module loaded but not supported by GPU */
108
- ncclResult_t nccl_p2p_gdr_support (int dev );
118
+ ncclResult_t nccl_p2p_gdr_support ();
109
119
110
120
ncclResult_t nccl_p2p_dmabuf_support (int dev );
111
121
112
- ncclResult_t nccl_p2p_ib_pci_path (nccl_ib_dev_t * devs , int num_devs , char * dev_name , char * * path , int * real_port );
122
+ ncclResult_t nccl_p2p_ib_pci_path (ncclIbDev * devs , int num_devs , char * dev_name , char * * path , int * real_port );
113
123
114
- ncclResult_t nccl_p2p_ib_get_properties (nccl_ib_dev_t * devs , int dev , ncclNetProperties_t * props );
124
+ ncclResult_t nccl_p2p_ib_get_properties (ncclIbDev * devs , int dev , ncclNetProperties_t * props );
115
125
116
- ncclResult_t nccl_p2p_ib_init (int * num_devs , nccl_ib_dev_t * ncclIbDevs , char * ncclIbIfName , union ncclSocketAddress * ncclIbIfAddr , pthread_t * ncclIbAsyncThread , ncclDebugLogger_t logFunction );
126
+ ncclResult_t nccl_p2p_ib_init (int * num_devs , ncclIbDev * ncclIbDevs , char * ncclIbIfName , union ncclSocketAddress * ncclIbIfAddr , pthread_t * ncclIbAsyncThread , ncclDebugLogger_t logFunction );
117
127
118
128
/* Convert value returtned by ibv_query_port to actual link width */
119
129
int nccl_p2p_ib_width (int width );
@@ -125,6 +135,8 @@ int64_t ncclParamSharpMaxComms();
125
135
126
136
int64_t ncclParamIbMergeVfs ();
127
137
138
+ int64_t ncclParamIbMergeNics ();
139
+
128
140
int ncclIbRelaxedOrderingCapable (void );
129
141
130
142
nccl_p2p_plugin_t nccl_p2p_get_plugin_type ();
0 commit comments