2024-02-05 05:06:02 -08:00
|
|
|
#ifndef NCCL_REGISTER_H_
|
|
|
|
|
#define NCCL_REGISTER_H_
|
|
|
|
|
|
2024-06-11 01:28:01 -07:00
|
|
|
#include "device.h"
|
|
|
|
|
|
|
|
|
|
#include <cuda.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
2024-12-18 08:26:06 -08:00
|
|
|
int64_t ncclParamLocalRegister();
|
|
|
|
|
int64_t ncclParamGraphRegister();
|
|
|
|
|
|
2024-02-05 05:06:02 -08:00
|
|
|
enum {
|
|
|
|
|
NET_REG_COMPLETE = 0x01,
|
|
|
|
|
NVLS_REG_COMPLETE = 0x02,
|
|
|
|
|
NVLS_REG_POSSIBLE = 0x04,
|
2024-03-26 06:08:55 -07:00
|
|
|
NVLS_REG_NO_SUPPORT = 0x08,
|
2024-09-10 05:57:10 -07:00
|
|
|
COLLNET_REG_COMPLETE = 0x10,
|
|
|
|
|
IPC_REG_COMPLETE = 0x20
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ncclPeerRegIpcAddr {
|
|
|
|
|
uintptr_t* devPeerRmtAddrs;
|
|
|
|
|
uintptr_t* hostPeerRmtAddrs;
|
2024-02-05 05:06:02 -08:00
|
|
|
};
|
|
|
|
|
|
2024-12-18 08:26:06 -08:00
|
|
|
struct ncclRegNetHandles {
|
|
|
|
|
void* handle;
|
|
|
|
|
struct ncclProxyConnector* proxyConn;
|
|
|
|
|
struct ncclRegNetHandles* next;
|
|
|
|
|
};
|
|
|
|
|
|
2024-02-05 05:06:02 -08:00
|
|
|
struct ncclReg {
|
|
|
|
|
// common attributes
|
|
|
|
|
size_t pages;
|
2024-12-18 08:26:06 -08:00
|
|
|
int localRefs;
|
|
|
|
|
int graphRefs;
|
2024-02-05 05:06:02 -08:00
|
|
|
uintptr_t addr;
|
|
|
|
|
uint32_t state;
|
|
|
|
|
// net reg
|
2024-12-18 08:26:06 -08:00
|
|
|
struct ncclRegNetHandles* netHandleHead;
|
2024-02-05 05:06:02 -08:00
|
|
|
// nvls reg
|
|
|
|
|
uintptr_t baseAddr;
|
|
|
|
|
size_t baseSize;
|
|
|
|
|
CUdeviceptr regAddr;
|
|
|
|
|
size_t regSize;
|
|
|
|
|
int dev;
|
|
|
|
|
CUmemGenericAllocationHandle mcHandle;
|
|
|
|
|
uintptr_t caddrs[NCCL_MAX_LOCAL_RANKS]; /* use to check if NVLS buffers match among intra-node ranks */
|
2024-03-26 06:08:55 -07:00
|
|
|
// collnet reg
|
|
|
|
|
void* collnetHandle;
|
2024-09-10 05:57:10 -07:00
|
|
|
struct ncclProxyConnector* collnetProxyconn;
|
|
|
|
|
// general ipc reg
|
|
|
|
|
struct ncclPeerRegIpcAddr regIpcAddrs;
|
|
|
|
|
struct ncclIpcRegInfo* ipcInfos[NCCL_MAX_LOCAL_RANKS];
|
2024-02-05 05:06:02 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ncclRegCache {
|
|
|
|
|
struct ncclReg **slots;
|
|
|
|
|
int capacity, population;
|
|
|
|
|
uintptr_t pageSize;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ncclResult_t ncclRegCleanup(struct ncclComm* comm);
|
|
|
|
|
ncclResult_t ncclRegFind(struct ncclComm* comm, const void* data, size_t size, struct ncclReg** reg);
|
2024-12-18 08:26:06 -08:00
|
|
|
ncclResult_t ncclCommGraphRegister(const ncclComm_t comm, void* buff, size_t size, void** handle);
|
|
|
|
|
ncclResult_t ncclCommGraphDeregister(const ncclComm_t comm, struct ncclReg *handle);
|
|
|
|
|
ncclResult_t ncclRegLocalIsValid(struct ncclReg *reg, bool *isValid);
|
2024-02-05 05:06:02 -08:00
|
|
|
|
|
|
|
|
#endif
|