Search for rocprofiler_set_api_table(...) via RTLD_DEFAULT (#56)

* Search for rocprofiler_set_api_table(...) via RTLD_DEFAULT

- check if rocprofiler_set_api_table function has already been loaded via dlsym(RTLD_DEFAULT, ...)
- fix warning about conflicting ROCM_DEP_ROCMCORE and ROCPROFILER_REGISTER_DEP_ROCMCORE

* Bump version to 0.4.0
Tá an tiomantas seo le fáil i:
Jonathan R. Madsen
2024-02-25 21:14:27 -06:00
tiomanta ag GitHub
tuismitheoir 1f0d06b6cb
tiomantas e2db37ca8d
D'athraigh 3 comhad le 15 breiseanna agus 2 scriosta
+1 -1
Féach ar an gComhad
@@ -1 +1 @@
0.3.0
0.4.0
+2 -1
Féach ar an gComhad
@@ -54,7 +54,8 @@ if(ROCPROFILER_REGISTER_BUILD_CI AND NOT ROCPROFILER_REGISTER_ENABLE_CLANG_TIDY)
FORCE)
endif()
if(NOT ROCM_DEP_ROCMCORE EQUAL ROCPROFILER_REGISTER_DEP_ROCMCORE)
if((ROCM_DEP_ROCMCORE AND NOT ROCPROFILER_REGISTER_DEP_ROCMCORE)
OR (NOT ROCM_DEP_ROCMCORE AND ROCPROFILER_REGISTER_DEP_ROCMCORE))
message(
AUTHOR_WARNING
"Conflicting option values: ROCM_DEP_ROCMCORE = ${ROCM_DEP_ROCMCORE} and ROCPROFILER_REGISTER_DEP_ROCMCORE = ${ROCPROFILER_REGISTER_DEP_ROCMCORE}"
@@ -273,6 +273,18 @@ rocp_load_rocprofiler_lib(std::string _rocp_reg_lib)
if(rocprofiler_set_api_table) rocprofiler_lib_config_fn = &rocprofiler_set_api_table;
// return if found via LD_PRELOAD
if(rocprofiler_lib_config_fn)
return std::make_tuple(rocprofiler_lib_handle, rocprofiler_lib_config_fn);
// look to see if entrypoint function is already a symbol
*(void**) (&rocprofiler_lib_config_fn) =
dlsym(RTLD_DEFAULT, rocprofiler_lib_register_entrypoint);
// return if found via RTLD_DEFAULT
if(rocprofiler_lib_config_fn)
return std::make_tuple(rocprofiler_lib_handle, rocprofiler_lib_config_fn);
if(_rocp_reg_lib.empty()) _rocp_reg_lib = rocprofiler_lib_name;
auto _rocp_reg_lib_path = fs::path{ _rocp_reg_lib };