Support Tool Intercept API Tables (#165)
* Update include/rocprofiler
- intercept_table.h header
- generic rocprofiler_runtime_library_t
- rocprofiler_internal_thread_library_t is not typedef for rocprofiler_runtime_library_t
- rocprofiler_at_runtime_api_registration
* Update lib/rocprofiler
- minor tweaks to context.cpp
- check if none context early
- disallow stop_context when finalizing
- add intercept_table.hpp and intercept_table.cpp
- implement rocprofiler_at_runtime_api_registration
- implement notify_runtime_api_registration
- update registration.cpp
- invoke notify_runtime_api_registration
- tweak to fini status when invoking client finalizer
* Update lib/rocprofiler/tests
- add tests for intercept table
* Add samples/intercept_table
- demonstrate how to install custom API function wrappers instead of relying on HSA callback tracing
* Update lib/rocprofiler/tests/intercept_table.cpp
- remove _SERVICE from ROCPROFILER_SERVICE_
* Update include/rocprofiler/intercept_table.h
- Update doxygen comments
* Update lib/rocprofiler/intercept_table.cpp
- return error config locked if already initialized
* Update lib/rocprofiler/intercept_table.cpp
- remove unnecessary alias
* Apply suggestions from code review
Co-authored-by: Tony Tye <Tony.Tye@amd.com>
* Update doxygen comments
- clarify when rocprofiler_at_runtime_api_registration can be invoked
* Use rocprofiler_runtime_library_t for intercept table and internal threading
- remove rocprofiler_intercept_library_t alias to rocprofiler_runtime_library_t
- remove rocprofiler_internal_thread_library_t alias to rocprofiler_runtime_library_t
- move around documentation with regard to rocprofiler_runtime_library_t enumeration
- added some extra doxygen documentation to internal threading functions
---------
Co-authored-by: Tony Tye <Tony.Tye@amd.com>
[ROCm/rocprofiler-sdk commit: 4f2dc896d3]
This commit is contained in:
1 parent
1e2a80ef8e
commit
370a86830b
22 files changed
+1823
-52
No files matched your search
@@ -43,9 +43,9 @@ namespace internal_threading
|
||||
{
|
||||
namespace
|
||||
{
|
||||
template <rocprofiler_internal_thread_library_t... Idx>
|
||||
using library_sequence_t = std::integer_sequence<rocprofiler_internal_thread_library_t, Idx...>;
|
||||
using creation_notifier_cb_t = void (*)(rocprofiler_internal_thread_library_t, void*);
|
||||
template <rocprofiler_runtime_library_t... Idx>
|
||||
using library_sequence_t = std::integer_sequence<rocprofiler_runtime_library_t, Idx...>;
|
||||
using creation_notifier_cb_t = void (*)(rocprofiler_runtime_library_t, void*);
|
||||
using thread_pool_config_t = PTL::ThreadPool::Config;
|
||||
|
||||
// this is used to loop over the different libraries
|
||||
@@ -66,7 +66,7 @@ enum class notifier_stage
|
||||
};
|
||||
|
||||
// data structure holding list of callbacks
|
||||
template <rocprofiler_internal_thread_library_t LibT>
|
||||
template <rocprofiler_runtime_library_t LibT>
|
||||
struct creation_notifier
|
||||
{
|
||||
static constexpr auto value = LibT;
|
||||
@@ -78,7 +78,7 @@ struct creation_notifier
|
||||
};
|
||||
|
||||
// static accessor for creation_notifier instance
|
||||
template <rocprofiler_internal_thread_library_t LibT>
|
||||
template <rocprofiler_runtime_library_t LibT>
|
||||
auto&
|
||||
get_creation_notifier()
|
||||
{
|
||||
@@ -87,7 +87,7 @@ get_creation_notifier()
|
||||
}
|
||||
|
||||
// adds callbacks to creation_notifier instance(s)
|
||||
template <rocprofiler_internal_thread_library_t... Idx>
|
||||
template <rocprofiler_runtime_library_t... Idx>
|
||||
void
|
||||
update_creation_notifiers(creation_notifier_cb_t pre,
|
||||
creation_notifier_cb_t post,
|
||||
@@ -110,10 +110,10 @@ update_creation_notifiers(creation_notifier_cb_t pre,
|
||||
}
|
||||
|
||||
// invokes creation notifiers
|
||||
template <notifier_stage StageT, rocprofiler_internal_thread_library_t... Idx>
|
||||
template <notifier_stage StageT, rocprofiler_runtime_library_t... Idx>
|
||||
void
|
||||
execute_creation_notifiers(rocprofiler_internal_thread_library_t libs,
|
||||
std::integer_sequence<rocprofiler_internal_thread_library_t, Idx...>)
|
||||
execute_creation_notifiers(rocprofiler_runtime_library_t libs,
|
||||
std::integer_sequence<rocprofiler_runtime_library_t, Idx...>)
|
||||
{
|
||||
auto execute = [libs](auto& notifier) {
|
||||
if(((libs & notifier.value) == notifier.value))
|
||||
@@ -189,13 +189,13 @@ finalize()
|
||||
}
|
||||
|
||||
void
|
||||
notify_pre_internal_thread_create(rocprofiler_internal_thread_library_t libs)
|
||||
notify_pre_internal_thread_create(rocprofiler_runtime_library_t libs)
|
||||
{
|
||||
execute_creation_notifiers<notifier_stage::precreation>(libs, creation_notifier_library_seq);
|
||||
}
|
||||
|
||||
void
|
||||
notify_post_internal_thread_create(rocprofiler_internal_thread_library_t libs)
|
||||
notify_post_internal_thread_create(rocprofiler_runtime_library_t libs)
|
||||
{
|
||||
execute_creation_notifiers<notifier_stage::postcreation>(libs, creation_notifier_library_seq);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user