Re-enabling ATT tests

Change-Id: Ied23410d40eecbbfb8972d36ed065289f74aaa0c


[ROCm/rocprofiler commit: 97c6b0b867]
This commit is contained in:
Giovanni LB
2024-04-16 17:04:45 -03:00
parent 27d102d6b6
commit e64e15aba4
4 changed files with 24 additions and 49 deletions
-45
View File
@@ -1,45 +0,0 @@
################################################################################
# Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
################################################################################
import numpy as np
import sys
BYTE_MAP = [str(k) for k in range(10)] + ["a", "b", "c", "d", "e", "f"]
def map8(c):
return BYTE_MAP[(c // 16) % 16] + BYTE_MAP[c % 16]
def map16(c):
return map8(c >> 8) + map8(c)
in_filename = sys.argv[1]
out_filename = in_filename.split(".att")[0] + ".out"
in_bytes = np.fromfile(in_filename, dtype=np.uint16)
offset = 4 if in_bytes[0] >= 0xC000 else 0
out_bytes = [map16(c) + "\n" for c in in_bytes[offset:]]
with open(out_filename, "w") as f:
[f.write(b) for b in out_bytes]
+2 -2
View File
@@ -170,7 +170,7 @@ class att_plugin_t {
<< '\n';
// iterate over each shader engine att trace
header.navi = !att_tracer_record->intercept_list.userdata & 0x1;
header.navi = !(att_tracer_record->intercept_list.userdata & 0x1);
int se_num = att_tracer_record->shader_engine_data_count;
for (int i = 0; i < se_num; i++)
{
@@ -188,7 +188,7 @@ class att_plugin_t {
std::cerr << "ATT Failed to open file: " << outfilepath << "_se" << i << ".att\n";
return ROCPROFILER_STATUS_ERROR;
}
if (header.enable)
if (header.enable && !header.navi)
out.write((const char*)&header, sizeof(header.raw));
out.write(data_buffer_ptr, se_att_trace->buffer_size);
}
@@ -62,6 +62,16 @@
} \
} while (0)
typedef void(*aqlprofile_att_parser_iterate_event_cb_t)(
int trace_event_id,
const char* trace_event_metadata,
void* userdata
);
extern "C" void aqlprofile_att_parser_iterate_event_list(
aqlprofile_att_parser_iterate_event_cb_t callback,
void* userdata
);
namespace Packet {
static const size_t MEM_PAGE_BYTES = 0x1000;
static const size_t MEM_PAGE_MASK = MEM_PAGE_BYTES - 1;
@@ -529,6 +539,12 @@ uint8_t* AllocateLocalMemory(size_t size, hsa_amd_memory_pool_t* gpu_pool) {
return ptr;
}
void check_wave_event(int, const char* event_name, void* userdata)
{
if (std::string_view(event_name).find("waves") == 0)
*reinterpret_cast<bool*>(userdata) = true;
}
hsa_status_t Allocate(hsa_agent_t gpu_agent, hsa_ven_amd_aqlprofile_profile_t* profile,
size_t att_buffer_size) {
rocprofiler::HSAAgentInfo& agentInfo =
@@ -536,6 +552,10 @@ hsa_status_t Allocate(hsa_agent_t gpu_agent, hsa_ven_amd_aqlprofile_profile_t* p
profile->command_buffer.ptr =
AllocateSysMemory(gpu_agent, profile->command_buffer.size, &agentInfo.cpu_pool_);
profile->output_buffer.size = att_buffer_size;
g_output_buffer_local = false;
aqlprofile_att_parser_iterate_event_list(check_wave_event, &g_output_buffer_local);
profile->output_buffer.ptr = (g_output_buffer_local)
? AllocateLocalMemory(profile->output_buffer.size, &agentInfo.gpu_pool_)
: AllocateSysMemory(gpu_agent, profile->output_buffer.size, &agentInfo.cpu_pool_);
@@ -740,7 +740,7 @@ class ATTCollection : public ::testing::Test {
};
bool ATTCollection::bCollected = false;
TEST_F(ATTCollection, DISABLED_WhenRunningATTItCollectsTraceDataWithOldAPI) {
TEST_F(ATTCollection, WhenRunningATTItCollectsTraceDataWithOldAPI) {
int result = ROCPROFILER_STATUS_ERROR;
// inititalize ROCProfiler
@@ -806,7 +806,7 @@ TEST_F(ATTCollection, DISABLED_WhenRunningATTItCollectsTraceDataWithOldAPI) {
}
// New API
TEST_F(ATTCollection, DISABLED_WhenRunningATTItCollectsTraceDataWithNewAPI) {
TEST_F(ATTCollection, WhenRunningATTItCollectsTraceDataWithNewAPI) {
int result = ROCPROFILER_STATUS_ERROR;
// inititalize ROCProfiler
result = rocprofiler_initialize();