2
0

Add support for VA-API and rocDecode tracing (#92)

- VA API tracing using Timemory gotcha wrappers.
- rocDecode API tracing integration using callback to ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API
- Updated videodecode ctest to validate rocDecode APIs in perfetto trace.
Este cometimento está contido em:
Sajina PK
2025-02-11 13:08:23 -05:00
cometido por GitHub
ascendente e437200e9e
cometimento 697d1ac02f
21 ficheiros modificados com 6235 adições e 22 eliminações
+4
Ver ficheiro
@@ -106,6 +106,7 @@ ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_temp, ROCPROFSYS_CATEGORY_ROCM_SMI
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_power, ROCPROFSYS_CATEGORY_ROCM_SMI_POWER, "device_power", "Power consumption of a GPU device")
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_memory_usage, ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE, "device_memory_usage", "Memory usage of a GPU device")
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_smi_vcn_activity, ROCPROFSYS_CATEGORY_ROCM_SMI_VCN_ACTIVITY, "device_vcn_activity", "VCN Activity of a GPU device")
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rocdecode_api, ROCPROFSYS_CATEGORY_ROCM_ROCDECODE_API, "rocm_rocdecode_api", "ROCm ROCDecode API")
ROCPROFSYS_DEFINE_CATEGORY(category, rocm_rccl, ROCPROFSYS_CATEGORY_ROCM_RCCL, "rccl", "ROCm Communication Collectives Library (RCCL) regions")
ROCPROFSYS_DEFINE_CATEGORY(category, pthread, ROCPROFSYS_CATEGORY_PTHREAD, "pthread", "POSIX threading functions")
ROCPROFSYS_DEFINE_CATEGORY(category, kokkos, ROCPROFSYS_CATEGORY_KOKKOS, "kokkos", "KokkosTools regions")
@@ -130,6 +131,7 @@ ROCPROFSYS_DEFINE_CATEGORY(category, thread_context_switch, ROCPROFSYS_CATEGORY_
ROCPROFSYS_DEFINE_CATEGORY(category, thread_hardware_counter, ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER, "thread_hardware_counter", "Hardware counter value on thread (derived from sampling)")
ROCPROFSYS_DEFINE_CATEGORY(category, kernel_hardware_counter, ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER, "kernel_hardware_counter", "Hardware counter value for kernel (deterministic)")
ROCPROFSYS_DEFINE_CATEGORY(category, numa, ROCPROFSYS_CATEGORY_NUMA, "numa", "Non-unified memory architecture")
ROCPROFSYS_DEFINE_CATEGORY(category, vaapi, ROCPROFSYS_CATEGORY_VAAPI, "vaapi", "Video Accelerator API")
ROCPROFSYS_DEFINE_CATEGORY(category, timer_sampling, ROCPROFSYS_CATEGORY_TIMER_SAMPLING, "timer_sampling", "Sampling based on a timer")
ROCPROFSYS_DEFINE_CATEGORY(category, overflow_sampling, ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING, "overflow_sampling", "Sampling based on a counter overflow")
@@ -169,6 +171,7 @@ using name = perfetto_category<Tp...>;
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_power), \
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_memory_usage), \
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_smi_vcn_activity), \
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rocdecode_api), \
ROCPROFSYS_PERFETTO_CATEGORY(category::rocm_rccl), \
ROCPROFSYS_PERFETTO_CATEGORY(category::pthread), \
ROCPROFSYS_PERFETTO_CATEGORY(category::kokkos), \
@@ -194,6 +197,7 @@ using name = perfetto_category<Tp...>;
ROCPROFSYS_PERFETTO_CATEGORY(category::thread_hardware_counter), \
ROCPROFSYS_PERFETTO_CATEGORY(category::kernel_hardware_counter), \
ROCPROFSYS_PERFETTO_CATEGORY(category::numa), \
ROCPROFSYS_PERFETTO_CATEGORY(category::vaapi), \
ROCPROFSYS_PERFETTO_CATEGORY(category::timer_sampling), \
ROCPROFSYS_PERFETTO_CATEGORY(category::overflow_sampling), \
::perfetto::Category("timemory").SetDescription("Events from the timemory API")
+19
Ver ficheiro
@@ -1872,6 +1872,25 @@ get_use_kokkosp_kernel_logger()
return static_cast<tim::tsettings<bool>&>(*_v->second).get();
}
// Check if VAAPI tracing is enabled
bool
get_use_vaapi_tracing()
{
#if defined(ROCPROFSYS_USE_ROCM) && ROCPROFSYS_USE_ROCM > 0
static auto _v = get_config()->find("ROCPROFSYS_ROCM_DOMAINS");
if(_v == get_config()->end())
{
return false; // Setting not found
}
std::string domains = static_cast<tim::tsettings<std::string>&>(*_v->second).get();
auto domain_list = tim::delimit(domains, " ,;:\t\n");
return std::find(domain_list.begin(), domain_list.end(), "rocdecode_api") !=
domain_list.end();
#else
return false;
#endif
}
bool
get_use_ompt()
{
+3
Ver ficheiro
@@ -225,6 +225,9 @@ get_use_kokkosp();
bool
get_use_kokkosp_kernel_logger();
bool
get_use_vaapi_tracing();
bool
get_use_ompt();
+23 -10
Ver ficheiro
@@ -350,15 +350,20 @@ std::unordered_set<rocprofiler_callback_tracing_kind_t>
get_callback_domains()
{
const auto callback_tracing_info = rocprofiler::sdk::get_callback_tracing_names();
const auto supported = std::unordered_set<rocprofiler_callback_tracing_kind_t>{
const auto supported = std::unordered_set<rocprofiler_callback_tracing_kind_t>
{
ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API,
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT,
ROCPROFILER_CALLBACK_TRACING_HSA_AMD_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_IMAGE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HSA_FINALIZE_EXT_API,
ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API,
ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT,
# if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
ROCPROFILER_VERSION_MAJOR >= 1
ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API,
# endif
};
auto _data = std::unordered_set<rocprofiler_callback_tracing_kind_t>{};
@@ -393,7 +398,7 @@ get_callback_domains()
}
else if(itr == "hip_api")
{
for(auto eitr : { ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API,
for(auto eitr : { ROCPROFILER_CALLBACK_TRACING_HIP_RUNTIME_API,
ROCPROFILER_CALLBACK_TRACING_HIP_COMPILER_API })
_data.emplace(eitr);
}
@@ -401,6 +406,13 @@ get_callback_domains()
{
_data.emplace(ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API);
}
# if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
ROCPROFILER_VERSION_MAJOR >= 1
else if(itr == "rocdecode_api")
{
_data.emplace(ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API);
}
# endif
else
{
for(size_t idx = 0; idx < callback_tracing_info.size(); ++idx)
@@ -462,7 +474,7 @@ get_buffered_domains()
else if(itr == "hip_api")
{
for(auto eitr : { ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API,
ROCPROFILER_BUFFER_TRACING_HIP_COMPILER_API })
ROCPROFILER_BUFFER_TRACING_HIP_RUNTIME_API })
_data.emplace(eitr);
}
else if(itr == "marker_api" || itr == "roctx")
@@ -570,6 +582,7 @@ namespace rocprofiler_sdk
void
config_settings(const std::shared_ptr<settings>&)
{}
} // namespace rocprofiler_sdk
} // namespace rocprofsys