Skip to content

Commit 2ec53c3

Browse files
committed
remove useless #ifdef, add an accl check to flagcxP2pRpcBatchWriteSync and unified environment variables
1 parent 8e15c58 commit 2ec53c3

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

flagcx/core/flagcx_p2p.cc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,9 @@ class FlagcxWorkerPool {
524524
FlagcxWorkerPool(const FlagcxWorkerPool &) = delete;
525525
FlagcxWorkerPool &operator=(const FlagcxWorkerPool &) = delete;
526526

527-
struct ibv_cq *getSharedCq() const { return shared_cq_; }
527+
struct ibv_cq *getSharedCq() const {
528+
return shared_cq_;
529+
}
528530
int workerCount() const { return numWorkers_; }
529531
void registerQp(void *sendComm, struct ibv_qp *qp);
530532
void unregisterQp(struct ibv_qp *qp);
@@ -3574,6 +3576,12 @@ int flagcxP2pRpcBatchWriteSync(void *connPtr, int count, const uint64_t *srcVa,
35743576
}
35753577
}
35763578

3579+
if (flagcxP2pIsAccl(conn)) {
3580+
std::vector<FlagcxP2pMr> unusedMrIds(count, 0);
3581+
return flagcxP2pEngineWriteVectorSync(conn, unusedMrIds, srcVec, sizeVec,
3582+
descs);
3583+
}
3584+
35773585
if (conn->isLocal && conn->sameProcess) {
35783586
std::vector<FlagcxP2pMemRegEntry> batchEntries(count);
35793587
std::vector<uintptr_t> srcAddrs(count);

flagcx/core/flagcx_p2p_accl.cc

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,11 @@
2828
#include "param.h"
2929
#include "socket.h"
3030

31-
/* FlagCX's topo.h defines node-type macros (CPU=3, NIC=4, NET=5, ...)
32-
that collide with accl::barex's device_type enumerators. They are not
33-
used in this file — drop them before pulling the vendor headers. */
34-
#ifdef CPU
3531
#undef CPU
36-
#endif
37-
#ifdef GPU
3832
#undef GPU
39-
#endif
40-
#ifdef NIC
4133
#undef NIC
42-
#endif
43-
#ifdef NET
4434
#undef NET
45-
#endif
46-
#ifdef PCI
4735
#undef PCI
48-
#endif
4936

5037
#include <accl/barex/barex_types.h>
5138
#include <accl/barex/xchannel.h>
@@ -81,9 +68,6 @@ using namespace accl::barex;
8168

8269
namespace {
8370

84-
FLAGCX_PARAM(P2pAcclQpsPerCtx, "P2P_ACCL_QPS_PER_CTX", 2);
85-
FLAGCX_PARAM(P2pAcclConnectTimeoutSec, "P2P_ACCL_CONNECT_TIMEOUT", 20);
86-
8771
constexpr uint64_t kAcclHelloMagic = 0xACC1F1A6C0DE0001ull;
8872
constexpr uint32_t kAcclNotifMagic = 0xDEADDEADu; /* same wire as ibrc */
8973
constexpr int kMaxNics = kFlagcxP2pMaxQpsPerEngine; /* 8, matches desc */
@@ -922,7 +906,8 @@ FlagcxP2pConn *flagcxAcclEngineConnect(FlagcxP2pEngine *e, const char *ipAddr,
922906
/* data-plane channels: qpsPerCtx per client ctx. Control block shared
923907
with callbacks; on timeout a late callback sees `abandoned` and
924908
destroys its own channel instead of touching freed state. */
925-
const int qps = (int)flagcxParamP2pAcclQpsPerCtx();
909+
const auto &config = flagcxP2pGlobalConfig();
910+
const int qps = config.qpsPerConn;
926911
const int total = qps * (int)engine->clientCtxs.size();
927912
auto ctl = std::make_shared<AcclConnectCtl>(total);
928913
for (int i = 0; i < total; i++) {
@@ -950,9 +935,8 @@ FlagcxP2pConn *flagcxAcclEngineConnect(FlagcxP2pEngine *e, const char *ipAddr,
950935
bool allUp = false;
951936
{
952937
std::unique_lock<std::mutex> lk(ctl->mu);
953-
ctl->cv.wait_for(
954-
lk, std::chrono::seconds((int)flagcxParamP2pAcclConnectTimeoutSec()),
955-
[&] { return ctl->remaining <= 0; });
938+
ctl->cv.wait_for(lk, std::chrono::seconds(480),
939+
[&] { return ctl->remaining <= 0; });
956940
ctl->abandoned = true; /* late callbacks self-clean from here on */
957941
allUp = ctl->remaining <= 0 && !ctl->anyFailed;
958942
conn->channels = std::move(ctl->channels);

0 commit comments

Comments
 (0)