Files
rocm-systems/src/include/transport.h
T

77 lines
2.9 KiB
C
Raw Normal View History

2018-09-24 16:06:59 -07:00
/*************************************************************************
2022-01-07 06:39:55 -08:00
* Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
* Modifications Copyright (c) 2019-2022 Advanced Micro Devices, Inc. All rights reserved.
2018-09-24 16:06:59 -07:00
*
* See LICENSE.txt for license information
************************************************************************/
#ifndef NCCL_TRANSPORT_H_
#define NCCL_TRANSPORT_H_
2019-03-14 19:39:20 -07:00
#include "devcomm.h"
2019-11-19 14:57:39 -08:00
#include "graph.h"
2018-12-13 15:56:12 -08:00
#include "nvmlwrap.h"
2019-11-19 14:57:39 -08:00
#include "core.h"
2018-09-24 16:06:59 -07:00
2022-01-07 06:39:55 -08:00
#define NTRANSPORTS 4
2019-11-19 14:57:39 -08:00
#define TRANSPORT_P2P 0
#define TRANSPORT_SHM 1
#define TRANSPORT_NET 2
2022-01-07 06:39:55 -08:00
#define TRANSPORT_COLLNET 3
#include "proxy.h"
2018-09-24 16:06:59 -07:00
extern struct ncclTransport ncclTransports[];
// Forward declarations
struct ncclRing;
struct ncclConnector;
struct ncclComm;
2018-12-13 15:56:12 -08:00
struct ncclPeerInfo {
int rank;
int cudaDev;
2022-01-07 06:39:55 -08:00
int netDev;
2019-11-19 14:57:39 -08:00
int gdrSupport;
bool hasFineGrain;
2018-12-13 15:56:12 -08:00
uint64_t hostHash;
uint64_t pidHash;
2019-11-19 14:57:39 -08:00
dev_t shmDev;
int64_t busId;
2022-01-07 06:39:55 -08:00
struct ncclComm* comm;
int cudaCompCap;
2022-03-14 14:55:24 -04:00
int virtualId;
2018-09-24 16:06:59 -07:00
};
#define CONNECT_SIZE 128
struct ncclConnect {
char data[CONNECT_SIZE];
};
struct ncclTransportComm {
2021-04-12 16:00:11 -07:00
ncclResult_t (*setup)(struct ncclComm* comm, struct ncclTopoGraph* graph, struct ncclPeerInfo*, struct ncclPeerInfo*, struct ncclConnect*, struct ncclConnector*, int channelId, int connIndex);
2020-09-04 14:35:05 -07:00
ncclResult_t (*connect)(struct ncclComm* comm, struct ncclConnect*, int nranks, int rank, struct ncclConnector*);
2022-01-07 06:39:55 -08:00
ncclResult_t (*free)(struct ncclConnector*);
ncclResult_t (*proxySharedInit)(struct ncclProxyConnection* connection, struct ncclComm* comm, int nChannels);
ncclResult_t (*proxySetup)(struct ncclProxyConnection* connection, struct ncclComm* comm, void* reqBuff, int reqSize, void* respBuff, int respSize, int* done);
ncclResult_t (*proxyConnect)(struct ncclProxyConnection* connection, struct ncclComm* comm, void* reqBuff, int reqSize, void* respBuff, int respSize, int* done);
ncclResult_t (*proxyFree)(struct ncclProxyConnection* connection, struct ncclComm* comm);
ncclResult_t (*proxyProgress)(struct ncclComm* comm, struct ncclProxyArgs*);
2018-09-24 16:06:59 -07:00
};
struct ncclTransport {
const char name[4];
2019-11-19 14:57:39 -08:00
ncclResult_t (*canConnect)(int*, struct ncclTopoSystem* topo, struct ncclTopoGraph* graph, struct ncclPeerInfo*, struct ncclPeerInfo*);
2018-09-24 16:06:59 -07:00
struct ncclTransportComm send;
struct ncclTransportComm recv;
};
2021-04-12 16:00:11 -07:00
ncclResult_t ncclTransportP2pConnect(struct ncclComm* comm, struct ncclChannel* channel, int nrecv, int* peerRecv, int nsend, int* peerSend, int connIndex);
2021-09-08 13:56:25 -07:00
ncclResult_t ncclTransportP2pSetup(struct ncclComm* comm, struct ncclTopoGraph* graph, int connIndex, int* highestTransportType=NULL);
2018-09-24 16:06:59 -07:00
2021-04-12 16:00:11 -07:00
enum { collNetRecv=0, collNetSend=1 };
int ncclTransportCollNetSetup(struct ncclComm* comm, struct ncclTopoGraph* collNetGraph, struct ncclChannel* channel, int masterRank, int masterPeer, int collNetGraphChannelId, int type);
ncclResult_t ncclTransportCollNetCheck(struct ncclComm* comm, int collNetSetupFail);
2021-05-11 18:16:30 -07:00
ncclResult_t ncclTransportCollNetFree(struct ncclComm* comm);
2018-09-24 16:06:59 -07:00
#endif