Generalized updates (#174)

- include/rocprofiler/agent.h
  - move rocprofiler_dim3_t
- include/rocprofiler/buffer_tracing.h
  - size fields
  - update kernel dispatch record
- include/rocprofiler/callback_tracing.h
  - remove rocprofiler_callback_tracing_code_object_unload_data_t
  - remove rocprofiler_callback_tracing_code_object_register_host_kernel_symbol_data_t
- include/rocprofiler/fwd.h
  - added ROCPROFILER_STATUS_ERROR_CONTEXT_CONFLICT
  - remove ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_UNLOAD
  - remove ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT_DEVICE_KERNEL_SYMBOL_UNREGISTER
  - add rocprofiler_kernel_id_t typedef
  - add rocprofiler_dim3_t (moved from agent.h)
- lib/common/synchronized.hpp
  - rlock/wlock return decltype(auto)
  - separate prototype from definition
- lib/common/utility.{hpp,cpp}
  - timestamp functions replicating HSA implementation(s)
  - init_public_api_struct for setting size field and ensuring certain type traits
  - simplified static_cleanup_wrapper
  - separate prototype from definition in active_capacity_gate
- lib/rocprofiler/agent.cpp
  - tweak get_rocprofiler_agent impl
- lib/rocprofiler/buffer.cpp
  - fix buffer message log level
- lib/rocprofiler/context.cpp
  - use new paradigm for getting active contexts
- lib/rocprofiler/internal_threading.hpp
  - update to simplified static_cleanup_wrapper implementation
- lib/rocprofiler/registration.cpp
  - fix deactivating contexts
- lib/rocprofiler/rocprofiler.cpp
  - status string for context conflict
- lib/rocprofiler/context/context.*
  - correlation_id struct
  - new get_active_contexts paradigm
- lib/rocprofiler/counters/core.*
  - rocprofiler_packet union
  - tweak start/stop context to accept pointer instead of handle
- lib/rocprofiler/counters/dimensions.cpp
  - update to new get_rocp_agent() return type
- lib/rocprofiler/hsa/hsa.*
  - update to new get_active_contexts paradigm
  - update to new correlation id implementation
  - guard against hsa.def.cpp direct compilation
- lib/rocprofiler/hsa/queue_controller.*
  - update to change in get_rocp_agent return type
  - consistent aliases
  - lookup function for getting queue pointer from hsa queue id
- lib/rocprofiler/hsa/queue.*
  - rocprofiler_packet
  - extend queue_info_session_t
- lib/rocprofiler/tests/registration.cpp
  - improve diagnostic on perf check for rocprofiler_lib.callback_registration_lambda_with_result
Tá an tiomantas seo le fáil i:
Jonathan R. Madsen
2023-11-06 21:59:31 -06:00
tiomanta ag GitHub
tuismitheoir 63775f241a
tiomantas 55f2dabbb3
D'athraigh 26 comhad le 828 breiseanna agus 325 scriosta
+19 -21
Féach ar an gComhad
@@ -22,7 +22,7 @@ std::unique_ptr<rocprofiler::hsa::AQLPacket>
queue_cb(const std::shared_ptr<rocprofiler::counters::counter_callback_info>& info,
const hsa::Queue& queue,
hsa::ClientID,
const hsa_ext_amd_aql_pm4_packet_t&)
hsa::rocprofiler_packet)
{
if(!info) return nullptr;
@@ -95,7 +95,7 @@ void
completed_cb(const std::shared_ptr<rocprofiler::counters::counter_callback_info>& info,
const hsa::Queue& queue,
hsa::ClientID,
const hsa_ext_amd_aql_pm4_packet_t& kernel,
hsa::rocprofiler_packet kernel,
std::unique_ptr<rocprofiler::hsa::AQLPacket> pkt)
{
if(!info) return;
@@ -127,7 +127,7 @@ completed_cb(const std::shared_ptr<rocprofiler::counters::counter_callback_info>
info->user_cb(queue.get_id(),
info->profile_cfg.agent,
rocprofiler_correlation_id_t{},
reinterpret_cast<const hsa_kernel_dispatch_packet_t*>(&kernel),
&kernel.kernel_dispatch,
info->callback_args,
out.data(), // Date pointer does here.
out.size(), // Number of objects
@@ -215,31 +215,29 @@ destroy_counter_profile(uint64_t id)
}
void
start_context(rocprofiler_context_id_t context_id)
start_context(context::context* ctx)
{
auto& ctx = *rocprofiler::context::get_registered_contexts().at(context_id.handle);
if(!ctx || !ctx->counter_collection) return;
auto& controller = hsa::get_queue_controller();
if(!ctx.counter_collection) return;
// Only one thread should be attempting to enable/disable this context
ctx.counter_collection->enabled.wlock([&](auto& enabled) {
ctx->counter_collection->enabled.wlock([&](auto& enabled) {
if(enabled) return;
for(auto& cb : ctx.counter_collection->callbacks)
for(auto& cb : ctx->counter_collection->callbacks)
{
// Insert our callbacks into HSA Interceptor. This
// turns on counter instrumentation.
cb->queue_id = controller.add_callback(
cb->profile_cfg.agent,
[=](const hsa::Queue& q,
hsa::ClientID c,
const hsa_ext_amd_aql_pm4_packet_t& kern_pkt) {
[=](const hsa::Queue& q, hsa::ClientID c, hsa::rocprofiler_packet kern_pkt) {
return queue_cb(cb, q, c, kern_pkt);
},
// Completion CB
[=](const hsa::Queue& q,
hsa::ClientID c,
const hsa_ext_amd_aql_pm4_packet_t& kern_pkt,
std::unique_ptr<hsa::AQLPacket> aql) {
[=](const hsa::Queue& q,
hsa::ClientID c,
hsa::rocprofiler_packet kern_pkt,
std::unique_ptr<hsa::AQLPacket> aql) {
completed_cb(cb, q, c, kern_pkt, std::move(aql));
});
}
@@ -248,15 +246,15 @@ start_context(rocprofiler_context_id_t context_id)
}
void
stop_context(rocprofiler_context_id_t context_id)
stop_context(context::context* ctx)
{
auto& controller = hsa::get_queue_controller();
auto& ctx = *rocprofiler::context::get_registered_contexts().at(context_id.handle);
if(!ctx.counter_collection) return;
if(!ctx || !ctx->counter_collection) return;
ctx.counter_collection->enabled.wlock([&](auto& enabled) {
auto& controller = hsa::get_queue_controller();
ctx->counter_collection->enabled.wlock([&](auto& enabled) {
if(!enabled) return;
for(auto& cb : ctx.counter_collection->callbacks)
for(auto& cb : ctx->counter_collection->callbacks)
{
// Remove our callbacks from HSA's queue controller
controller.remove_callback(cb->queue_id);