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.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying file
|
||||
# Copyright.txt or https://cmake.org/licensing for details.
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
set(LIBVA_HEADERS_INCLUDE_DIR_INTERNAL
|
||||
"${PROJECT_SOURCE_DIR}/source/lib/rocprof-sys/library/tpls"
|
||||
CACHE PATH "Path to internal va headers")
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
find_path(
|
||||
LIBVA_HEADERS_INCLUDE_DIR
|
||||
NAMES va/va.h
|
||||
PATHS /opt/amdgpu/include
|
||||
NO_DEFAULT_PATH)
|
||||
|
||||
if(NOT EXISTS "${LIBVA_HEADERS_INCLUDE_DIR}")
|
||||
rocprofiler_systems_message(
|
||||
AUTHOR_WARNING
|
||||
"VA API header does not exist! Setting LIBVA_HEADERS_INCLUDE_DIR to internal directory: ${LIBVA_HEADERS_INCLUDE_DIR}"
|
||||
)
|
||||
set(LIBVA_HEADERS_INCLUDE_DIR
|
||||
"${LIBVA_HEADERS_INCLUDE_DIR_INTERNAL}"
|
||||
CACHE PATH "Path to VA API headers" FORCE)
|
||||
else()
|
||||
rocprofiler_systems_message(STATUS
|
||||
"VA API header found: ${LIBVA_HEADERS_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
mark_as_advanced(LIBVA_HEADERS_INCLUDE_DIR)
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
|
||||
find_package_handle_standard_args(Libva-headers DEFAULT_MSG LIBVA_HEADERS_INCLUDE_DIR)
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
|
||||
if(Libva-headers_FOUND)
|
||||
add_library(roc::libva-headers INTERFACE IMPORTED)
|
||||
target_include_directories(roc::libva-headers SYSTEM
|
||||
INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
# ------------------------------------------------------------------------------#
|
||||
@@ -22,6 +22,8 @@ rocprofiler_systems_add_interface_library(
|
||||
"Provides flags for ROCm Communication Collectives Library (RCCL)")
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-mpi
|
||||
"Provides MPI or MPI headers")
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-libva
|
||||
"Provides VA-API headers")
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-bfd
|
||||
"Provides Binary File Descriptor (BFD)")
|
||||
rocprofiler_systems_add_interface_library(rocprofiler-systems-ptl
|
||||
@@ -690,6 +692,10 @@ if(ROCPROFSYS_USE_BFD)
|
||||
INTERFACE ROCPROFSYS_USE_BFD)
|
||||
endif()
|
||||
|
||||
find_package(Libva-headers ${rocprofiler_systems_FIND_QUIETLY} REQUIRED)
|
||||
target_include_directories(rocprofiler-systems-libva
|
||||
INTERFACE ${LIBVA_HEADERS_INCLUDE_DIR})
|
||||
|
||||
# ----------------------------------------------------------------------------------------#
|
||||
#
|
||||
# PTL (Parallel Tasking Library) submodule
|
||||
|
||||
@@ -75,7 +75,12 @@ get_whole_function_names()
|
||||
"ncclCommUserRank", "ncclReduce", "ncclBcast", "ncclBroadcast", "ncclAllReduce",
|
||||
"ncclReduceScatter", "ncclAllGather", "ncclGroupStart", "ncclGroupEnd",
|
||||
"ncclSend", "ncclRecv", "ncclGather", "ncclScatter", "ncclAllToAll",
|
||||
"ncclAllToAllv", "ncclSocketAccept"
|
||||
"ncclAllToAllv", "ncclSocketAccept", "vaBeginPicture", "vaCreateBuffer",
|
||||
"vaCreateConfig", "vaCreateContext", "vaCreateSurfaces", "vaDestroySurfaces",
|
||||
"vaSyncSurface", "vaDestroyBuffer", "vaDestroyConfig", "vaDestroyContext",
|
||||
"vaEndPicture", "vaExportSurfaceHandle", "vaGetConfigAttributes", "vaInitialize",
|
||||
"vaQueryConfigEntrypoints", "vaQuerySurfaceAttributes", "vaQuerySurfaceStatus",
|
||||
"vaRenderPicture", "vaTerminate", "vaDisplayIsValid"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ target_link_libraries(
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-elfutils>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-bfd>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-mpi>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-libva>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-ptl>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rocm>
|
||||
$<BUILD_INTERFACE:rocprofiler-systems::rocprofiler-systems-rccl>
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
@@ -225,6 +225,9 @@ get_use_kokkosp();
|
||||
bool
|
||||
get_use_kokkosp_kernel_logger();
|
||||
|
||||
bool
|
||||
get_use_vaapi_tracing();
|
||||
|
||||
bool
|
||||
get_use_ompt();
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ extern "C"
|
||||
ROCPROFSYS_CATEGORY_ROCM_SMI_POWER,
|
||||
ROCPROFSYS_CATEGORY_ROCM_SMI_MEMORY_USAGE,
|
||||
ROCPROFSYS_CATEGORY_ROCM_SMI_VCN_ACTIVITY,
|
||||
ROCPROFSYS_CATEGORY_ROCM_ROCDECODE_API,
|
||||
ROCPROFSYS_CATEGORY_ROCM_RCCL,
|
||||
ROCPROFSYS_CATEGORY_SAMPLING,
|
||||
ROCPROFSYS_CATEGORY_PTHREAD,
|
||||
@@ -83,6 +84,7 @@ extern "C"
|
||||
ROCPROFSYS_CATEGORY_THREAD_HARDWARE_COUNTER,
|
||||
ROCPROFSYS_CATEGORY_KERNEL_HARDWARE_COUNTER,
|
||||
ROCPROFSYS_CATEGORY_NUMA,
|
||||
ROCPROFSYS_CATEGORY_VAAPI,
|
||||
ROCPROFSYS_CATEGORY_TIMER_SAMPLING,
|
||||
ROCPROFSYS_CATEGORY_OVERFLOW_SAMPLING,
|
||||
ROCPROFSYS_CATEGORY_LAST
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include "library/components/mpi_gotcha.hpp"
|
||||
#include "library/components/numa_gotcha.hpp"
|
||||
#include "library/components/pthread_gotcha.hpp"
|
||||
#include "library/components/vaapi_gotcha.hpp"
|
||||
#include "library/coverage.hpp"
|
||||
#include "library/ompt.hpp"
|
||||
#include "library/process_sampler.hpp"
|
||||
@@ -486,6 +487,12 @@ rocprofsys_init_tooling_hidden()
|
||||
// start these gotchas once settings have been initialized
|
||||
if(get_init_bundle()) get_init_bundle()->start();
|
||||
|
||||
if(get_use_vaapi_tracing())
|
||||
{
|
||||
ROCPROFSYS_VERBOSE_F(1, "Setting up VA-API traces...\n");
|
||||
component::vaapi_gotcha::start();
|
||||
}
|
||||
|
||||
if(get_use_sampling()) sampling::block_signals();
|
||||
|
||||
// perfetto initialization
|
||||
@@ -762,6 +769,12 @@ rocprofsys_finalize_hidden(void)
|
||||
fini_bundle_t _finalization{};
|
||||
_finalization.start();
|
||||
|
||||
if(get_use_vaapi_tracing())
|
||||
{
|
||||
ROCPROFSYS_VERBOSE_F(1, "Shutting down VA-API tracing...\n");
|
||||
component::vaapi_gotcha::shutdown();
|
||||
}
|
||||
|
||||
if(get_use_rcclp())
|
||||
{
|
||||
ROCPROFSYS_VERBOSE_F(1, "Shutting down RCCLP...\n");
|
||||
|
||||
@@ -10,6 +10,7 @@ set(component_sources
|
||||
${CMAKE_CURRENT_LIST_DIR}/fork_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/mpi_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/numa_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_mutex_gotcha.cpp)
|
||||
@@ -27,6 +28,7 @@ set(component_headers
|
||||
${CMAKE_CURRENT_LIST_DIR}/fork_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/mpi_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/numa_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/vaapi_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/rcclp.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_gotcha.hpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/pthread_create_gotcha.hpp
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022-2025 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#include "library/components/vaapi_gotcha.hpp"
|
||||
#include "core/common.hpp"
|
||||
#include "core/config.hpp"
|
||||
#include "core/debug.hpp"
|
||||
#include "core/state.hpp"
|
||||
#include "core/timemory.hpp"
|
||||
#include "library/components/category_region.hpp"
|
||||
#include "library/runtime.hpp"
|
||||
|
||||
#include <timemory/backends/threading.hpp>
|
||||
#include <timemory/components/macros.hpp>
|
||||
#include <timemory/mpl/concepts.hpp>
|
||||
#include <timemory/utility/types.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace component
|
||||
{
|
||||
namespace
|
||||
{
|
||||
auto&
|
||||
get_vaapi_gotcha()
|
||||
{
|
||||
static auto _v = tim::lightweight_tuple<vaapi_gotcha_t>{};
|
||||
return _v;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
void
|
||||
vaapi_gotcha::configure()
|
||||
{
|
||||
// don't emit warnings for missing functions unless debug or verbosity >= 3
|
||||
if(get_verbose_env() < 3 && !get_debug_env())
|
||||
{
|
||||
for(size_t i = 0; i < vaapi_gotcha_t::capacity(); ++i)
|
||||
{
|
||||
auto* itr = vaapi_gotcha_t::at(i);
|
||||
if(itr) itr->verbose = -1;
|
||||
}
|
||||
}
|
||||
|
||||
vaapi_gotcha_t::get_initializer() = []() {
|
||||
vaapi_gotcha_t::configure<0, VAStatus, VADisplay, VAContextID, VASurfaceID>(
|
||||
"vaBeginPicture");
|
||||
vaapi_gotcha_t::configure<1, VAStatus, VADisplay, VAContextID, VABufferType,
|
||||
unsigned int, unsigned int, void*, VABufferID*>(
|
||||
"vaCreateBuffer");
|
||||
vaapi_gotcha_t::configure<2, VAStatus, VADisplay, VAProfile, VAEntrypoint,
|
||||
VAConfigAttrib*, int, VAConfigID*>("vaCreateConfig");
|
||||
vaapi_gotcha_t::configure<3, VAStatus, VADisplay, VAConfigID, int, int, int,
|
||||
VASurfaceID*, int, VAContextID*>("vaCreateContext");
|
||||
vaapi_gotcha_t::configure<4, VAStatus, VADisplay, unsigned int, unsigned int,
|
||||
unsigned int, VASurfaceID*, unsigned int,
|
||||
VASurfaceAttrib*, unsigned int>("vaCreateSurfaces");
|
||||
vaapi_gotcha_t::configure<5, VAStatus, VADisplay, VASurfaceID*, int>(
|
||||
"vaDestroySurfaces");
|
||||
vaapi_gotcha_t::configure<6, VAStatus, VADisplay, VASurfaceID>("vaSyncSurface");
|
||||
vaapi_gotcha_t::configure<7, VAStatus, VADisplay, VABufferID>("vaDestroyBuffer");
|
||||
vaapi_gotcha_t::configure<8, VAStatus, VADisplay, VAConfigID>("vaDestroyConfig");
|
||||
vaapi_gotcha_t::configure<9, VAStatus, VADisplay, VAContextID>(
|
||||
"vaDestroyContext");
|
||||
vaapi_gotcha_t::configure<10, VAStatus, VADisplay, VAContextID>("vaEndPicture");
|
||||
vaapi_gotcha_t::configure<11, VAStatus, VADisplay, VASurfaceID, uint32_t,
|
||||
uint32_t, void*>("vaExportSurfaceHandle");
|
||||
vaapi_gotcha_t::configure<12, VAStatus, VADisplay, VAProfile, VAEntrypoint,
|
||||
VAConfigAttrib*, int>("vaGetConfigAttributes");
|
||||
vaapi_gotcha_t::configure<13, VAStatus, VADisplay, int*, int*>("vaInitialize");
|
||||
vaapi_gotcha_t::configure<14, VAStatus, VADisplay, VAProfile, VAEntrypoint*,
|
||||
int*>("vaQueryConfigEntrypoints");
|
||||
vaapi_gotcha_t::configure<15, VAStatus, VADisplay, VAConfigID, VASurfaceAttrib*,
|
||||
unsigned int*>("vaQuerySurfaceAttributes");
|
||||
vaapi_gotcha_t::configure<16, VAStatus, VADisplay, VASurfaceID, VASurfaceStatus*>(
|
||||
"vaQuerySurfaceStatus");
|
||||
vaapi_gotcha_t::configure<17, VAStatus, VADisplay, VAContextID, VABufferID*, int>(
|
||||
"vaRenderPicture");
|
||||
vaapi_gotcha_t::configure<18, VAStatus, VADisplay>("vaTerminate");
|
||||
vaapi_gotcha_t::configure<19, int, VADisplay>("vaDisplayIsValid");
|
||||
};
|
||||
}
|
||||
|
||||
void
|
||||
vaapi_gotcha::shutdown()
|
||||
{
|
||||
vaapi_gotcha_t::disable();
|
||||
}
|
||||
|
||||
void
|
||||
vaapi_gotcha::start()
|
||||
{
|
||||
if(!get_vaapi_gotcha().get<vaapi_gotcha_t>()->get_is_running())
|
||||
{
|
||||
configure();
|
||||
get_vaapi_gotcha().start();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vaapi_gotcha::stop()
|
||||
{}
|
||||
|
||||
// vaBeginPicture
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAContextID context, VASurfaceID render_target)
|
||||
{
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"context", context, "render_target",
|
||||
render_target);
|
||||
}
|
||||
|
||||
// vaCreateBuffer
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAContextID context, VABufferType type, unsigned int size,
|
||||
unsigned int num_elements, void* data, VABufferID* buf_id)
|
||||
{
|
||||
category_region<category::vaapi>::start(
|
||||
std::string_view{ _data.tool_id }, "dpy", dpy, "context", context, "buffer_type",
|
||||
type, "size", size, "num_elements", num_elements, "data", data, "buf_id", buf_id);
|
||||
}
|
||||
|
||||
// vaCreateConfig
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAProfile profile, VAEntrypoint entrypoint,
|
||||
VAConfigAttrib* attrib_list, int num_attribs, VAConfigID* config_id)
|
||||
{
|
||||
(void) attrib_list; // unused
|
||||
category_region<category::vaapi>::start(
|
||||
std::string_view{ _data.tool_id }, "dpy", dpy, "profile", profile, "entrypoint",
|
||||
entrypoint, "num_attribs", num_attribs, "config_id", config_id);
|
||||
}
|
||||
|
||||
// vaCreateContext
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAConfigID config_id, int picture_width, int picture_height, int flag,
|
||||
VASurfaceID* render_targets, int num_render_targets,
|
||||
VAContextID* context)
|
||||
{
|
||||
category_region<category::vaapi>::start(
|
||||
std::string_view{ _data.tool_id }, "dpy", dpy, "config_id", config_id,
|
||||
"picture_width", picture_width, "picture_height", picture_height, "flag", flag,
|
||||
"render_targets", render_targets, "num_render_targets", num_render_targets,
|
||||
"context", context);
|
||||
}
|
||||
|
||||
// vaCreateSurfaces
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
unsigned int format, unsigned int width, unsigned int height,
|
||||
VASurfaceID* surfaces, unsigned int num_surfaces,
|
||||
VASurfaceAttrib* attrib_list, unsigned int num_attribs)
|
||||
{
|
||||
(void) attrib_list; // unused
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"format", format, "width", width, "height",
|
||||
height, "surfaces", surfaces, "num_surfaces",
|
||||
num_surfaces, "num_attribs", num_attribs);
|
||||
}
|
||||
|
||||
// vaDestroyBuffer
|
||||
// vaDestroyConfig
|
||||
// vaDestroyContext
|
||||
// vaEndPicture
|
||||
// vaSyncSurface
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAContextID context)
|
||||
{
|
||||
if(_data.tool_id == "vaDestroyBuffer")
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
|
||||
dpy, "buffer_id", context);
|
||||
else if(_data.tool_id == "vaDestroyConfig")
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
|
||||
dpy, "config_id", context);
|
||||
else if(_data.tool_id == "vaDestroyContext")
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
|
||||
dpy, "context", context);
|
||||
else if(_data.tool_id == "vaEndPicture")
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
|
||||
dpy, "context", context);
|
||||
else if(_data.tool_id == "vaSyncSurface")
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
|
||||
dpy, "render_target", context);
|
||||
}
|
||||
|
||||
// vaDestroySurfaces
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VASurfaceID* surfaces, int num_surfaces)
|
||||
{
|
||||
(void) surfaces; // unused
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"num_surfaces", num_surfaces);
|
||||
}
|
||||
|
||||
// vaExportSurfaceHandle
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VASurfaceID surface_id, uint32_t mem_type, uint32_t flags,
|
||||
void* descriptor)
|
||||
{
|
||||
category_region<category::vaapi>::start(
|
||||
std::string_view{ _data.tool_id }, "dpy", dpy, "surface_id", surface_id,
|
||||
"mem_type", mem_type, "flags", flags, "descriptor", descriptor);
|
||||
}
|
||||
|
||||
// vaGetConfigAttributes
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAProfile profile, VAEntrypoint entrypoint,
|
||||
VAConfigAttrib* attrib_list, int num_attribs)
|
||||
{
|
||||
(void) attrib_list; // unused
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"profile", profile, "entrypoint", entrypoint,
|
||||
"num_attribs", num_attribs);
|
||||
}
|
||||
|
||||
// vaInitialize
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
int* major_version, int* minor_version)
|
||||
{
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"major_version", major_version,
|
||||
"minor_version", minor_version);
|
||||
}
|
||||
|
||||
// vaQueryConfigEntrypoints
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAProfile profile, VAEntrypoint* entrypoint_list,
|
||||
int* num_entrypoints)
|
||||
{
|
||||
category_region<category::vaapi>::start(
|
||||
std::string_view{ _data.tool_id }, "dpy", dpy, "profile", profile,
|
||||
"entrypoint_list", entrypoint_list, "num_entrypoints", num_entrypoints);
|
||||
}
|
||||
|
||||
// vaQuerySurfaceAttributes
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAConfigID config, VASurfaceAttrib* attrib_list,
|
||||
unsigned int* num_attribs)
|
||||
{
|
||||
(void) attrib_list; // unused
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"config", config, "num_attribs", num_attribs);
|
||||
}
|
||||
|
||||
// vaQuerySurfaceStatus
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VASurfaceID render_target, VASurfaceStatus* status)
|
||||
{
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"render_target", render_target, "status",
|
||||
status);
|
||||
}
|
||||
|
||||
// vaRenderPicture
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAContextID context, VABufferID* buffers, int num_buffers)
|
||||
{
|
||||
(void) buffers; // unused
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy", dpy,
|
||||
"context", context, "num_buffers",
|
||||
num_buffers);
|
||||
}
|
||||
|
||||
// vaTerminate
|
||||
// vaDisplayIsValid
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::incoming, VADisplay dpy)
|
||||
{
|
||||
category_region<category::vaapi>::start(std::string_view{ _data.tool_id }, "dpy",
|
||||
dpy);
|
||||
}
|
||||
|
||||
void
|
||||
vaapi_gotcha::audit(const gotcha_data& _data, audit::outgoing, VAStatus ret)
|
||||
{
|
||||
category_region<category::vaapi>::stop(std::string_view{ _data.tool_id }, "return",
|
||||
ret);
|
||||
}
|
||||
|
||||
} // namespace component
|
||||
} // namespace rocprofsys
|
||||
|
||||
TIMEMORY_STORAGE_INITIALIZER(rocprofsys::component::vaapi_gotcha)
|
||||
@@ -0,0 +1,122 @@
|
||||
// MIT License
|
||||
//
|
||||
// Copyright (c) 2022-2025 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all
|
||||
// copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
// SOFTWARE.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/common.hpp"
|
||||
#include "core/defines.hpp"
|
||||
#include "core/timemory.hpp"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable : 4200)
|
||||
#endif
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
// Errors due to anonymous struct/union and flexible array member
|
||||
#endif
|
||||
#include "va/va.h"
|
||||
#include "va/va_drm.h"
|
||||
#include "va/va_drmcommon.h"
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include <timemory/components/base.hpp>
|
||||
#include <timemory/components/gotcha/backends.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace rocprofsys
|
||||
{
|
||||
namespace component
|
||||
{
|
||||
struct vaapi_gotcha : tim::component::base<vaapi_gotcha, void>
|
||||
{
|
||||
static constexpr size_t gotcha_capacity = 20;
|
||||
|
||||
using gotcha_data = tim::component::gotcha_data;
|
||||
using exit_func_t = void (*)(int);
|
||||
using abort_func_t = void (*)();
|
||||
|
||||
ROCPROFSYS_DEFAULT_OBJECT(vaapi_gotcha)
|
||||
|
||||
// string id for component
|
||||
static std::string label() { return "vaapi_gotcha"; }
|
||||
|
||||
// generate the gotcha wrappers
|
||||
static void configure();
|
||||
static void shutdown();
|
||||
|
||||
static void start();
|
||||
static void stop();
|
||||
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VAContextID context, VASurfaceID render_target);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VAContextID context, VABufferType type, unsigned int size,
|
||||
unsigned int num_elements, void* data, VABufferID* buf_id);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VAProfile profile, VAEntrypoint entrypoint,
|
||||
VAConfigAttrib* attrib_list, int num_attribs,
|
||||
VAConfigID* config_id);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VAConfigID config_id, int picture_width, int picture_height,
|
||||
int flag, VASurfaceID* render_targets, int num_render_targets,
|
||||
VAContextID* context);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
unsigned int format, unsigned int width, unsigned int height,
|
||||
VASurfaceID* surfaces, unsigned int num_surfaces,
|
||||
VASurfaceAttrib* attrib_list, unsigned int num_attribs);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VASurfaceID* surfaces, int num_surfaces);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VAContextID context);
|
||||
static void audit(const gotcha_data&, audit::incoming, VADisplay dpy,
|
||||
VASurfaceID surface_id, uint32_t mem_type, uint32_t flags,
|
||||
void* descriptor);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAProfile profile, VAEntrypoint entrypoint,
|
||||
VAConfigAttrib* attrib_list, int num_attribs);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
int* major_version, int* minor_version);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAProfile profile, VAEntrypoint* entrypoint_list,
|
||||
int* num_entrypoints);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAConfigID config, VASurfaceAttrib* attrib_list,
|
||||
unsigned int* num_attribs);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VASurfaceID render_target, VASurfaceStatus* status);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy,
|
||||
VAContextID context, VABufferID* buffers, int num_buffers);
|
||||
static void audit(const gotcha_data& _data, audit::incoming, VADisplay dpy);
|
||||
|
||||
static void audit(const gotcha_data&, audit::outgoing, VAStatus);
|
||||
};
|
||||
} // namespace component
|
||||
|
||||
using vaapi_bundle_t = tim::component_bundle<category::vaapi, component::vaapi_gotcha>;
|
||||
using vaapi_gotcha_t = tim::component::gotcha<component::vaapi_gotcha::gotcha_capacity,
|
||||
vaapi_bundle_t, category::vaapi>;
|
||||
} // namespace rocprofsys
|
||||
@@ -473,7 +473,6 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
|
||||
if(record.phase == ROCPROFILER_CALLBACK_PHASE_ENTER)
|
||||
{
|
||||
user_data->value = ts;
|
||||
|
||||
switch(record.kind)
|
||||
{
|
||||
case ROCPROFILER_CALLBACK_TRACING_HSA_CORE_API:
|
||||
@@ -498,6 +497,15 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
|
||||
user_data, ts);
|
||||
break;
|
||||
}
|
||||
#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
|
||||
ROCPROFILER_VERSION_MAJOR >= 1
|
||||
case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API:
|
||||
{
|
||||
tool_tracing_callback_start(category::rocm_rocdecode_api{}, record,
|
||||
user_data, ts);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ROCPROFILER_CALLBACK_TRACING_NONE:
|
||||
case ROCPROFILER_CALLBACK_TRACING_LAST:
|
||||
case ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API:
|
||||
@@ -523,6 +531,7 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
|
||||
constexpr bool bt_with_signal_frame = true;
|
||||
|
||||
auto _bt_data = std::optional<backtrace_entry_vec_t>{};
|
||||
|
||||
if(config::get_use_perfetto() && config::get_perfetto_annotations() &&
|
||||
tool_data->backtrace_operations.at(record.kind).count(record.operation) > 0)
|
||||
{
|
||||
@@ -567,6 +576,15 @@ tool_tracing_callback(rocprofiler_callback_tracing_record_t record,
|
||||
ts, _bt_data);
|
||||
break;
|
||||
}
|
||||
#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
|
||||
ROCPROFILER_VERSION_MAJOR >= 1
|
||||
case ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API:
|
||||
{
|
||||
tool_tracing_callback_stop(category::rocm_rocdecode_api{}, record,
|
||||
user_data, ts, _bt_data);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ROCPROFILER_CALLBACK_TRACING_NONE:
|
||||
case ROCPROFILER_CALLBACK_TRACING_LAST:
|
||||
case ROCPROFILER_CALLBACK_TRACING_MARKER_CONTROL_API:
|
||||
@@ -991,13 +1009,19 @@ tool_init(rocprofiler_client_finalize_t fini_func, void* user_data)
|
||||
_data->primary_ctx, ROCPROFILER_CALLBACK_TRACING_CODE_OBJECT, nullptr, 0,
|
||||
tool_code_object_callback, _data));
|
||||
|
||||
for(auto itr : { 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 })
|
||||
for(auto itr : {
|
||||
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,
|
||||
#if(ROCPROFILER_VERSION_MAJOR == 0 && ROCPROFILER_VERSION_MINOR >= 6) || \
|
||||
ROCPROFILER_VERSION_MAJOR >= 1
|
||||
ROCPROFILER_CALLBACK_TRACING_ROCDECODE_API,
|
||||
#endif
|
||||
ROCPROFILER_CALLBACK_TRACING_MARKER_CORE_API
|
||||
})
|
||||
{
|
||||
if(_callback_domains.count(itr) > 0)
|
||||
{
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "library/components/mpi_gotcha.hpp"
|
||||
#include "library/components/numa_gotcha.hpp"
|
||||
#include "library/components/pthread_gotcha.hpp"
|
||||
#include "library/components/vaapi_gotcha.hpp"
|
||||
#include "library/thread_data.hpp"
|
||||
|
||||
#include <timemory/backends/threading.hpp>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* va_drm.h - Raw DRM API
|
||||
*
|
||||
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef VA_DRM_H
|
||||
#define VA_DRM_H
|
||||
|
||||
#include <va/va.h>
|
||||
|
||||
/**
|
||||
* \file va_drm.h
|
||||
* \brief The raw DRM API
|
||||
*
|
||||
* This file contains the \ref api_drm "Raw DRM API".
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Returns a VA display derived from the specified DRM connection.
|
||||
*
|
||||
* This function returns a (possibly cached) VA display from the
|
||||
* specified DRM connection @fd.
|
||||
*
|
||||
* @param[in] fd the DRM connection descriptor
|
||||
* @return the VA display
|
||||
*/
|
||||
VADisplay vaGetDisplayDRM(int fd);
|
||||
|
||||
/**@}*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* VA_DRM_H */
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* va_drmcommon.h - Common utilities for DRM-based drivers
|
||||
*
|
||||
* Copyright (c) 2012 Intel Corporation. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef VA_DRM_COMMON_H
|
||||
#define VA_DRM_COMMON_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/** \brief DRM authentication type. */
|
||||
enum
|
||||
{
|
||||
/** \brief Disconnected. */
|
||||
VA_DRM_AUTH_NONE = 0,
|
||||
/**
|
||||
* \brief Connected. Authenticated with DRI1 protocol.
|
||||
*
|
||||
* @deprecated
|
||||
* This is a deprecated authentication type. All DRI-based drivers have
|
||||
* been migrated to use the DRI2 protocol. Newly written drivers shall
|
||||
* use DRI2 protocol only, or a custom authentication means. e.g. opt
|
||||
* for authenticating on the VA driver side, instead of libva side.
|
||||
*/
|
||||
VA_DRM_AUTH_DRI1 = 1,
|
||||
/**
|
||||
* \brief Connected. Authenticated with DRI2 protocol.
|
||||
*
|
||||
* This is only useful to VA/X11 drivers. The libva-x11 library provides
|
||||
* a helper function VA_DRI2Authenticate() for authenticating the
|
||||
* connection. However, DRI2 conformant drivers don't need to call that
|
||||
* function since authentication happens on the libva side, implicitly.
|
||||
*/
|
||||
VA_DRM_AUTH_DRI2 = 2,
|
||||
/**
|
||||
* \brief Connected. Authenticated with some alternate raw protocol.
|
||||
*
|
||||
* This authentication mode is mainly used in non-VA/X11 drivers.
|
||||
* Authentication happens through some alternative method, at the
|
||||
* discretion of the VA driver implementation.
|
||||
*/
|
||||
VA_DRM_AUTH_CUSTOM = 3
|
||||
};
|
||||
|
||||
/** \brief Base DRM state. */
|
||||
struct drm_state
|
||||
{
|
||||
/** \brief DRM connection descriptor. */
|
||||
int fd;
|
||||
/** \brief DRM authentication type. */
|
||||
int auth_type;
|
||||
/** \brief Reserved bytes for future use, must be zero */
|
||||
int va_reserved[8];
|
||||
};
|
||||
|
||||
/** \brief Kernel DRM buffer memory type. */
|
||||
#define VA_SURFACE_ATTRIB_MEM_TYPE_KERNEL_DRM 0x10000000
|
||||
/** \brief DRM PRIME memory type (old version)
|
||||
*
|
||||
* This supports only single objects with restricted memory layout.
|
||||
* Used with VASurfaceAttribExternalBuffers.
|
||||
*/
|
||||
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME 0x20000000
|
||||
/** \brief DRM PRIME memory type
|
||||
*
|
||||
* Used with VADRMPRIMESurfaceDescriptor.
|
||||
*/
|
||||
#define VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 0x40000000
|
||||
|
||||
/**
|
||||
* \brief External buffer descriptor for a DRM PRIME surface.
|
||||
*
|
||||
* For export, call vaExportSurfaceHandle() with mem_type set to
|
||||
* VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and pass a pointer to an
|
||||
* instance of this structure to fill.
|
||||
* If VA_EXPORT_SURFACE_SEPARATE_LAYERS is specified on export, each
|
||||
* layer will contain exactly one plane. For example, an NV12
|
||||
* surface will be exported as two layers, one of DRM_FORMAT_R8 and
|
||||
* one of DRM_FORMAT_GR88.
|
||||
* If VA_EXPORT_SURFACE_COMPOSED_LAYERS is specified on export,
|
||||
* there will be exactly one layer.
|
||||
*
|
||||
* For import, call vaCreateSurfaces() with the MemoryType attribute
|
||||
* set to VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 and the
|
||||
* ExternalBufferDescriptor attribute set to point to an array of
|
||||
* num_surfaces instances of this structure.
|
||||
* The number of planes which need to be provided for a given layer
|
||||
* is dependent on both the format and the format modifier used for
|
||||
* the objects containing it. For example, the format DRM_FORMAT_RGBA
|
||||
* normally requires one plane, but with the format modifier
|
||||
* I915_FORMAT_MOD_Y_TILED_CCS it requires two planes - the first
|
||||
* being the main data plane and the second containing the color
|
||||
* control surface.
|
||||
* Note that a given driver may only support a subset of possible
|
||||
* representations of a particular format. For example, it may only
|
||||
* support NV12 surfaces when they are contained within a single DRM
|
||||
* object, and therefore fail to create such surfaces if the two
|
||||
* planes are in different DRM objects.
|
||||
* Note that backend driver will retrieve the resource represent by fd,
|
||||
* and a valid surface ID is generated. Backend driver will not close
|
||||
* the file descriptor. Application should handle the release of the fd.
|
||||
* releasing the fd will not impact the existence of the surface.
|
||||
*/
|
||||
typedef struct _VADRMPRIMESurfaceDescriptor
|
||||
{
|
||||
/** Pixel format fourcc of the whole surface (VA_FOURCC_*). */
|
||||
uint32_t fourcc;
|
||||
/** Width of the surface in pixels. */
|
||||
uint32_t width;
|
||||
/** Height of the surface in pixels. */
|
||||
uint32_t height;
|
||||
/** Number of distinct DRM objects making up the surface. */
|
||||
uint32_t num_objects;
|
||||
/** Description of each object. */
|
||||
struct
|
||||
{
|
||||
/** DRM PRIME file descriptor for this object. */
|
||||
int fd;
|
||||
/** Total size of this object (may include regions which are
|
||||
* not part of the surface). */
|
||||
uint32_t size;
|
||||
/** Format modifier applied to this object. */
|
||||
uint64_t drm_format_modifier;
|
||||
} objects[4];
|
||||
/** Number of layers making up the surface. */
|
||||
uint32_t num_layers;
|
||||
/** Description of each layer in the surface. */
|
||||
struct
|
||||
{
|
||||
/** DRM format fourcc of this layer (DRM_FOURCC_*). */
|
||||
uint32_t drm_format;
|
||||
/** Number of planes in this layer. */
|
||||
uint32_t num_planes;
|
||||
/** Index in the objects array of the object containing each
|
||||
* plane. */
|
||||
uint32_t object_index[4];
|
||||
/** Offset within the object of each plane. */
|
||||
uint32_t offset[4];
|
||||
/** Pitch of each plane. */
|
||||
uint32_t pitch[4];
|
||||
} layers[4];
|
||||
} VADRMPRIMESurfaceDescriptor;
|
||||
|
||||
/**
|
||||
* \brief List of DRM format modifiers.
|
||||
*
|
||||
* To allocate surfaces with one of the modifiers specified in the array, call
|
||||
* vaCreateSurfaces() with the VASurfaceAttribDRMFormatModifiers attribute set
|
||||
* to point to an array of num_surfaces instances of this structure. The driver
|
||||
* will select the optimal modifier in the list.
|
||||
*
|
||||
* DRM format modifiers are defined in drm_fourcc.h in the Linux kernel.
|
||||
*/
|
||||
typedef struct _VADRMFormatModifierList
|
||||
{
|
||||
/** Number of modifiers. */
|
||||
uint32_t num_modifiers;
|
||||
/** Array of modifiers. */
|
||||
uint64_t* modifiers;
|
||||
} VADRMFormatModifierList;
|
||||
|
||||
#endif /* VA_DRM_COMMON_H */
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (C) 2009 Splitted-Desktop Systems. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef VA_VERSION_H
|
||||
#define VA_VERSION_H
|
||||
|
||||
/**
|
||||
* VA_MAJOR_VERSION:
|
||||
*
|
||||
* The major version of VA-API (1, if %VA_VERSION is 1.2.3)
|
||||
*/
|
||||
#define VA_MAJOR_VERSION 1
|
||||
|
||||
/**
|
||||
* VA_MINOR_VERSION:
|
||||
*
|
||||
* The minor version of VA-API (2, if %VA_VERSION is 1.2.3)
|
||||
*/
|
||||
#define VA_MINOR_VERSION 16
|
||||
|
||||
/**
|
||||
* VA_MICRO_VERSION:
|
||||
*
|
||||
* The micro version of VA-API (3, if %VA_VERSION is 1.2.3)
|
||||
*/
|
||||
#define VA_MICRO_VERSION 0
|
||||
|
||||
/**
|
||||
* VA_VERSION:
|
||||
*
|
||||
* The full version of VA-API, like 1.2.3
|
||||
*/
|
||||
#define VA_VERSION 1.16.0
|
||||
|
||||
/**
|
||||
* VA_VERSION_S:
|
||||
*
|
||||
* The full version of VA-API, in string form (suited for string
|
||||
* concatenation)
|
||||
*/
|
||||
#define VA_VERSION_S "1.16.0"
|
||||
|
||||
/**
|
||||
* VA_VERSION_HEX:
|
||||
*
|
||||
* Numerically encoded version of VA-API, like 0x010203
|
||||
*/
|
||||
#define VA_VERSION_HEX \
|
||||
((VA_MAJOR_VERSION << 24) | (VA_MINOR_VERSION << 16) | (VA_MICRO_VERSION << 8))
|
||||
|
||||
/**
|
||||
* VA_CHECK_VERSION:
|
||||
* @major: major version, like 1 in 1.2.3
|
||||
* @minor: minor version, like 2 in 1.2.3
|
||||
* @micro: micro version, like 3 in 1.2.3
|
||||
*
|
||||
* Evaluates to %TRUE if the version of VA-API is greater than
|
||||
* @major, @minor and @micro
|
||||
*/
|
||||
#define VA_CHECK_VERSION(major, minor, micro) \
|
||||
(VA_MAJOR_VERSION > (major) || \
|
||||
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION > (minor)) || \
|
||||
(VA_MAJOR_VERSION == (major) && VA_MINOR_VERSION == (minor) && \
|
||||
VA_MICRO_VERSION >= (micro)))
|
||||
|
||||
#endif /* VA_VERSION_H */
|
||||
@@ -9,12 +9,14 @@ rocprofiler_systems_add_test(
|
||||
NAME videodecode
|
||||
TARGET videodecode
|
||||
GPU ON
|
||||
ENVIRONMENT
|
||||
"${_base_environment};ROCPROFSYS_ROCM_DOMAINS=hip_runtime_api,kernel_dispatch,memory_copy,rocdecode_api"
|
||||
RUN_ARGS -i ${PROJECT_BINARY_DIR}/videos -t 1
|
||||
LABELS "videodecode")
|
||||
|
||||
rocprofiler_systems_add_validation_test(
|
||||
NAME videodecode-sampling
|
||||
PERFETTO_METRIC "host"
|
||||
PERFETTO_METRIC "rocm_rocdecode_api"
|
||||
PERFETTO_FILE "perfetto-trace.proto"
|
||||
LABELS "videodecode"
|
||||
ARGS -l videodecode -c 1 -d 0 --counter-names "GPU VCN Activity")
|
||||
ARGS -l rocDecCreateVideoParser -c 2 -d 1 --counter-names "GPU VCN Activity")
|
||||
|
||||
@@ -191,7 +191,7 @@ if __name__ == "__main__":
|
||||
total_value = 0
|
||||
for row in sum_counter_values:
|
||||
total_value = row.total_value if row.total_value is not None else -1
|
||||
if total_value < 0:
|
||||
if total_value <= 0:
|
||||
ret = 1
|
||||
|
||||
if ret == 0:
|
||||
|
||||
Viittaa uudesa ongelmassa
Block a user