Enable PC sampling to be run alongside ATT. Add ATT to changelog. (#445)

* Enable PC sampling to be run alongside ATT. Add ATT to changelog.

* Fix tests

* Review comments

---------

Co-authored-by: Giovanni Baraldi <gbaraldi@amd.com>
This commit is contained in:
Baraldi, Giovanni
2025-06-10 20:19:00 +02:00
committed by GitHub
parent 80e058bf08
commit 2fa95e6d6d
7 changed files with 27 additions and 19 deletions
+3 -1
View File
@@ -127,7 +127,9 @@ WaitcntList::gfx10_construct(const wave_t& wave, isa_map_t& isa_map)
for(size_t i = 0; i < wave.instructions_size; i++)
{
auto& event = wave.instructions_array[i];
auto it = isa_map.find(event.pc);
if(event.pc.marker_id == 0 && event.pc.addr == 0) continue;
auto it = isa_map.find(event.pc);
if(it == isa_map.end() || !it->second->code_line || it->second->code_line->inst.empty())
{
static thread_local std::once_flag failed_flag{};
+3 -1
View File
@@ -162,7 +162,9 @@ WaitcntList::gfx12_construct(const wave_t& wave, isa_map_t& isa_map)
for(size_t i = 0; i < wave.instructions_size; i++)
{
auto& event = wave.instructions_array[i];
auto it = isa_map.find(event.pc);
if(event.pc.marker_id == 0 && event.pc.addr == 0) continue;
auto it = isa_map.find(event.pc);
if(it == isa_map.end() || !it->second->code_line || it->second->code_line->inst.empty())
{
static thread_local std::once_flag failed_flag{};
+3 -1
View File
@@ -90,7 +90,9 @@ WaitcntList::gfx9_construct(const wave_t& wave, isa_map_t& isa_map)
for(size_t i = 0; i < wave.instructions_size; i++)
{
auto& event = wave.instructions_array[i];
auto it = isa_map.find(event.pc);
if(event.pc.marker_id == 0 && event.pc.addr == 0) continue;
auto it = isa_map.find(event.pc);
if(it == isa_map.end() || !it->second->code_line || it->second->code_line->inst.empty())
{
static thread_local std::once_flag failed_flag{};
@@ -31,6 +31,9 @@ namespace rocprofiler
{
namespace att_wrapper
{
// This is used so the first line number dont get skipped because their vaddr==0
constexpr uint64_t LINE_OFFSET = 1;
TEST(att_decoder_waitcnt_test, gfx9)
{
registration::init_logging();
@@ -41,7 +44,7 @@ TEST(att_decoder_waitcnt_test, gfx9)
auto append_isa = [&](size_t line_number, const char* line) {
pcinfo_t pc{};
pc.addr = line_number;
pc.addr = line_number + LINE_OFFSET;
pc.marker_id = 0;
auto code = std::make_unique<CodeLine>();
@@ -83,7 +86,7 @@ TEST(att_decoder_waitcnt_test, gfx9)
for(size_t i = 0; i < isa_map.size(); i++)
{
wave_instruction_t inst{};
inst.pc.addr = i;
inst.pc.addr = i + LINE_OFFSET;
insts.push_back(inst);
}
}
@@ -126,7 +129,7 @@ TEST(att_decoder_waitcnt_test, gfx10)
auto append_isa = [&](size_t line_number, const char* line) {
pcinfo_t pc{};
pc.addr = line_number;
pc.addr = line_number + LINE_OFFSET;
pc.marker_id = 0;
auto code = std::make_unique<CodeLine>();
@@ -173,7 +176,7 @@ TEST(att_decoder_waitcnt_test, gfx10)
for(size_t i = 0; i < isa_map.size(); i++)
{
wave_instruction_t inst{};
inst.pc.addr = i;
inst.pc.addr = i + LINE_OFFSET;
insts.push_back(inst);
}
@@ -219,7 +222,7 @@ TEST(att_decoder_waitcnt_test, gfx12)
auto append_isa = [&](size_t line_number, const char* line) {
pcinfo_t pc{};
pc.addr = line_number;
pc.addr = line_number + LINE_OFFSET;
pc.marker_id = 0;
auto code = std::make_unique<CodeLine>();
@@ -293,7 +296,7 @@ TEST(att_decoder_waitcnt_test, gfx12)
for(size_t i = 0; i < isa_map.size(); i++)
{
wave_instruction_t inst{};
inst.pc.addr = i;
inst.pc.addr = i + LINE_OFFSET;
insts.push_back(inst);
}
@@ -344,7 +347,7 @@ TEST(att_decoder_waitcnt_test, fail_conditions)
for(size_t i = 0; i < 10; i++)
{
wave_instruction_t inst{};
inst.pc.addr = i;
inst.pc.addr = i + LINE_OFFSET;
insts.push_back(inst);
}
+1 -1
View File
@@ -35,7 +35,7 @@ namespace att_wrapper
WaveFile::WaveFile(WaveConfig& config, const wave_t& wave)
{
ROCP_WARNING_IF(wave.contexts != 0u)
<< "Wave had " << wave.contexts << " context save-restores";
<< "Wave had " << static_cast<int>(wave.contexts) << " context save-restores";
if(!GlobalDefs::get().has_format("json")) return;
if(wave.instructions_size == 0 && wave.timeline_size < 3) return;