Skip to content

Commit c01fcf7

Browse files
committed
plugin update to nccl-2.20
1 parent 3ff78de commit c01fcf7

File tree

5 files changed

+871
-430
lines changed

5 files changed

+871
-430
lines changed

include/ibvwrap.h

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ static inline ncclResult_t wrap_ibv_poll_cq(struct ibv_cq *cq, int num_entries,
5959
ncclResult_t wrap_ibv_create_qp(struct ibv_qp **ret, struct ibv_pd *pd, struct ibv_qp_init_attr *qp_init_attr);
6060
ncclResult_t wrap_ibv_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, int attr_mask);
6161
ncclResult_t wrap_ibv_destroy_qp(struct ibv_qp *qp);
62+
ncclResult_t wrap_ibv_query_ece(struct ibv_qp *qp, struct ibv_ece *ece, int* supported);
63+
ncclResult_t wrap_ibv_set_ece(struct ibv_qp *qp, struct ibv_ece *ece, int* supported);
6264
ncclResult_t wrap_ibv_post_send(struct ibv_qp *qp, struct ibv_send_wr *wr, struct ibv_send_wr **bad_wr);
6365
ncclResult_t wrap_ibv_post_recv(struct ibv_qp *qp, struct ibv_recv_wr *wr, struct ibv_recv_wr **bad_wr);
6466
ncclResult_t wrap_ibv_event_type_str(char **ret, enum ibv_event_type event);

include/p2p_plugin.h

+34-22
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,27 @@ struct ncclIbMrCache {
4444
int capacity, population;
4545
};
4646

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+
4756
struct ncclIbRequest {
48-
struct ncclIbVerbs* verbs;
57+
struct ncclIbNetCommBase* base;
4958
int type;
50-
int events;
5159
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];
5362
int nreqs;
5463
union {
5564
struct {
5665
int size;
5766
void* data;
58-
uint32_t lkey;
67+
uint32_t lkeys[NCCL_IB_MAX_DEVS_PER_NIC];
5968
int offset;
6069
} send;
6170
struct {
@@ -64,56 +73,57 @@ struct ncclIbRequest {
6473
};
6574
};
6675

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;
7085
struct ibv_cq* cq;
7186
uint64_t pad[1];
72-
struct ncclIbRequest reqs[MAX_REQUESTS];
73-
};
87+
struct ncclIbGidInfo gidInfo;
88+
} ncclIbNetCommDevBase;
7489

7590
typedef struct ncclIbDev {
7691
pthread_mutex_t lock;
7792
int device;
7893
uint64_t guid;
79-
uint8_t port;
94+
uint8_t portNum;
8095
uint8_t link;
8196
uint8_t isSharpDev;
8297
int speed;
8398
struct ibv_context* context;
8499
int pdRefs;
85100
struct ibv_pd* pd;
86-
struct ncclIbVerbs verbs;
87101
char devName[MAXNAMESIZE];
88102
char *pciPath;
89103
int realPort;
90104
int maxQp;
91105
struct ncclIbMrCache mrCache;
92106
int ar; // ADAPTIVE_ROUTING
93-
} __attribute__((aligned(64))) nccl_ib_dev_t;
107+
struct ibv_port_attr portAttr;
108+
} __attribute__((aligned(64))) ncclIbDev;
94109

95-
#define MAX_IB_PORT 15
96-
struct userIbDev {
97-
char devName[MAXNAMESIZE];
98-
uint16_t port_en;
99-
};
100110

101111
#define MAX_IB_DEVS 32
112+
struct ncclIbMergedDev ncclIbMergedDevs[MAX_IB_DEVS];
102113
extern struct ncclIbDev ncclIbDevs[MAX_IB_DEVS];
103-
extern struct ncclIbDev userIbDevs[MAX_IB_DEVS];
104114
/* Detect whether GDR can work on a given NIC with the current CUDA device
105115
* Returns :
106116
* ncclSuccess : GDR works
107117
* 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();
109119

110120
ncclResult_t nccl_p2p_dmabuf_support(int dev);
111121

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);
113123

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);
115125

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);
117127

118128
/* Convert value returtned by ibv_query_port to actual link width */
119129
int nccl_p2p_ib_width(int width);
@@ -125,6 +135,8 @@ int64_t ncclParamSharpMaxComms();
125135

126136
int64_t ncclParamIbMergeVfs();
127137

138+
int64_t ncclParamIbMergeNics();
139+
128140
int ncclIbRelaxedOrderingCapable(void);
129141

130142
nccl_p2p_plugin_t nccl_p2p_get_plugin_type();

0 commit comments

Comments
 (0)