Shared Library Constructor (rocprofv3 deadlock fix) (#599)
* Moved tests/apps to tests/bin * Renamed cmake project in tests/bin * Update samples - Use ROCPROFILER_DEFAULT_FAIL_REGEX - tweaks to stdout messages * Update tests - Use ROCPROFILER_DEFAULT_FAIL_REGEX * Add tests/lib - libraries with HIP code * Update PTL submodule - remove atexit delete of thread_id_map * Update cmake/rocprofiler_options.cmake - Set ROCPROFILER_DEFAULT_FAIL_REGEX * Update common lib: env + logging - improved customization of logging settings - default to disabling logging to files - install failure handler for rocprofv3 - set_env support in environment.* * Add lib/rocprofiler-sdk/shared_library.cpp - shared library constructor * Update lib/rocprofiler-sdk-tool/tool.cpp - destructor thread safety - convert callback_name_info and buffered_name_info to pointers - install failure handler for logging * Add tests/bin/hip-in-libraries - hip-in-libraries is an exe which uses two shared libraries where each shared library contains HIP kernels - used for testing deadlocking within __hipRegisterFatBinary * Update bin/rocprofv3 - reorganized the env variables - use exec to launch command - set ROCPROFILER_LIBRARY_CTOR=1 * Add tests/rocprofv3/tracing-hip-in-libraries - uses hip-in-libraries exe for exe which uses shared libraries to launch HIP kernels * Update bin/rocprofv3 - fix counter collection (no exec) * Update lib/rocprofiler-sdk-tool/tool.cpp - replace "Kernel-Name" with "Kernel_Name" * Update lib/rocprofiler-sdk/registration.cpp Use RTLD_LOCAL instead of RTLD_GLOBAL for env libraries * Update tests/rocprofv3 - replace "Kernel-Name" with "Kernel_Name" * Update tests - vector-ops (bin) stream syncs + runs with 4 queues per device - improve counter-collection/input1 validation - rocprofv3/tracing-hip-in-libraries does not do sys-trace - improved validation script for tracing-hip-in-libraries - updated dispatch_callback in json-tool.cpp following reworking of prototypes for counter collection * Update samples/counter_collection - updated dispatch_callback(s) and record_callback(s) following reworking of prototypes * Update bin/rocprofv3 - reorganized help menu - added options for sub-HSA tables - added --hip-runtime-trace - changed --hip-trace to include --hip-compiler-trace * Update lib/rocprofiler-sdk-tool - improved kernel filtering - removed arch_vgpr, accum_vgpr, sgpr code (in rocprofiler-sdk) - fixed issue with counter-collection w/o tracing - added support for fine grained HSA API tracing - removed directly linking to HSA-runtime * Update lib/rocprofiler-sdk/agent.cpp - rocp_agents != hsa_agents is non-fatal when ROCPROFILER_BUILD_CI=OFF (CMake option) * GPR (vector and scalar) info in kernel symbol data - rocprofiler_callback_tracing_code_object_kernel_symbol_register_data_t contains general purpose register info * Header include order fix - Include repo headers first - Third party library headers next - standard library headers last * Update dispatch profiling public API - introduce rocprofiler_profile_counting_dispatch_data_t - change signature of rocprofiler_profile_counting_dispatch_callback_t and rocprofiler_profile_counting_record_callback_t - provide rocprofiler_user_data_t pointer in dispatch callback - provide rocprofiler_user_data_t value (from dispatch cb) in record callback * Update tests/bin/CMakeLists.txt - fix add_subdirectory(hip-in-libraries) order * Update VERSION - bump to 0.2.0 in prep for AFAR
This commit is contained in:
committed by
GitHub
parent
665c546e65
commit
7b6d3c70bd
@@ -30,6 +30,8 @@
|
||||
|
||||
#include <hsa/hsa_ven_amd_loader.h>
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
ROCPROFILER_EXTERN_C_INIT
|
||||
|
||||
/**
|
||||
@@ -141,9 +143,14 @@ typedef struct
|
||||
uint32_t kernarg_segment_alignment; ///< Alignment (in bytes) of the buffer used to pass
|
||||
///< arguments to the kernel
|
||||
uint32_t group_segment_size; ///< Size of static group segment memory required by the kernel
|
||||
///< (per work-group), in bytes
|
||||
///< (per work-group), in bytes. AKA: LDS size
|
||||
uint32_t private_segment_size; ///< Size of static private, spill, and arg segment memory
|
||||
///< required by this kernel (per work-item), in bytes.
|
||||
///< required by this kernel (per work-item), in bytes. AKA:
|
||||
///< scratch size
|
||||
uint32_t sgpr_count; ///< Scalar general purpose register count
|
||||
uint32_t arch_vgpr_count; ///< Architecture vector general purpose register count
|
||||
uint32_t accum_vgpr_count; ///< Accum vector general purpose register count
|
||||
|
||||
} rocprofiler_callback_tracing_code_object_kernel_symbol_register_data_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,6 +37,23 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Kernel dispatch data for profile counting callbacks
|
||||
*
|
||||
*/
|
||||
typedef struct rocprofiler_profile_counting_dispatch_data_t
|
||||
{
|
||||
uint64_t size; ///< Size of this struct
|
||||
rocprofiler_kernel_id_t kernel_id; ///< Kernel identifier
|
||||
rocprofiler_agent_id_t agent_id; ///< Agent ID where kernel is launched
|
||||
rocprofiler_queue_id_t queue_id; ///< Queue ID where kernel packet is enqueued
|
||||
rocprofiler_correlation_id_t correlation_id; ///< Correlation ID for this dispatch
|
||||
uint32_t private_segment_size; /// runtime private memory segment size
|
||||
uint32_t group_segment_size; /// runtime group memory segment size
|
||||
rocprofiler_dim3_t workgroup_size; /// runtime workgroup size (grid * threads)
|
||||
rocprofiler_dim3_t grid_size; /// runtime grid size
|
||||
} rocprofiler_profile_counting_dispatch_data_t;
|
||||
|
||||
/**
|
||||
* @brief Kernel Dispatch Callback. This is a callback that is invoked before the kernel
|
||||
* is enqueued into the HSA queue. What counters to collect for a kernel are set
|
||||
@@ -44,22 +61,35 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
* will be collected and emplaced in the buffer with @ref rocprofiler_buffer_id_t used when
|
||||
* setting up this callback.
|
||||
*
|
||||
* @param [in] queue_id Queue the kernel dispatch packet is being enqueued onto
|
||||
* @param [in] agent Agent of this queue
|
||||
* @param [in] correlation_id Correlation ID for this dispatch
|
||||
* @param [in] dispatch_packet Kernel dispatch packet about to be enqueued into HSA
|
||||
* @param [in] kernel_id Kernel identifier
|
||||
* @param [in] dispatch_data @see ::rocprofiler_profile_counting_dispatch_data_t
|
||||
* @param [out] config Profile config detailing the counters to collect for this kernel
|
||||
* @param [out] user_data User data unique to this dispatch. Returned in record callback
|
||||
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
|
||||
* @param [out] config Profile config detailing the counters to collect for this kernel
|
||||
*/
|
||||
typedef void (*rocprofiler_profile_counting_dispatch_callback_t)(
|
||||
rocprofiler_queue_id_t queue_id,
|
||||
const rocprofiler_agent_t* agent,
|
||||
rocprofiler_correlation_id_t correlation_id,
|
||||
const hsa_kernel_dispatch_packet_t* dispatch_packet,
|
||||
uint64_t kernel_id,
|
||||
void* callback_data_args,
|
||||
rocprofiler_profile_config_id_t* config);
|
||||
rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
rocprofiler_profile_config_id_t* config,
|
||||
rocprofiler_user_data_t* user_data,
|
||||
void* callback_data_args);
|
||||
|
||||
/**
|
||||
* @brief Counting record callback. This is a callback is invoked when the kernel
|
||||
* execution is complete and contains the counter profile data requested in
|
||||
* @ref rocprofiler_profile_counting_dispatch_callback_t. Only used with
|
||||
* @ref rocprofiler_configure_callback_dispatch_profile_counting_service.
|
||||
*
|
||||
* @param [in] dispatch_data @see ::rocprofiler_profile_counting_dispatch_data_t
|
||||
* @param [in] record_data Counter record data.
|
||||
* @param [in] record_count Number of counter records.
|
||||
* @param [in] user_data User data instance from dispatch callback
|
||||
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
|
||||
*/
|
||||
typedef void (*rocprofiler_profile_counting_record_callback_t)(
|
||||
rocprofiler_profile_counting_dispatch_data_t dispatch_data,
|
||||
rocprofiler_record_counter_t* record_data,
|
||||
size_t record_count,
|
||||
rocprofiler_user_data_t user_data,
|
||||
void* callback_data_args);
|
||||
|
||||
/**
|
||||
* @brief Configure buffered dispatch profile Counting Service.
|
||||
@@ -95,29 +125,6 @@ rocprofiler_configure_buffered_dispatch_profile_counting_service(
|
||||
rocprofiler_profile_counting_dispatch_callback_t callback,
|
||||
void* callback_data_args);
|
||||
|
||||
/**
|
||||
* @brief Counting record callback. This is a callback is invoked when the kernel
|
||||
* execution is complete and contains the counter profile data requested in
|
||||
* @ref rocprofiler_profile_counting_dispatch_callback_t. Only used with
|
||||
* @ref rocprofiler_configure_callback_dispatch_profile_counting_service.
|
||||
*
|
||||
* @param [in] queue_id Queue the kernel dispatch packet is being enqueued onto
|
||||
* @param [in] agent Agent of this queue
|
||||
* @param [in] correlation_id Correlation ID for this dispatch
|
||||
* @param [in] kernel_id Kernel identifier
|
||||
* @param [in] callback_data_args Callback supplied via buffered_dispatch_profile_counting_service
|
||||
* @param [in] record_count Number of counter records.
|
||||
* @param [in] record_data Counter record data.
|
||||
*/
|
||||
typedef void (*rocprofiler_profile_counting_record_callback_t)(
|
||||
rocprofiler_queue_id_t queue_id,
|
||||
rocprofiler_agent_id_t agent,
|
||||
rocprofiler_correlation_id_t correlation_id,
|
||||
uint64_t kernel_id,
|
||||
void* callback_data_args,
|
||||
size_t record_count,
|
||||
rocprofiler_record_counter_t* record_data);
|
||||
|
||||
/**
|
||||
* @brief Configure buffered dispatch profile Counting Service.
|
||||
* Collects the counters in dispatch packets and calls a callback
|
||||
|
||||
@@ -261,26 +261,16 @@ typedef enum
|
||||
ROCPROFILER_TABLE_LAST = ROCPROFILER_MARKER_NAME_TABLE,
|
||||
} rocprofiler_intercept_table_t;
|
||||
|
||||
/**
|
||||
* @brief Enumeration for specifying the data type contained within the union.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_UNION_TYPE_NONE = 0, ///< No union type
|
||||
ROCPROFILER_UNION_TYPE_STRING, ///< String Type set
|
||||
ROCPROFILER_UNION_TYPE_INT, ///< Integer Type Set
|
||||
ROCPROFILER_UNION_TYPE_LAST,
|
||||
} rocprofiler_union_type_t;
|
||||
|
||||
/**
|
||||
* @brief Enumeration for specifying the counter info struct version you want.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_COUNTER_INFO_VERSION_NONE,
|
||||
ROCPROFILER_COUNTER_INFO_VERSION_0, ///< @see rocprofiler_counter_info_v0_t
|
||||
ROCPROFILER_COUNTER_INFO_VERSION_0, ///< @see ::rocprofiler_counter_info_v0_t
|
||||
ROCPROFILER_COUNTER_INFO_VERSION_LAST,
|
||||
} rocprofiler_counter_info_version_id_t;
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
//
|
||||
// ALIASES
|
||||
|
||||
Reference in New Issue
Block a user