SWDEV-546179 - hipModuleGetFunctionCount AMD impl (#782)

* SWDEV-546179 - hipModuleGetFunctionCount AMD impl

* SWDEV-546179 - return invalid for count ptr

* SWDEV-546179 - hipModuleGetFunctionCount CHANGELOG.md update
这个提交包含在:
GunaShekar, Ajay
2025-08-13 20:28:12 -07:00
提交者 GitHub
父节点 76637d7ebe
当前提交 dfb46db2fb
修改 12 个文件,包含 87 行新增5 行删除
@@ -63,7 +63,7 @@
#define HIP_API_TABLE_STEP_VERSION 0
#define HIP_COMPILER_API_TABLE_STEP_VERSION 0
#define HIP_TOOLS_API_TABLE_STEP_VERSION 0
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 13
#define HIP_RUNTIME_API_TABLE_STEP_VERSION 14
// HIP API interface
// HIP compiler dispatch functions
@@ -635,6 +635,7 @@ typedef hipError_t (*t_hipMipmappedArrayGetLevel)(hipArray_t* pLevelArray,
unsigned int level);
typedef hipError_t (*t_hipModuleGetFunction)(hipFunction_t* function, hipModule_t module,
const char* kname);
typedef hipError_t (*t_hipModuleGetFunctionCount)(unsigned int* count, hipModule_t module);
typedef hipError_t (*t_hipModuleGetGlobal)(hipDeviceptr_t* dptr, size_t* bytes, hipModule_t hmod,
const char* name);
typedef hipError_t (*t_hipModuleGetTexRef)(textureReference** texRef, hipModule_t hmod,
@@ -1588,10 +1589,13 @@ struct HipDispatchTable {
t_hipMemGetHandleForAddressRange hipMemGetHandleForAddressRange_fn;
// HIP_RUNTIME_API_TABLE_STEP_VERSION = 13
t_hipModuleGetFunctionCount hipModuleGetFunctionCount_fn;
// HIP_RUNTIME_API_TABLE_STEP_VERSION = 14
// removed HIP_MEMSET_NODE_PARAMS replaced by hipMemsetParams
// DO NOT EDIT ABOVE!
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 13
// HIP_RUNTIME_API_TABLE_STEP_VERSION == 14
// ******************************************************************************************* //
//
+26 -1
查看文件
@@ -438,7 +438,8 @@ enum hip_api_id_t {
HIP_API_ID_hipLinkDestroy = 418,
HIP_API_ID_hipLaunchKernelExC = 419,
HIP_API_ID_hipDrvLaunchKernelEx = 420,
HIP_API_ID_LAST = 420,
HIP_API_ID_hipModuleGetFunctionCount = 421,
HIP_API_ID_LAST = 421,
HIP_API_ID_hipChooseDevice = HIP_API_ID_CONCAT(HIP_API_ID_,hipChooseDevice),
HIP_API_ID_hipGetDeviceProperties = HIP_API_ID_CONCAT(HIP_API_ID_,hipGetDeviceProperties),
@@ -885,6 +886,7 @@ static inline const char* hip_api_name(const uint32_t id) {
case HIP_API_ID_hipUserObjectRelease: return "hipUserObjectRelease";
case HIP_API_ID_hipUserObjectRetain: return "hipUserObjectRetain";
case HIP_API_ID_hipWaitExternalSemaphoresAsync: return "hipWaitExternalSemaphoresAsync";
case HIP_API_ID_hipModuleGetFunctionCount: return "hipModuleGetFunctionCount";
};
return "unknown";
};
@@ -1300,6 +1302,7 @@ static inline uint32_t hipApiIdByName(const char* name) {
if (strcmp("hipUserObjectRelease", name) == 0) return HIP_API_ID_hipUserObjectRelease;
if (strcmp("hipUserObjectRetain", name) == 0) return HIP_API_ID_hipUserObjectRetain;
if (strcmp("hipWaitExternalSemaphoresAsync", name) == 0) return HIP_API_ID_hipWaitExternalSemaphoresAsync;
if (strcmp("hipModuleGetFunctionCount", name) == 0) return HIP_API_ID_hipModuleGetFunctionCount;
return HIP_API_ID_NONE;
}
@@ -3289,6 +3292,11 @@ typedef struct hip_api_data_s {
const char* kname;
char kname__val;
} hipModuleGetFunction;
struct {
unsigned int* count;
unsigned int count__val;
hipModule_t mod;
} hipModuleGetFunctionCount;
struct {
hipDeviceptr_t* dptr;
hipDeviceptr_t dptr__val;
@@ -6236,6 +6244,12 @@ typedef struct hip_api_data_s {
cb_data.args.hipWaitExternalSemaphoresAsync.numExtSems = (unsigned int)numExtSems; \
cb_data.args.hipWaitExternalSemaphoresAsync.stream = (hipStream_t)stream; \
};
// hipModuleGetFunctionCount[('unsigned int*', 'count'), ('hipModule_t', 'mod')]
#define INIT_hipModuleGetFunctionCount_CB_ARGS_DATA(cb_data) { \
cb_data.args.hipModuleGetFunctionCount.count = (unsigned int*)count; \
cb_data.args.hipModuleGetFunctionCount.mod = (hipModule_t)mod; \
};
#define INIT_CB_ARGS_DATA(cb_id, cb_data) INIT_##cb_id##_CB_ARGS_DATA(cb_data)
// Macros for non-public API primitives
@@ -7907,6 +7921,10 @@ static inline void hipApiArgsInit(hip_api_id_t id, hip_api_data_t* data) {
if (data->args.hipWaitExternalSemaphoresAsync.extSemArray) data->args.hipWaitExternalSemaphoresAsync.extSemArray__val = *(data->args.hipWaitExternalSemaphoresAsync.extSemArray);
if (data->args.hipWaitExternalSemaphoresAsync.paramsArray) data->args.hipWaitExternalSemaphoresAsync.paramsArray__val = *(data->args.hipWaitExternalSemaphoresAsync.paramsArray);
break;
// hipModuleGetFunctionCount[('unsigned int*', 'count'), ('hipModule_t', 'mod')]
case HIP_API_ID_hipModuleGetFunctionCount:
if (data->args.hipModuleGetFunctionCount.count) data->args.hipModuleGetFunctionCount.count__val = *(data->args.hipModuleGetFunctionCount.count);
break;
default: break;
};
}
@@ -11195,6 +11213,13 @@ static inline const char* hipApiString(hip_api_id_t id, const hip_api_data_t* da
oss << ", stream="; roctracer::hip_support::detail::operator<<(oss, data->args.hipWaitExternalSemaphoresAsync.stream);
oss << ")";
break;
case HIP_API_ID_hipModuleGetFunctionCount:
oss << "hipModuleGetFunctionCount(";
if (data->args.hipModuleGetFunctionCount.count == NULL) oss << "count=NULL";
else { oss << "count="; roctracer::hip_support::detail::operator<<(oss, data->args.hipModuleGetFunctionCount.count__val); }
oss << ", mod="; roctracer::hip_support::detail::operator<<(oss, data->args.hipModuleGetFunctionCount.mod);
oss << ")";
break;
default: oss << "unknown";
};
return strdup(oss.str().c_str());