Add HDP flush for gfx940 (#1434)
* Fix collective trace
* Use nontemporal for st_global
* Fix previous commit
* Add HDP flush to data receive path
* Fix previous commit
* Control flushing by NCCL_NET_FORCE_FLUSH and RCCL_NET_HDP_FLUSH
* Introduce RCCL_NET_HDP_FLUSH and RCCL_NET_GDR_FLUSH
Both are on by default. Turn both off will skip all flush will likely
result in data error.
* Enable GDR copy by default
* Remove GDR flush env var because it is disabled by GDC flush
* Output kernel collective trace at comm destroy by default
* Limit kernel timeout messages to 100
* Use system relaxed atomic for loadInt
* Refine timeout messages and use atomic for setting offset from CPU
* Add kernel trace for barrier timeout
* Add backup barrier to avoid race in atomicAdd
* Use different counters for different warps
* Rework barrier implementation
* Fix for other GFX
* Use __hip_atomic_store and __hip_atomic_load
* Fix bug in previous commit
* Don't reset barrier values in running kernel
* Update trace format
* Fix typo
* Switch back to hip_atomic_fetch_add
* Use same barrier implementation for all GFX
* Remove extra threadfence
* Turn off HDP flush by default
Please use RCCL_NET_HDP_FLUSH=1 to switch on HDP flush
* Remove unnecessary changes from alterative barrier implementation
* Added back __threadfence_block
* Revert back to threadfence for gfx other than gfx94x
[ROCm/rccl commit: caba0bc049]
Este commit está contenido en:
+23
-13
@@ -123,7 +123,7 @@ static constexpr int64_t defaultEnableMscclpp = 0;
|
||||
RCCL_PARAM(MscclppEnabled, "MSCCLPP_ENABLE", defaultEnableMscclpp);
|
||||
|
||||
// GDRCOPY support: Off by default
|
||||
NCCL_PARAM(GdrCopyEnable, "GDRCOPY_ENABLE", 0);
|
||||
NCCL_PARAM(GdrCopyEnable, "GDRCOPY_ENABLE", 1);
|
||||
|
||||
// GDRCOPY support
|
||||
gdr_t ncclGdrCopy = NULL;
|
||||
@@ -217,6 +217,7 @@ void NCCL_NO_OPTIMIZE commPoison(ncclComm_t comm) {
|
||||
}
|
||||
|
||||
RCCL_PARAM(KernelCollTraceEnable, "KERNEL_COLL_TRACE_ENABLE", 0);
|
||||
RCCL_PARAM(KernelCollTraceThreadEnable, "KERNEL_COLL_TRACE_THREAD_ENABLE", 0);
|
||||
|
||||
#ifdef ENABLE_COLLTRACE
|
||||
// Should be in sync with 'ALL_COLLS' in Generator.cmake
|
||||
@@ -230,16 +231,14 @@ void *ncclCommThreadMain(void *arg) {
|
||||
do {
|
||||
int numActiveChans = MAXCHANNELS;
|
||||
for (int channel = 0; channel < MAXCHANNELS; channel++) {
|
||||
int tail = comm->collTraceTail[channel].tail%COLLTRACE_NUM_ITEMS;
|
||||
int tail = comm->collTraceTail[channel].tail;
|
||||
int count;
|
||||
if (head[channel] <= tail)
|
||||
count = tail - head[channel];
|
||||
else
|
||||
count = COLLTRACE_NUM_ITEMS + head[channel] - tail;
|
||||
count = tail - head[channel];
|
||||
if (count == 0) {
|
||||
numActiveChans--;
|
||||
continue;
|
||||
}
|
||||
count = count%COLLTRACE_NUM_ITEMS;
|
||||
for (int i = 0; i < count; i++) {
|
||||
volatile struct ncclCollTrace *td = comm->collTrace+COLLTRACE_NUM_ITEMS*channel+head[channel];
|
||||
uint8_t type = td->type;
|
||||
@@ -292,14 +291,16 @@ void *ncclCommThreadMain(void *arg) {
|
||||
INFO(NCCL_COLL, "%s", line);
|
||||
td->type = ncclCollTraceNotReady;
|
||||
head[channel] ++;
|
||||
head[channel] %= COLLTRACE_NUM_ITEMS;
|
||||
}
|
||||
}
|
||||
if (comm->collTraceExit && numActiveChans == 0)
|
||||
break;
|
||||
usleep(1000); //sleep 1ms
|
||||
} while(true);
|
||||
pthread_exit(NULL);
|
||||
if (comm->collTraceThread)
|
||||
pthread_exit(NULL);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -395,7 +396,12 @@ static ncclResult_t commFree(ncclComm_t comm) {
|
||||
|
||||
#ifdef ENABLE_COLLTRACE
|
||||
comm->collTraceExit = 1;
|
||||
if (comm->collTraceThread) pthread_join(comm->collTraceThread, NULL);
|
||||
if (comm->collTraceEnabled) {
|
||||
if (comm->collTraceThread)
|
||||
pthread_join(comm->collTraceThread, NULL);
|
||||
else
|
||||
ncclCommThreadMain((void *)comm);
|
||||
}
|
||||
NCCLCHECK(ncclCudaHostFree((void *)comm->collTrace));
|
||||
NCCLCHECK(ncclCudaHostFree((void *)comm->collTraceTail));
|
||||
#endif
|
||||
@@ -585,10 +591,14 @@ static ncclResult_t commAlloc(struct ncclComm* comm, struct ncclComm* parent, in
|
||||
NCCLCHECK(ncclCudaHostCalloc(&comm->collTraceTail, MAXCHANNELS));
|
||||
NCCLCHECK(ncclCudaHostCalloc(&comm->collTrace, COLLTRACE_NUM_ITEMS*MAXCHANNELS));
|
||||
comm->collTraceExit = 0;
|
||||
if ((ncclDebugLevel >= NCCL_LOG_INFO) && rcclParamKernelCollTraceEnable())
|
||||
pthread_create(&comm->collTraceThread, NULL, ncclCommThreadMain, (void *)comm);
|
||||
else
|
||||
comm->collTraceThread = 0;
|
||||
comm->collTraceEnabled = false; // we can enable colltrace without starting a thread
|
||||
if ((ncclDebugLevel >= NCCL_LOG_INFO) && rcclParamKernelCollTraceEnable()) {
|
||||
comm->collTraceEnabled = true;
|
||||
if (rcclParamKernelCollTraceThreadEnable())
|
||||
pthread_create(&comm->collTraceThread, NULL, ncclCommThreadMain, (void *)comm);
|
||||
else
|
||||
comm->collTraceThread = 0;
|
||||
}
|
||||
#endif
|
||||
comm->collNetSupport = 0;
|
||||
memset(comm->collNetSupportMatrix, 0, sizeof(comm->collNetSupportMatrix));
|
||||
|
||||
Referencia en una nueva incidencia
Block a user