Gbaraldi/threadtrace2 (#724)

* Added first ATT API

* Finalizing thread trace API

* Fixing more rebase conflicts

* Added codeobj disassembly sample

* Fixing merge issues with rebase [2]

* Adding ATT packets

* Implemented thread trace intercept

* Moved codeobj parser to same repo as rocprofiler

* Moved thread trace to new API

* Fixing merge conflicts

* Fixing more merge conflicts

* Adding thread trace packet reuse

* Merged aql_profile_v2 headers

* Linked ATT sample to aqlprofile

* Updated decoder to include non-loaded codeobjs

* Implemented ISA decoder into ATT sample

* Added marker_id to vaddr

* Updating aql_profile_v2 API to memcpy

* Updating thread trace API to include 64bit markers. Using the result of ISA matching.

* Added instruction type and cycles summary

* Updated sample with selection of kernel by kernel_object

* Added option to copy from memory kernels

* Moved tool_data in thread_trace to dynamic alloc

* Restoring hsa.cpp

* Fixed ATT sample crash. General improvements.

* Moved codeobj library to outside src/

* Updated license header

* Moved codeobj_capture to camelcase

* Solving some more merge conflicts

* Update samples/advanced_thread_trace/CMakeLists.txt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update samples/advanced_thread_trace/CMakeLists.txt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update samples/code_object_isa_decode/CMakeLists.txt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update source/lib/rocprofiler-sdk/thread_trace/CMakeLists.txt

* Removing unused parameter check

* Adding const to isEmpty

* Removing unused warning

* Adding libdw-dev to requirements

* Running clang-format

* Commenting out new aql calls

* Clang format

* Unused variable fix

* Adding codeobj-decoder coverage

* Commenting out threadtrace

* Update samples/CMakeLists.txt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* P

* WOverloaded

* Addressing clang-tidy

* Virtual destructor on ttracer class

* Corr id

* Fixing code source format

* Update CMakeLists.txt

* Build fixes

* Update source/lib/rocprofiler-sdk-codeobj/code_object_track.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix shadowing

* Update CMakeLists.txt

* Update samples/CMakeLists.txt

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ammar ELWazir <ammar.elwazir@amd.com>
Co-authored-by: Ammar ELWazir <aelwazir@amd.com>
Co-authored-by: Benjamin Welton <bewelton@amd.com>

[ROCm/rocprofiler-sdk commit: 69b8a43dc6]
This commit is contained in:
Giovanni Lenzi Baraldi
2024-04-08 16:43:02 -03:00
کامیت شده توسط GitHub
والد b501f25ba0
کامیت 2cd198a7e7
48فایلهای تغییر یافته به همراه4649 افزوده شده و 109 حذف شده
@@ -218,7 +218,7 @@ counter_callback_info::setup_profile_config(const hsa::AgentCache& age
}
}
profile->pkt_generator = std::make_unique<rocprofiler::aql::AQLPacketConstruct>(
profile->pkt_generator = std::make_unique<rocprofiler::aql::CounterPacketConstruct>(
agent,
std::vector<counters::Metric>{profile->reqired_hw_counters.begin(),
profile->reqired_hw_counters.end()});
@@ -288,7 +288,7 @@ queue_cb(const context::context* ctx,
// Packet generated when no instrumentation is performed. May contain serialization
// packets/barrier packets (and can be empty).
auto no_instrumentation = [&]() {
auto ret_pkt = std::make_unique<rocprofiler::hsa::AQLPacket>(nullptr);
auto ret_pkt = std::make_unique<rocprofiler::hsa::CounterAQLPacket>(nullptr);
// If we have a counter collection context but it is not enabled, we still might need
// to add barrier packets to transition from serialized -> unserialized execution. This
// transition is coordinated by the serializer.
@@ -59,7 +59,7 @@ struct profile_config
std::vector<counters::EvaluateAST> asts{};
rocprofiler_profile_config_id_t id{.handle = 0};
// Packet generator to create AQL packets for insertion
std::unique_ptr<rocprofiler::aql::AQLPacketConstruct> pkt_generator{nullptr};
std::unique_ptr<rocprofiler::aql::CounterPacketConstruct> pkt_generator{nullptr};
// A packet cache of AQL packets. This allows reuse of AQL packets (preventing costly
// allocation of new packets/destruction).
rocprofiler::common::Synchronized<std::vector<std::unique_ptr<rocprofiler::hsa::AQLPacket>>>
@@ -61,8 +61,8 @@ getBlockDimensions(std::string_view agent, const Metric& metric)
{
if(maybe_agent.name() == agent)
{
aql::AQLPacketConstruct pkt_gen(maybe_agent, {metric});
const auto& events = pkt_gen.get_counter_events(metric);
aql::CounterPacketConstruct pkt_gen(maybe_agent, {metric});
const auto& events = pkt_gen.get_counter_events(metric);
for(const auto& event : events)
{
@@ -450,16 +450,16 @@ EvaluateAST::read_special_counters(
}
std::unordered_map<uint64_t, std::vector<rocprofiler_record_counter_t>>
EvaluateAST::read_pkt(const aql::AQLPacketConstruct* pkt_gen, hsa::AQLPacket& pkt)
EvaluateAST::read_pkt(const aql::CounterPacketConstruct* pkt_gen, hsa::AQLPacket& pkt)
{
struct it_data
{
std::unordered_map<uint64_t, std::vector<rocprofiler_record_counter_t>>* data;
const aql::AQLPacketConstruct* pkt_gen;
const aql::CounterPacketConstruct* pkt_gen;
};
std::unordered_map<uint64_t, std::vector<rocprofiler_record_counter_t>> ret;
if(pkt.empty) return ret;
if(pkt.isEmpty()) return ret;
it_data aql_data{.data = &ret, .pkt_gen = pkt_gen};
;
hsa_status_t status = hsa_ven_amd_aqlprofile_iterate_data(
@@ -136,8 +136,8 @@ public:
*
*/
static std::unordered_map<uint64_t, std::vector<rocprofiler_record_counter_t>> read_pkt(
const aql::AQLPacketConstruct* pkt_gen,
hsa::AQLPacket& pkt);
const aql::CounterPacketConstruct* pkt_gen,
hsa::AQLPacket& pkt);
/**
* @brief Insert special counter values, such as constants of the agent (i.e. max waves)
@@ -251,8 +251,8 @@ TEST(dimension, block_dim_test)
}
else
{
aql::AQLPacketConstruct pkt_gen(agent, {metric});
const auto& events = pkt_gen.get_counter_events(metric);
aql::CounterPacketConstruct pkt_gen(agent, {metric});
const auto& events = pkt_gen.get_counter_events(metric);
for(const auto& event : events)
{
std::map<int, uint64_t> dims;