Add rccl API support (#66)

* [Draft]: Add rccl API support

* Partial tests

Need to add tests to the cmake file

[ROCm/rocprofiler-register commit: b71f9cabe6]
This commit is contained in:
Mythreya
2024-09-11 15:57:51 -07:00
committed by GitHub
parent ec3d720303
commit 13c0bf8e2b
8 changed files with 267 additions and 0 deletions
@@ -12,6 +12,7 @@ extern "C" {
# pragma weak hsa_init
# pragma weak roctxRangePush
# pragma weak roctxRangePop
# pragma weak ncclGetVersion
#endif
extern void
@@ -26,6 +27,13 @@ roctxRangePush(const char*);
extern void
roctxRangePop(const char*);
enum ncclResult_t
{
};
extern ncclResult_t
ncclGetVersion(int* version);
#ifdef __cplusplus
}
#endif
@@ -18,6 +18,7 @@ namespace
{
decltype(hip_init)* hip_init_fn = nullptr;
decltype(hsa_init)* hsa_init_fn = nullptr;
decltype(ncclGetVersion)* ncclGetVersion_fn = nullptr;
decltype(roctxRangePush)* roctxRangePush_fn = nullptr;
decltype(roctxRangePush)* roctxRangePop_fn = nullptr;
@@ -27,6 +28,7 @@ enum rocp_reg_test_modes : uint8_t
ROCP_REG_TEST_HIP = (1 << 0),
ROCP_REG_TEST_HSA = (1 << 1),
ROCP_REG_TEST_ROCTX = (1 << 2),
ROCP_REG_TEST_RCCL = (1 << 3),
};
template <uint8_t Idx = ROCP_REG_TEST_NONE>
@@ -73,6 +75,7 @@ resolve_symbols(int _open_mode = RTLD_LOCAL | RTLD_LAZY)
void* amdhip_handle = nullptr;
void* hsart_handle = nullptr;
void* roctx_handle = nullptr;
void* rccl_handle = nullptr;
if constexpr((Idx & ROCP_REG_TEST_HIP) == ROCP_REG_TEST_HIP)
{
@@ -97,5 +100,12 @@ resolve_symbols(int _open_mode = RTLD_LOCAL | RTLD_LAZY)
_resolve_dlsym(roctxRangePush_fn, roctx_handle, "roctxRangePush");
_resolve_dlsym(roctxRangePop_fn, roctx_handle, "roctxRangePop");
}
if constexpr((Idx & ROCP_REG_TEST_RCCL) == ROCP_REG_TEST_RCCL)
{
ncclGetVersion_fn = ncclGetVersion;
if(!ncclGetVersion_fn) _resolve_dlopen(rccl_handle, "librccl.so");
_resolve_dlsym(ncclGetVersion_fn, rccl_handle, "ncclGetVersion");
}
}
} // namespace