PC sampling: online partial PC sampling decoding (#1004)
* PC sampling: online partial PC sampling decoding PC sampling service decodes a PC sample partially by replacing the PC with an id of the loaded code object instance containing PC and the offset of the PC within that code object instance. * PC sampling: marker records removed * PC sampling parser: minor doc update in mock * PC sampling: introducing rocprofiler_pc_t * NULL value of the code object id introduced. * Clarifying documenation related to PC offset. * PC offset documentation improvement * PC sampling parser benchmark: Reducing the number of samples to recreate half of performance.
이 커밋은 다음에 포함됨:
@@ -130,6 +130,11 @@ typedef struct
|
||||
};
|
||||
} rocprofiler_callback_tracing_code_object_load_data_t;
|
||||
|
||||
/**
|
||||
* @brief The NULL value of a code object id. Used when code object is unknown.
|
||||
*/
|
||||
#define ROCPROFILER_CODE_OBJECT_ID_NONE ROCPROFILER_UINT64_C(0)
|
||||
|
||||
/**
|
||||
* @brief ROCProfiler Code Object Kernel Symbol Tracer Callback Record.
|
||||
*
|
||||
|
||||
@@ -411,9 +411,7 @@ typedef enum
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_PC_SAMPLING_RECORD_NONE = 0,
|
||||
ROCPROFILER_PC_SAMPLING_RECORD_SAMPLE, ///< ::rocprofiler_pc_sampling_record_t
|
||||
ROCPROFILER_PC_SAMPLING_RECORD_CODE_OBJECT_LOAD_MARKER, ///< ::rocprofiler_pc_sampling_code_object_load_marker_t
|
||||
ROCPROFILER_PC_SAMPLING_RECORD_CODE_OBJECT_UNLOAD_MARKER, ///< ::rocprofiler_pc_sampling_code_object_unload_marker_t
|
||||
ROCPROFILER_PC_SAMPLING_RECORD_SAMPLE, ///< ::rocprofiler_pc_sampling_record_t
|
||||
ROCPROFILER_PC_SAMPLING_RECORD_LAST,
|
||||
} rocprofiler_pc_sampling_record_kind_t;
|
||||
|
||||
|
||||
@@ -239,6 +239,31 @@ typedef struct
|
||||
uint32_t arb_state_stall : 10;
|
||||
} rocprofiler_pc_sampling_snapshot_v1_t;
|
||||
|
||||
/**
|
||||
* @brief Sampled program counter.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t loaded_code_object_id;
|
||||
uint64_t loaded_code_object_offset;
|
||||
|
||||
/// @var loaded_code_object_id
|
||||
/// @brief id of the loaded code object instance that contains sampled PC.
|
||||
/// This fields holds the value ::ROCPROFILER_CODE_OBJECT_ID_NONE
|
||||
/// if the code object cannot be determined
|
||||
/// (e.g., sampled PC belongs to code generated by self modifying code).
|
||||
/// @var loaded_code_object_offset
|
||||
/// @brief If @ref loaded_code_object_id is different than ::ROCPROFILER_CODE_OBJECT_ID_NONE,
|
||||
/// then this field contains the offset of the sampled PC relative to the
|
||||
/// ::rocprofiler_callback_tracing_code_object_load_data_t::load_base
|
||||
/// of the code object instance with @ref loaded_code_object_id.
|
||||
/// To calculate the original virtual address of the sampled PC, one can add the value
|
||||
/// of this field to the ::rocprofiler_callback_tracing_code_object_load_data_t::load_base.
|
||||
/// The value of @ref loaded_code_object_offset matches
|
||||
/// the virtual address of the sampled instruction (PC), only if the
|
||||
/// @ref loaded_code_object_id is equal to the ::ROCPROFILER_CODE_OBJECT_ID_NONE.
|
||||
} rocprofiler_pc_t;
|
||||
|
||||
// TODO: The definition of this structure might change over time
|
||||
// to reduce the space needed to represent a single sample.
|
||||
/**
|
||||
@@ -253,12 +278,12 @@ typedef struct
|
||||
uint8_t wave_issued : 1;
|
||||
uint8_t reserved : 7; ///< reserved 7 bits, must be zero
|
||||
uint32_t hw_id; ///< compute unit identifier
|
||||
uint64_t pc; ///< Program counter of the wave of the moment of interruption
|
||||
uint64_t exec_mask;
|
||||
rocprofiler_dim3_t workgroup_id; ///< wave coordinates within the workgroup
|
||||
uint32_t wave_count;
|
||||
uint64_t timestamp; ///< timestamp when sample is generated
|
||||
rocprofiler_correlation_id_t correlation_id;
|
||||
rocprofiler_pc_t pc; ///< information about sampled program counter
|
||||
uint64_t exec_mask;
|
||||
rocprofiler_dim3_t workgroup_id; ///< wave coordinates within the workgroup
|
||||
uint32_t wave_count;
|
||||
uint64_t timestamp; ///< timestamp when sample is generated
|
||||
rocprofiler_correlation_id_t correlation_id;
|
||||
rocprofiler_pc_sampling_snapshot_v1_t
|
||||
snapshot; ///< @see ::rocprofiler_pc_sampling_snapshot_v1_t
|
||||
uint32_t reserved2; ///< for future use
|
||||
@@ -274,42 +299,18 @@ typedef struct
|
||||
/// @var wave_count
|
||||
/// @brief number of active waves on the CU at the moment of sample generation
|
||||
/// @var correlation_id
|
||||
/// @brief correlation id of the API call that initiated kernel launch.
|
||||
/// The interrupted wave is executed as part of the kernel.
|
||||
/// @brief correlation id of the API call that initiated a dispatch of the kernel
|
||||
/// during whose execution the wave was interrupted at @ref pc.
|
||||
} rocprofiler_pc_sampling_record_t;
|
||||
|
||||
/**
|
||||
* @brief Marker representing code object loading event.
|
||||
*
|
||||
* @see rocprofiler_callback_tracing_code_object_load_data_t
|
||||
* for more information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t size; ///< Size of this struct
|
||||
uint64_t code_object_id; /// unique code object identifier
|
||||
} rocprofiler_pc_sampling_code_object_load_marker_t;
|
||||
|
||||
/**
|
||||
* @brief Marker representing code object unloading event.
|
||||
*
|
||||
* @see rocprofiler_callback_tracing_code_object_load_data_t
|
||||
* for more information
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint64_t size; ///< Size of this struct
|
||||
uint64_t code_object_id; /// unique code object identifier
|
||||
} rocprofiler_pc_sampling_code_object_unload_marker_t;
|
||||
|
||||
/** @} */
|
||||
|
||||
ROCPROFILER_EXTERN_C_FINI
|
||||
|
||||
ROCPROFILER_CXX_CODE(
|
||||
static_assert(sizeof(rocprofiler_pc_sampling_record_t) == 80,
|
||||
static_assert(sizeof(rocprofiler_pc_sampling_record_t) == 88,
|
||||
"Increasing the size of the pc sampling record is not permitted."));
|
||||
|
||||
ROCPROFILER_CXX_CODE(static_assert(offsetof(rocprofiler_pc_sampling_record_t, chiplet) == 9 &&
|
||||
offsetof(rocprofiler_pc_sampling_record_t, reserved2) == 76,
|
||||
offsetof(rocprofiler_pc_sampling_record_t, reserved2) == 84,
|
||||
"PC sampling record layout changed."));
|
||||
|
||||
새 이슈에서 참조
사용자 차단