Add rocDecode API support (#4)

* Add rocDecode API support

* Update CI

* CI update: Sanitizers run on ubuntu 22.04

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
Trowbridge, Ian
2025-01-21 21:00:43 -06:00
committed by GitHub
parent 164eda5231
commit de3a874b1a
10 changed files with 313 additions and 23 deletions
+17
View File
@@ -13,6 +13,7 @@ extern "C" {
# pragma weak roctxRangePush
# pragma weak roctxRangePop
# pragma weak ncclGetVersion
# pragma weak rocDecCreateDecoder
#endif
extern void
@@ -34,6 +35,22 @@ enum ncclResult_t
extern ncclResult_t
ncclGetVersion(int* version);
enum rocDecStatus
{
};
enum rocDecDecoderHandle
{
};
enum RocDecoderCreateInfo
{
};
extern rocDecStatus
rocDecCreateDecoder(rocDecDecoderHandle* decoder_handle,
RocDecoderCreateInfo* decoder_create_info);
#ifdef __cplusplus
}
#endif
+24 -14
View File
@@ -16,19 +16,21 @@
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;
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;
decltype(rocDecCreateDecoder)* rocDecCreateDecoder_fn = nullptr;
enum rocp_reg_test_modes : uint8_t
{
ROCP_REG_TEST_NONE = 0x0,
ROCP_REG_TEST_HIP = (1 << 0),
ROCP_REG_TEST_HSA = (1 << 1),
ROCP_REG_TEST_ROCTX = (1 << 2),
ROCP_REG_TEST_RCCL = (1 << 3),
ROCP_REG_TEST_NONE = 0x0,
ROCP_REG_TEST_HIP = (1 << 0),
ROCP_REG_TEST_HSA = (1 << 1),
ROCP_REG_TEST_ROCTX = (1 << 2),
ROCP_REG_TEST_RCCL = (1 << 3),
ROCP_REG_TEST_ROCDECODE = (1 << 4),
};
template <uint8_t Idx = ROCP_REG_TEST_NONE>
@@ -72,10 +74,11 @@ 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;
void* amdhip_handle = nullptr;
void* hsart_handle = nullptr;
void* roctx_handle = nullptr;
void* rccl_handle = nullptr;
void* rocdecode_handle = nullptr;
if constexpr((Idx & ROCP_REG_TEST_HIP) == ROCP_REG_TEST_HIP)
{
@@ -107,5 +110,12 @@ resolve_symbols(int _open_mode = RTLD_LOCAL | RTLD_LAZY)
if(!ncclGetVersion_fn) _resolve_dlopen(rccl_handle, "librccl.so");
_resolve_dlsym(ncclGetVersion_fn, rccl_handle, "ncclGetVersion");
}
if constexpr((Idx & ROCP_REG_TEST_ROCDECODE) == ROCP_REG_TEST_ROCDECODE)
{
rocDecCreateDecoder_fn = rocDecCreateDecoder;
if(!rocDecCreateDecoder_fn) _resolve_dlopen(rocdecode_handle, "librocdecode.so");
_resolve_dlsym(rocDecCreateDecoder_fn, rocdecode_handle, "rocDecCreateDecoder");
}
}
} // namespace