Enable ATT continuous mode and code object tracing registration (#850)
* Adding ATT continuous mode and ATT code object tracking * Fixing aql_packet.cpp * Updating to aqlprofile codeobj changes * Removing kernel packet from ATT dispatch callback * Changing getSymbolMap() to return relative vaddr * Tidy fixes * Formatting * Fix shadowing * Fixing packet test * Updating tests * Simplifying multi-agent traces * Adding dynamic codeobj tracking * leftover book-keeping for codeobj markers * Formatting * Formatting * Temporary removing codeobj marker * Formatting * Re-enabling codeobj tracking * Making copy of coreapi table * Fixing issues with toolData lifetile * Formatting * Fixing issues with ASAN * Improving memory profile * Removing misplaced annotation * Fixing queue type and allowing shared_locks in globalThreadTracer * Update logging * Changing ATT formats to be more in line with the SDk (#883) * Fixing some merge conflicts * Fixing cmakelists * Fixing merge conflicts * Formatting
This commit is contained in:
committed by
GitHub
parent
2225153c23
commit
1b95089c28
+23
-29
@@ -309,7 +309,8 @@ private:
|
||||
class CodeobjMap
|
||||
{
|
||||
public:
|
||||
CodeobjMap() = default;
|
||||
CodeobjMap() = default;
|
||||
virtual ~CodeobjMap() = default;
|
||||
|
||||
virtual void addDecoder(const char* filepath,
|
||||
codeobj_marker_id_t id,
|
||||
@@ -357,7 +358,8 @@ class CodeobjAddressTranslate : public CodeobjMap
|
||||
using Super = CodeobjMap;
|
||||
|
||||
public:
|
||||
CodeobjAddressTranslate() = default;
|
||||
CodeobjAddressTranslate() = default;
|
||||
~CodeobjAddressTranslate() override = default;
|
||||
|
||||
virtual void addDecoder(const char* filepath,
|
||||
codeobj_marker_id_t id,
|
||||
@@ -409,39 +411,31 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void getSymbolMap(const std::shared_ptr<LoadedCodeobjDecoder>& dec,
|
||||
std::unordered_map<uint64_t, SymbolInfo>& symbols) const
|
||||
std::map<uint64_t, SymbolInfo> getSymbolMap() const
|
||||
{
|
||||
try
|
||||
std::map<uint64_t, SymbolInfo> symbols;
|
||||
|
||||
for(auto& [_, dec] : decoders)
|
||||
{
|
||||
auto& smap = dec->getSymbolMap();
|
||||
for(auto& [vaddr, sym] : smap)
|
||||
symbols[vaddr + dec->load_addr] = sym;
|
||||
} catch(std::exception& e)
|
||||
}
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
std::map<uint64_t, SymbolInfo> getSymbolMap(codeobj_marker_id_t id) const
|
||||
{
|
||||
if(decoders.find(id) == decoders.end()) return {};
|
||||
|
||||
try
|
||||
{
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
std::unordered_map<uint64_t, SymbolInfo> getSymbolMap() const
|
||||
{
|
||||
std::unordered_map<uint64_t, SymbolInfo> symbols;
|
||||
|
||||
for(auto& [_, dec] : decoders)
|
||||
this->getSymbolMap(dec, symbols);
|
||||
|
||||
return symbols;
|
||||
}
|
||||
|
||||
std::unordered_map<uint64_t, SymbolInfo> getSymbolMap(codeobj_marker_id_t id) const
|
||||
{
|
||||
std::unordered_map<uint64_t, SymbolInfo> symbols;
|
||||
|
||||
auto it = decoders.find(id);
|
||||
if(it == decoders.end()) return symbols;
|
||||
|
||||
this->getSymbolMap(it->second, symbols);
|
||||
return symbols;
|
||||
return decoders.at(id)->getSymbolMap();
|
||||
} catch(...)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -38,13 +38,11 @@ ROCPROFILER_EXTERN_C_INIT
|
||||
|
||||
typedef enum
|
||||
{
|
||||
ROCPROFILER_ATT_PARAMETER_TARGET_CU = 0,
|
||||
ROCPROFILER_ATT_PARAMETER_SHADER_ENGINE_MASK,
|
||||
ROCPROFILER_ATT_PARAMETER_BUFFER_SIZE,
|
||||
ROCPROFILER_ATT_PARAMETER_SIMD_SELECT,
|
||||
ROCPROFILER_ATT_PARAMETER_PERFCOUNTERS_CTRL,
|
||||
ROCPROFILER_ATT_PARAMETER_PERFCOUNTER,
|
||||
ROCPROFILER_ATT_PARAMETER_OCCUPANCY_MODE_ENABLE,
|
||||
ROCPROFILER_ATT_PARAMETER_TARGET_CU = 0, ///< Select the Target CU or WGP
|
||||
ROCPROFILER_ATT_PARAMETER_SHADER_ENGINE_MASK, ///< Bitmask of shader engines.
|
||||
ROCPROFILER_ATT_PARAMETER_BUFFER_SIZE, ///< Size of combined GPU buffer for ATT
|
||||
ROCPROFILER_ATT_PARAMETER_SIMD_SELECT, ///< Bitmask (GFX9) or ID (Navi) of SIMDs
|
||||
ROCPROFILER_ATT_PARAMETER_CODE_OBJECT_TRACE_ENABLE, ///< Enables Codeobj Markers IDs into ATT
|
||||
ROCPROFILER_ATT_PARAMETER_LAST
|
||||
} rocprofiler_att_parameter_type_t;
|
||||
|
||||
@@ -62,19 +60,37 @@ typedef enum
|
||||
ROCPROFILER_ATT_CONTROL_START_AND_STOP = 3
|
||||
} rocprofiler_att_control_flags_t;
|
||||
|
||||
/**
|
||||
* @brief Callback to be triggered every kernel dispatch, indicating to start and/or stop ATT
|
||||
*/
|
||||
typedef rocprofiler_att_control_flags_t (*rocprofiler_att_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* userdata);
|
||||
rocprofiler_queue_id_t queue_id,
|
||||
const rocprofiler_agent_t* agent,
|
||||
rocprofiler_correlation_id_t correlation_id,
|
||||
rocprofiler_kernel_id_t kernel_id,
|
||||
void* userdata);
|
||||
|
||||
/**
|
||||
* @brief Callback to be triggered every time some ATT data is generated by the device
|
||||
* @param [in] shader_engine_id ID of shader engine, as enabled by SE_MASK
|
||||
* @param [in] data Pointer to the buffer containing the ATT data
|
||||
* @param [in] data_size Number of bytes in "data"
|
||||
* @param [in] userdata Passed back to user
|
||||
*/
|
||||
typedef void (*rocprofiler_att_shader_data_callback_t)(int64_t shader_engine_id,
|
||||
void* data,
|
||||
size_t data_size,
|
||||
void* userdata);
|
||||
|
||||
/**
|
||||
* @brief Enables the advanced thread trace service.
|
||||
* @param [in] context_id context_id.
|
||||
* @param [in] parameters List of ATT-specific parameters.
|
||||
* @param [in] num_parameters Number of parameters. Zero is allowed.
|
||||
* @param [in] dispatch_callback Control fn which decides when ATT starts/stop collecting.
|
||||
* @param [in] shader_callback Callback fn where the collected data will be sent to.
|
||||
* @param [in] callback_userdata Passed back to user.
|
||||
*/
|
||||
rocprofiler_status_t
|
||||
rocprofiler_configure_thread_trace_service(rocprofiler_context_id_t context_id,
|
||||
rocprofiler_att_parameter_t* parameters,
|
||||
|
||||
Reference in New Issue
Block a user