Files
rocm-systems/projects/rccl/src/init_nvtx.cc
T

忽略 .git-blame-ignore-revs 中的修訂。點擊 這裡 以繞過並查看正常的 Blame 視圖。

43 行
1.3 KiB
C++
原始文件 標準檢視 歷史記錄

2025-09-02 13:21:14 -07:00
/*************************************************************************
* Copyright (c) 2022-2025, NVIDIA CORPORATION. All rights reserved.
*
* See LICENSE.txt for license information
************************************************************************/
2022-11-29 04:27:46 -08:00
#include "nccl.h"
#include "nvtx.h"
2025-09-02 13:21:14 -07:00
#include "param.h"
2022-11-29 04:27:46 -08:00
static constexpr const nvtxPayloadEnum_t NvtxEnumRedSchema[] = {
2024-06-11 01:28:01 -07:00
{"Sum", ncclSum, 0},
{"Product", ncclProd, 0},
{"Max", ncclMax, 0},
{"Min", ncclMin, 0},
{"Avg", ncclAvg, 0}
2022-11-29 04:27:46 -08:00
};
2025-09-02 13:21:14 -07:00
NCCL_PARAM(NvtxDisable, "NVTX_DISABLE", 0);
2022-11-29 04:27:46 -08:00
// Must be called before the first call to any reduction operation.
void initNvtxRegisteredEnums() {
#ifndef NVTX_NO_IMPL
2022-11-29 04:27:46 -08:00
// Register schemas and strings
2025-09-02 13:21:14 -07:00
if (ncclParamNvtxDisable()) {
return;
}
2022-11-29 04:27:46 -08:00
constexpr const nvtxPayloadEnumAttr_t eAttr {
.fieldMask = NVTX_PAYLOAD_ENUM_ATTR_ENTRIES | NVTX_PAYLOAD_ENUM_ATTR_NUM_ENTRIES |
NVTX_PAYLOAD_ENUM_ATTR_SIZE | NVTX_PAYLOAD_ENUM_ATTR_SCHEMA_ID,
.name = NULL,
.entries = NvtxEnumRedSchema,
.numEntries = std::extent<decltype(NvtxEnumRedSchema)>::value,
.sizeOfEnum = sizeof(ncclRedOp_t),
2024-06-11 01:28:01 -07:00
.schemaId = NVTX_PAYLOAD_ENTRY_NCCL_REDOP,
.extension = nullptr
2022-11-29 04:27:46 -08:00
};
nvtxPayloadEnumRegister(nvtx3::domain::get<nccl_domain>(), &eAttr);
#endif
2022-11-29 04:27:46 -08:00
}