SWDEV-546287 - Implement hipLibrary load/unload (#975)

Этот коммит содержится в:
Jatin Chaudhary
2025-09-19 22:23:49 +01:00
коммит произвёл GitHub
родитель 775ac73d25
Коммит e79eaaa8a5
26 изменённых файлов: 1175 добавлений и 16 удалений
+9
Просмотреть файл
@@ -974,6 +974,13 @@ ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipMemPrefetchAsync_v2)
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipMemAdvise_v2)
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipStreamGetId)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 15
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryLoadData)
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryLoadFromFile)
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryUnload)
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryGetKernel)
ROCPROFILER_ENUM_LABEL(ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryGetKernelCount)
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION == 0
static_assert(ROCPROFILER_HIP_RUNTIME_API_ID_LAST == 442);
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 1
@@ -1004,6 +1011,8 @@ static_assert(ROCPROFILER_HIP_RUNTIME_API_ID_LAST == 477);
static_assert(ROCPROFILER_HIP_RUNTIME_API_ID_LAST == 477);
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 14
static_assert(ROCPROFILER_HIP_RUNTIME_API_ID_LAST == 496);
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 15
static_assert(ROCPROFILER_HIP_RUNTIME_API_ID_LAST == 501);
#else
# if !defined(ROCPROFILER_UNSAFE_NO_VERSION_CHECK) && \
(defined(ROCPROFILER_CI) && ROCPROFILER_CI > 0)
+39
Просмотреть файл
@@ -3285,6 +3285,45 @@ typedef union rocprofiler_hip_api_args_t
unsigned long long* streamId;
} hipStreamGetId;
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 15
struct
{
hipLibrary_t* library;
const void* code;
hipJitOption** jitOptions;
void** jitOptionsValues;
unsigned int numJitOptions;
hipLibraryOption** libraryOptions;
void** libraryOptionValues;
unsigned int numLibraryOptions;
} hipLibraryLoadData;
struct
{
hipLibrary_t* library;
const char* fileName;
hipJitOption** jitOptions;
void** jitOptionsValues;
unsigned int numJitOptions;
hipLibraryOption** libraryOptions;
void** libraryOptionValues;
unsigned int numLibraryOptions;
} hipLibraryLoadFromFile;
struct
{
hipLibrary_t library;
} hipLibraryUnload;
struct
{
hipKernel_t* pKernel;
hipLibrary_t library;
const char* name;
} hipLibraryGetKernel;
struct
{
unsigned int* count;
hipLibrary_t library;
} hipLibraryGetKernelCount;
#endif
} rocprofiler_hip_api_args_t;
ROCPROFILER_EXTERN_C_FINI
+7
Просмотреть файл
@@ -551,6 +551,13 @@ typedef enum rocprofiler_hip_runtime_api_id_t // NOLINT(performance-enum-size)
ROCPROFILER_HIP_RUNTIME_API_ID_hipMemPrefetchAsync_v2,
ROCPROFILER_HIP_RUNTIME_API_ID_hipMemAdvise_v2,
ROCPROFILER_HIP_RUNTIME_API_ID_hipStreamGetId,
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 15
ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryLoadData,
ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryLoadFromFile,
ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryUnload,
ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryGetKernel,
ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryGetKernelCount,
#endif
ROCPROFILER_HIP_RUNTIME_API_ID_LAST,
} rocprofiler_hip_runtime_api_id_t;
+10
Просмотреть файл
@@ -593,6 +593,14 @@ ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipMemAdvise_v2_fn, 494);
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipStreamGetId_fn, 495);
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 15
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLibraryLoadData_fn, 496);
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLibraryLoadFromFile_fn, 497);
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLibraryUnload_fn, 498);
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLibraryGetKernel_fn, 499);
ROCP_SDK_ENFORCE_ABI(::HipDispatchTable, hipLibraryGetKernelCount_fn, 500);
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION == 0
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 442)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 1
@@ -623,6 +631,8 @@ ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 477)
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 477)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 14
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 496)
#elif HIP_RUNTIME_API_TABLE_STEP_VERSION == 15
ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 501)
#else
INTERNAL_CI_ROCP_SDK_ENFORCE_ABI_VERSIONING(::HipDispatchTable, 0)
#endif
+8
Просмотреть файл
@@ -619,6 +619,14 @@ HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNT
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipMemAdvise_v2, hipMemAdvise_v2, hipMemAdvise_v2_fn, dev_ptr, count, advice, location);
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipStreamGetId, hipStreamGetId, hipStreamGetId_fn, stream, streamId);
#endif
#if HIP_RUNTIME_API_TABLE_STEP_VERSION >= 15
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryLoadData, hipLibraryLoadData, hipLibraryLoadData_fn, library, code, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions);
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryLoadFromFile, hipLibraryLoadFromFile, hipLibraryLoadFromFile_fn, library, fileName, jitOptions, jitOptionsValues, numJitOptions, libraryOptions, libraryOptionValues, numLibraryOptions);
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryUnload, hipLibraryUnload, hipLibraryUnload_fn, library);
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryGetKernel, hipLibraryGetKernel, hipLibraryGetKernel_fn, pKernel, library, name);
HIP_API_INFO_DEFINITION_V(ROCPROFILER_HIP_TABLE_ID_Runtime, ROCPROFILER_HIP_RUNTIME_API_ID_hipLibraryGetKernelCount, hipLibraryGetKernelCount, hipLibraryGetKernelCount_fn, count, library);
#endif
// clang-format on
#else