Question
In the profiler, collApiPoolBase and p2pApiPoolBase are incremented both in updateEvent() (on finalization) and in exampleProfilerStartEvent() (when reusing a groupApi).
What is the purpose of incrementing them during reuse? Could this lead to double-incrementing the same event’s pool base?
code:nccl/ext-profiler/example/plugin.cc
exampleProfilerStartEvent:
while (!profilerQueueEmpty(&event->collApiEvents)) {
struct collApi *collApiEvent = profilerQueueDequeue(&event->collApiEvents);
resetTaskEvents(collApiEvent, ctx);
__atomic_fetch_add(&ctx->collApiPoolBase, 1, __ATOMIC_RELAXED);
}
updateEvent:
else if (type == ncclProfileCollApi) {
struct collApi* event = (struct collApi*) handle;
if (__atomic_sub_fetch(&event->refCount, 1, __ATOMIC_RELAXED) == 0) {
event->stopTs = gettime() - startTime;
__atomic_fetch_add(&event->ctx->collApiPoolBase, 1, __ATOMIC_RELAXED);
}
updateEvent(event->parent);
return;
}
If I’m misunderstanding the lifecycle, please let me know. Thanks!