@@ -232,38 +232,45 @@ struct CtranKernelAllToAllDedupArgs {
232232};
233233
234234struct CtranKernelAllToAllvDynamicArgs {
235- void ** sendbuffsPtrTmpbufCPU;
236- const size_t * sendcounts;
237- size_t * sendCountsTmpbufGPU;
238- size_t * sendCountsTmpbufCPU;
239- size_t sendcountsLength;
240- size_t * recvCountsTmpbufGPU;
241- size_t * actualRecvcounts;
242- void * recvbuffsPtrGPU[CTRAN_MAX_TOTAL_RANK];
243- commDataType_t datatype;
244- KernelElem* kElem ;
235+ void ** sendbuffsPtrTmpbufCPU{ nullptr } ;
236+ const size_t * sendcounts{ nullptr } ;
237+ size_t * sendCountsTmpbufGPU{ nullptr } ;
238+ size_t * sendCountsTmpbufCPU{ nullptr } ;
239+ size_t sendcountsLength{ 0 } ;
240+ size_t * recvCountsTmpbufGPU{ nullptr } ;
241+ size_t * actualRecvcounts{ nullptr } ;
242+ void * recvbuffsPtrGPU[CTRAN_MAX_TOTAL_RANK]{} ;
243+ commDataType_t datatype{} ;
244+ KernelElem* kElem { nullptr } ;
245245 union {
246246 struct {
247- const void * sendbuff;
248- void ** sendbuffsPtrShmDev;
247+ const void * sendbuff{ nullptr } ;
248+ void ** sendbuffsPtrShmDev{ nullptr } ;
249249 } split;
250250 struct {
251- const void * sendbuffsPtrGPU[CTRAN_MAX_TOTAL_RANK];
251+ const void * sendbuffsPtrGPU[CTRAN_MAX_TOTAL_RANK]{} ;
252252 } nonSplit;
253253 };
254254 union {
255255 struct {
256- const size_t * sendIndices;
257- size_t * sendIndicesTmpbufCPU;
258- const size_t * sendIndicesBlockLengths;
259- size_t * sendIndicesBlockLengthsTmpbufCPU;
260- size_t maxSendIndicesBlockLength;
261- size_t maxRecvcount;
262- size_t maxSendcount;
256+ const size_t * sendIndices{ nullptr } ;
257+ size_t * sendIndicesTmpbufCPU{ nullptr } ;
258+ const size_t * sendIndicesBlockLengths{ nullptr } ;
259+ size_t * sendIndicesBlockLengthsTmpbufCPU{ nullptr } ;
260+ size_t maxSendIndicesBlockLength{ 0 } ;
261+ size_t maxRecvcount{ 0 } ;
262+ size_t maxSendcount{ 0 } ;
263263 } nonContig;
264264 struct {
265265 } contig;
266266 };
267+
268+ // Default constructor needed because unions with non-trivial member
269+ // initializers have deleted default constructors
270+ CtranKernelAllToAllvDynamicArgs () {
271+ // Unions are initialized by their first member by default
272+ // split and nonContig are already initialized above
273+ }
267274};
268275
269276struct CtranKernelBroadcastArgs {
@@ -321,6 +328,10 @@ struct CtranKernelArgs {
321328 CtranKernelWaitNotifyArgs waitnotify;
322329 CtranKernelGetArgs get;
323330 } collective;
331+
332+ // Default constructor needed because union has a member with non-trivial
333+ // default constructor Initialize first member of union
334+ CtranKernelArgs () : collective{.allgather = {}} {}
324335};
325336
326337#endif
0 commit comments