diff --git a/projects/clr/hipamd/hip_prof_gen.py b/projects/clr/hipamd/hip_prof_gen.py index 09bf65ebcd..e17b150cfc 100755 --- a/projects/clr/hipamd/hip_prof_gen.py +++ b/projects/clr/hipamd/hip_prof_gen.py @@ -301,8 +301,6 @@ def generate_prof_header(f, api_map, opts_map): f.write('// automatically generated sources\n') f.write('#ifndef _HIP_PROF_STR_H\n'); f.write('#define _HIP_PROF_STR_H\n'); - f.write('#include \n'); - f.write('#include \n'); # Generating dummy macro for non-public API f.write('\n// Dummy API primitives\n') @@ -383,27 +381,30 @@ def generate_prof_header(f, api_map, opts_map): f.write('#define INIT_CB_ARGS_DATA(cb_id, cb_data) INIT_##cb_id##_CB_ARGS_DATA(cb_data)\n') # Generating the method for the API string, name and parameters - f.write('\n') - f.write('#if 0\n') - f.write('// HIP API string method, method name and parameters\n') - f.write('const char* hipApiString(hip_api_id_t id, const hip_api_data_t* data) {\n') - f.write(' std::ostringstream oss;\n') - f.write(' switch (id) {\n') - for name, args in api_map.items(): - f.write(' case HIP_API_ID_' + name + ':\n') - f.write(' oss << "' + name + '("') - for ind in range(0, len(args)): - arg_tuple = args[ind] - arg_name = arg_tuple[1] - if ind != 0: f.write(' << ","') - f.write('\n << " ' + arg_name + '=" << data->args.' + name + '.' + arg_name) - f.write('\n << ")";\n') - f.write(' break;\n') - f.write(' default: oss << "unknown";\n') - f.write(' };\n') - f.write(' return strdup(oss.str().c_str());\n') - f.write('};\n') - f.write('#endif\n') + if False: + f.write('\n') + f.write('#if 0\n') + f.write('#include \n'); + f.write('#include \n'); + f.write('// HIP API string method, method name and parameters\n') + f.write('const char* hipApiString(hip_api_id_t id, const hip_api_data_t* data) {\n') + f.write(' std::ostringstream oss;\n') + f.write(' switch (id) {\n') + for name, args in api_map.items(): + f.write(' case HIP_API_ID_' + name + ':\n') + f.write(' oss << "' + name + '("') + for ind in range(0, len(args)): + arg_tuple = args[ind] + arg_name = arg_tuple[1] + if ind != 0: f.write(' << ","') + f.write('\n << " ' + arg_name + '=" << data->args.' + name + '.' + arg_name) + f.write('\n << ")";\n') + f.write(' break;\n') + f.write(' default: oss << "unknown";\n') + f.write(' };\n') + f.write(' return strdup(oss.str().c_str());\n') + f.write('};\n') + f.write('#endif\n') f.write('#endif // _HIP_PROF_STR_H\n'); diff --git a/projects/clr/hipamd/include/hip/hcc_detail/hip_runtime_api.h b/projects/clr/hipamd/include/hip/hcc_detail/hip_runtime_api.h index 68cefe2410..993fb2b1b4 100644 --- a/projects/clr/hipamd/include/hip/hcc_detail/hip_runtime_api.h +++ b/projects/clr/hipamd/include/hip/hcc_detail/hip_runtime_api.h @@ -2973,9 +2973,7 @@ hipError_t hipLaunchByPtr(const void* func); } /* extern "c" */ #endif -#ifdef __cplusplus -#include -#endif +#include #ifdef __cplusplus extern "C" { @@ -2987,7 +2985,7 @@ hipError_t hipRegisterApiCallback(uint32_t id, void* fun, void* arg); hipError_t hipRemoveApiCallback(uint32_t id); hipError_t hipRegisterActivityCallback(uint32_t id, void* fun, void* arg); hipError_t hipRemoveActivityCallback(uint32_t id); -static inline const char* hipApiName(const uint32_t& id) { return hip_api_name(id); } +const char* hipApiName(uint32_t id); const char* hipKernelNameRef(const hipFunction_t f); #ifdef __cplusplus } /* extern "C" */ diff --git a/projects/clr/hipamd/src/hip_hcc_internal.h b/projects/clr/hipamd/src/hip_hcc_internal.h index 769d6b7914..7695ea34c1 100644 --- a/projects/clr/hipamd/src/hip_hcc_internal.h +++ b/projects/clr/hipamd/src/hip_hcc_internal.h @@ -30,6 +30,7 @@ THE SOFTWARE. #include "hsa/hsa_ext_amd.h" #include "hip/hip_runtime.h" +#include "hip_prof_api.h" #include "hip_util.h" #include "env.h" diff --git a/projects/clr/hipamd/src/hip_intercept.cpp b/projects/clr/hipamd/src/hip_intercept.cpp index cab8aeb23b..6e8b120360 100644 --- a/projects/clr/hipamd/src/hip_intercept.cpp +++ b/projects/clr/hipamd/src/hip_intercept.cpp @@ -21,7 +21,7 @@ THE SOFTWARE. */ #include "hip/hip_runtime.h" -#include "hip/hcc_detail/hip_prof_api.h" +#include "hip_prof_api.h" // HIP API callback/activity @@ -47,3 +47,7 @@ hipError_t hipRegisterActivityCallback(uint32_t id, void* fun, void* arg) { hipError_t hipRemoveActivityCallback(uint32_t id) { return callbacks_table.set_activity(id, NULL, NULL) ? hipSuccess : hipErrorInvalidValue; } + +const char* hipApiName(uint32_t id) { + return hip_api_name(id); +} diff --git a/projects/clr/hipamd/include/hip/hcc_detail/hip_prof_api.h b/projects/clr/hipamd/src/hip_prof_api.h similarity index 100% rename from projects/clr/hipamd/include/hip/hcc_detail/hip_prof_api.h rename to projects/clr/hipamd/src/hip_prof_api.h