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
@@ -69,12 +69,15 @@ CoreApiTable&
|
||||
get_api_table()
|
||||
{
|
||||
static auto _v = []() {
|
||||
auto val = CoreApiTable{};
|
||||
val.hsa_iterate_agents_fn = hsa_iterate_agents;
|
||||
val.hsa_agent_get_info_fn = hsa_agent_get_info;
|
||||
val.hsa_queue_create_fn = hsa_queue_create;
|
||||
val.hsa_queue_destroy_fn = hsa_queue_destroy;
|
||||
val.hsa_signal_wait_relaxed_fn = hsa_signal_wait_relaxed;
|
||||
auto val = CoreApiTable{};
|
||||
val.hsa_iterate_agents_fn = hsa_iterate_agents;
|
||||
val.hsa_agent_get_info_fn = hsa_agent_get_info;
|
||||
val.hsa_queue_create_fn = hsa_queue_create;
|
||||
val.hsa_queue_destroy_fn = hsa_queue_destroy;
|
||||
val.hsa_signal_wait_relaxed_fn = hsa_signal_wait_relaxed;
|
||||
val.hsa_queue_load_read_index_relaxed_fn = hsa_queue_load_read_index_relaxed;
|
||||
val.hsa_queue_add_write_index_relaxed_fn = hsa_queue_add_write_index_relaxed;
|
||||
val.hsa_signal_store_screlease_fn = hsa_signal_store_screlease;
|
||||
return val;
|
||||
}();
|
||||
return _v;
|
||||
@@ -83,32 +86,40 @@ get_api_table()
|
||||
void
|
||||
test_init()
|
||||
{
|
||||
HsaApiTable table;
|
||||
table.amd_ext_ = &get_ext_table();
|
||||
table.core_ = &get_api_table();
|
||||
agent::construct_agent_cache(&table);
|
||||
ASSERT_TRUE(hsa::get_queue_controller() != nullptr);
|
||||
hsa::get_queue_controller()->init(get_api_table(), get_ext_table());
|
||||
auto init = []() -> bool {
|
||||
HsaApiTable table;
|
||||
table.amd_ext_ = &get_ext_table();
|
||||
table.core_ = &get_api_table();
|
||||
agent::construct_agent_cache(&table);
|
||||
hsa::get_queue_controller()->init(get_api_table(), get_ext_table());
|
||||
return true;
|
||||
};
|
||||
[[maybe_unused]] static bool run_ince = init();
|
||||
}
|
||||
|
||||
} // namespace rocprofiler
|
||||
|
||||
using namespace rocprofiler::aql;
|
||||
using namespace rocprofiler;
|
||||
|
||||
TEST(thread_trace, construct_default_packets)
|
||||
TEST(thread_trace, resource_creation)
|
||||
{
|
||||
ASSERT_EQ(hsa_init(), HSA_STATUS_SUCCESS);
|
||||
rocprofiler::test_init();
|
||||
auto agents = rocprofiler::hsa::get_queue_controller()->get_supported_agents();
|
||||
test_init();
|
||||
|
||||
registration::init_logging();
|
||||
registration::set_init_status(-1);
|
||||
|
||||
auto agents = hsa::get_queue_controller()->get_supported_agents();
|
||||
ASSERT_GT(agents.size(), 0);
|
||||
for(const auto& [_, agent] : agents)
|
||||
{
|
||||
auto params = std::make_shared<rocprofiler::thread_trace_parameter_pack>();
|
||||
auto params = thread_trace_parameter_pack{};
|
||||
|
||||
ThreadTraceAQLPacketFactory factory(
|
||||
agent, params, rocprofiler::get_api_table(), rocprofiler::get_ext_table());
|
||||
aql::ThreadTraceAQLPacketFactory factory(agent, params, get_api_table(), get_ext_table());
|
||||
|
||||
auto packet = factory.construct_packet();
|
||||
packet->populate_before();
|
||||
packet->populate_after();
|
||||
|
||||
size_t vendor_packet = HSA_PACKET_TYPE_VENDOR_SPECIFIC << HSA_PACKET_HEADER_TYPE;
|
||||
ASSERT_TRUE(packet->start.header == vendor_packet);
|
||||
@@ -116,16 +127,42 @@ TEST(thread_trace, construct_default_packets)
|
||||
ASSERT_TRUE(packet->before_krn_pkt.size() > 0);
|
||||
ASSERT_TRUE(packet->after_krn_pkt.size() > 0);
|
||||
}
|
||||
|
||||
{
|
||||
thread_trace_parameter_pack params{};
|
||||
GlobalThreadTracer tracer(std::move(params));
|
||||
|
||||
for(const auto& [_, agent] : agents)
|
||||
{
|
||||
// Init twice to simulate two queues
|
||||
tracer.resource_init(agent, get_api_table(), get_ext_table());
|
||||
tracer.resource_init(agent, get_api_table(), get_ext_table());
|
||||
}
|
||||
|
||||
for(auto& [_, agenttracer] : tracer.agents)
|
||||
{
|
||||
agenttracer->load_codeobj(1, 0x1000, 0x1000);
|
||||
agenttracer->load_codeobj(2, 0x3000, 0x1000);
|
||||
agenttracer->unload_codeobj(1);
|
||||
}
|
||||
|
||||
for(const auto& [_, agent] : agents)
|
||||
{
|
||||
// Deinit twice to remove both queues
|
||||
tracer.resource_deinit(agent);
|
||||
tracer.resource_deinit(agent);
|
||||
}
|
||||
}
|
||||
hsa_shut_down();
|
||||
}
|
||||
|
||||
TEST(thread_trace, configure_test)
|
||||
{
|
||||
rocprofiler::test_init();
|
||||
test_init();
|
||||
|
||||
rocprofiler::registration::init_logging();
|
||||
rocprofiler::registration::set_init_status(-1);
|
||||
rocprofiler::context::push_client(1);
|
||||
registration::init_logging();
|
||||
registration::set_init_status(-1);
|
||||
context::push_client(1);
|
||||
rocprofiler_context_id_t ctx;
|
||||
ROCPROFILER_CALL(rocprofiler_create_context(&ctx), "context creation failed");
|
||||
|
||||
@@ -142,8 +179,7 @@ TEST(thread_trace, configure_test)
|
||||
[](rocprofiler_queue_id_t,
|
||||
const rocprofiler_agent_t*,
|
||||
rocprofiler_correlation_id_t,
|
||||
const hsa_kernel_dispatch_packet_t*,
|
||||
uint64_t,
|
||||
rocprofiler_kernel_id_t,
|
||||
void*) { return ROCPROFILER_ATT_CONTROL_NONE; },
|
||||
[](int64_t, void*, size_t, void*) {},
|
||||
nullptr);
|
||||
@@ -151,4 +187,5 @@ TEST(thread_trace, configure_test)
|
||||
ASSERT_EQ(hsa_init(), HSA_STATUS_SUCCESS);
|
||||
ROCPROFILER_CALL(rocprofiler_start_context(ctx), "context start failed");
|
||||
ROCPROFILER_CALL(rocprofiler_stop_context(ctx), "context stop failed");
|
||||
hsa_shut_down();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user