rocprofv3: Update rocprofv3 command line for ATT (#201)
* rocprofv3: suppress agent info when no data collected * Update output config serialization - full serialization of output configuration * Update rocprofiler-sdk-att/tests - add version and soversion - change output directory - generate libatt_decoder_summary - disable tests instead of removing them * Update rocprofv3 command-line - make --att-library-path hidden by default - simplify check_att_capability - reorder pc sampling options - add hidden --echo option - remove ROCPROF_LIST_AVAIL_TOOL_LIBRARY from preload * Add new rocprofv3 tests for specify the ATT library path * Tweak to rocprofv3-test-hsa-multiqueue-att tests * Update rocprofv3 tool to enable output with att * Fix standalone test installation * Revert to fetchcontent_makeavailable to fetchcontent_populate * Revert tests/common/CMakeLists.txt --------- Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
@@ -121,6 +121,13 @@ output_config::save(ArchiveT& ar) const
|
||||
CFG_SERIALIZE_NAMED_MEMBER("summary_unit", stats_summary_unit);
|
||||
CFG_SERIALIZE_NAMED_MEMBER("summary_file", stats_summary_file);
|
||||
|
||||
CFG_SERIALIZE_MEMBER(csv_output);
|
||||
CFG_SERIALIZE_MEMBER(json_output);
|
||||
CFG_SERIALIZE_MEMBER(pftrace_output);
|
||||
CFG_SERIALIZE_MEMBER(otf2_output);
|
||||
CFG_SERIALIZE_MEMBER(summary_output);
|
||||
CFG_SERIALIZE_MEMBER(kernel_rename);
|
||||
|
||||
#undef CFG_SERIALIZE_MEMBER
|
||||
#undef CFG_SERIALIZE_NAMED_MEMBER
|
||||
}
|
||||
|
||||
@@ -210,14 +210,6 @@ read_tmp_file(domain_type type)
|
||||
auto& _fs = filebuf->file.stream;
|
||||
if(_fs.is_open()) _fs.close();
|
||||
filebuf->file.open(std::ios::binary | std::ios::in);
|
||||
// for(auto itr : filebuf->file.file_pos)
|
||||
// {
|
||||
// _fs.seekg(itr); // set to the absolute position
|
||||
// if(_fs.eof()) break;
|
||||
// auto _buffer = ring_buffer_t<Tp>{};
|
||||
// _buffer.load(_fs);
|
||||
// _data.emplace_back(std::move(_buffer));
|
||||
// }
|
||||
}
|
||||
} // namespace tool
|
||||
} // namespace rocprofiler
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
#
|
||||
#
|
||||
#
|
||||
project(rocprofiler-att-parser-tests LANGUAGES CXX)
|
||||
|
||||
rocprofiler_deactivate_clang_tidy()
|
||||
|
||||
add_executable(att-parser-tool-v3)
|
||||
target_sources(att-parser-tool-v3 PRIVATE standalone_tool_main.cpp)
|
||||
target_link_libraries(
|
||||
att-parser-tool-v3
|
||||
PRIVATE rocprofiler-sdk::rocprofiler-sdk-att-parser
|
||||
rocprofiler-sdk::rocprofiler-sdk-json
|
||||
rocprofiler-sdk::rocprofiler-sdk-common-library)
|
||||
target_sources(att-parser-tool-v3 PRIVATE standalone_tool_main.cpp)
|
||||
|
||||
add_executable(att-decoder-test)
|
||||
target_sources(att-decoder-test PRIVATE att_decoder_test.cpp)
|
||||
target_link_libraries(
|
||||
att-decoder-test
|
||||
PRIVATE rocprofiler-sdk::rocprofiler-sdk-att-parser
|
||||
@@ -23,19 +23,34 @@ target_link_libraries(
|
||||
rocprofiler-sdk::rocprofiler-sdk-static-library
|
||||
GTest::gtest
|
||||
GTest::gtest_main)
|
||||
target_sources(att-decoder-test PRIVATE att_decoder_test.cpp)
|
||||
|
||||
set(env-att-lib "ROCPROF_ATT_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/../lib")
|
||||
add_library(att_decoder_testing SHARED)
|
||||
add_library(rocprofiler-sdk::att-decoder-testing ALIAS att_decoder_testing)
|
||||
target_sources(att_decoder_testing PRIVATE dummy_decoder.cpp)
|
||||
set_target_properties(att_decoder_testing PROPERTIES VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
add_library(att_decoder_summary SHARED)
|
||||
add_library(rocprofiler-sdk::att-decoder-summary ALIAS att_decoder_summary)
|
||||
target_sources(att_decoder_summary PRIVATE dummy_decoder.cpp)
|
||||
set_target_properties(
|
||||
att_decoder_summary
|
||||
PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib/att
|
||||
VERSION ${PROJECT_VERSION}
|
||||
SOVERSION ${PROJECT_VERSION_MAJOR})
|
||||
|
||||
if(NOT ROCPROFILER_MEMCHECK)
|
||||
gtest_add_tests(
|
||||
TARGET att-decoder-test
|
||||
SOURCES att_decoder_test.cpp
|
||||
TEST_LIST att-decoder-test_TESTS
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(
|
||||
${att-decoder-test_TESTS} PROPERTIES ENVIRONMENT "${env-att-lib}" TIMEOUT 10
|
||||
LABELS "unittests")
|
||||
set(IS_MEMCHECK OFF)
|
||||
else()
|
||||
set(IS_MEMCHECK ON)
|
||||
endif()
|
||||
|
||||
set(env-att-lib "ROCPROF_ATT_LIBRARY_PATH=${PROJECT_BINARY_DIR}/lib")
|
||||
gtest_add_tests(
|
||||
TARGET att-decoder-test
|
||||
SOURCES att_decoder_test.cpp
|
||||
TEST_LIST att-decoder-test_TESTS
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_tests_properties(
|
||||
${att-decoder-test_TESTS} PROPERTIES ENVIRONMENT "${env-att-lib}" TIMEOUT 10 LABELS
|
||||
"unittests" DISABLED "${IS_MEMCHECK}")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#
|
||||
# Waitcnt ISA tests
|
||||
#
|
||||
project(rocprofiler-att-parser-waitcnt-tests LANGUAGES CXX)
|
||||
|
||||
add_executable(att-decoder-waitcnt-test)
|
||||
target_link_libraries(
|
||||
|
||||
@@ -68,6 +68,9 @@ struct att_perfcounter
|
||||
{
|
||||
std::string counter_name = {};
|
||||
uint32_t simd_mask = 0xf;
|
||||
|
||||
template <typename ArchiveT>
|
||||
void save(ArchiveT&) const;
|
||||
};
|
||||
|
||||
struct config : output_config
|
||||
@@ -79,6 +82,9 @@ struct config : output_config
|
||||
uint64_t delay = 0;
|
||||
uint64_t duration = 0;
|
||||
uint64_t repeat = 0;
|
||||
|
||||
template <typename ArchiveT>
|
||||
void save(ArchiveT& ar) const;
|
||||
};
|
||||
|
||||
config();
|
||||
@@ -114,10 +120,9 @@ struct config : output_config
|
||||
rocprofiler_pc_sampling_method_t pc_sampling_method_value = ROCPROFILER_PC_SAMPLING_METHOD_NONE;
|
||||
rocprofiler_pc_sampling_unit_t pc_sampling_unit_value = ROCPROFILER_PC_SAMPLING_UNIT_NONE;
|
||||
|
||||
std::string stats_summary_unit = get_env("ROCPROF_STATS_SUMMARY_UNITS", "nsec");
|
||||
int mpi_size = get_mpi_size();
|
||||
int mpi_rank = get_mpi_rank();
|
||||
uint64_t att_param_shader_engine_mask =
|
||||
int mpi_size = get_mpi_size();
|
||||
int mpi_rank = get_mpi_rank();
|
||||
uint64_t att_param_shader_engine_mask =
|
||||
get_env<uint64_t>("ROCPROF_ATT_PARAM_SHADER_ENGINE_MASK", 0x1);
|
||||
uint64_t att_param_buffer_size = get_env<uint64_t>("ROCPROF_ATT_PARAM_BUFFER_SIZE", 0x6000000);
|
||||
uint64_t att_param_simd_select = get_env<uint64_t>("ROCPROF_ATT_PARAM_SIMD_SELECT", 0xF);
|
||||
@@ -144,13 +149,30 @@ struct config : output_config
|
||||
{}
|
||||
};
|
||||
|
||||
#define CFG_SERIALIZE_MEMBER(VAR) ar(cereal::make_nvp(#VAR, VAR))
|
||||
#define CFG_SERIALIZE_NAMED_MEMBER(NAME, VAR) ar(cereal::make_nvp(NAME, VAR))
|
||||
|
||||
template <typename ArchiveT>
|
||||
void
|
||||
att_perfcounter::save(ArchiveT& ar) const
|
||||
{
|
||||
CFG_SERIALIZE_MEMBER(counter_name);
|
||||
CFG_SERIALIZE_MEMBER(simd_mask);
|
||||
}
|
||||
|
||||
template <typename ArchiveT>
|
||||
void
|
||||
config::CollectionPeriod::save(ArchiveT& ar) const
|
||||
{
|
||||
CFG_SERIALIZE_MEMBER(delay);
|
||||
CFG_SERIALIZE_MEMBER(duration);
|
||||
CFG_SERIALIZE_MEMBER(repeat);
|
||||
}
|
||||
|
||||
template <typename ArchiveT>
|
||||
void
|
||||
config::save(ArchiveT& ar) const
|
||||
{
|
||||
#define CFG_SERIALIZE_MEMBER(VAR) ar(cereal::make_nvp(#VAR, VAR))
|
||||
#define CFG_SERIALIZE_NAMED_MEMBER(NAME, VAR) ar(cereal::make_nvp(NAME, VAR))
|
||||
|
||||
CFG_SERIALIZE_MEMBER(kernel_trace);
|
||||
CFG_SERIALIZE_MEMBER(hsa_core_api_trace);
|
||||
CFG_SERIALIZE_MEMBER(hsa_amd_ext_api_trace);
|
||||
@@ -163,19 +185,40 @@ config::save(ArchiveT& ar) const
|
||||
CFG_SERIALIZE_MEMBER(counter_collection);
|
||||
CFG_SERIALIZE_MEMBER(hip_runtime_api_trace);
|
||||
CFG_SERIALIZE_MEMBER(hip_compiler_api_trace);
|
||||
CFG_SERIALIZE_MEMBER(kernel_rename);
|
||||
CFG_SERIALIZE_MEMBER(rccl_api_trace);
|
||||
CFG_SERIALIZE_MEMBER(rocdecode_api_trace);
|
||||
|
||||
CFG_SERIALIZE_MEMBER(mpi_rank);
|
||||
CFG_SERIALIZE_MEMBER(mpi_size);
|
||||
CFG_SERIALIZE_MEMBER(collection_periods);
|
||||
CFG_SERIALIZE_MEMBER(counters);
|
||||
CFG_SERIALIZE_MEMBER(extra_counters_contents);
|
||||
CFG_SERIALIZE_MEMBER(kernel_filter_include);
|
||||
CFG_SERIALIZE_MEMBER(kernel_filter_exclude);
|
||||
CFG_SERIALIZE_MEMBER(kernel_filter_range);
|
||||
CFG_SERIALIZE_MEMBER(demangle);
|
||||
CFG_SERIALIZE_MEMBER(truncate);
|
||||
|
||||
CFG_SERIALIZE_MEMBER(pc_sampling_method);
|
||||
CFG_SERIALIZE_MEMBER(pc_sampling_unit);
|
||||
CFG_SERIALIZE_MEMBER(pc_sampling_interval);
|
||||
CFG_SERIALIZE_MEMBER(pc_sampling_method_value);
|
||||
CFG_SERIALIZE_MEMBER(pc_sampling_unit_value);
|
||||
|
||||
CFG_SERIALIZE_MEMBER(advanced_thread_trace);
|
||||
CFG_SERIALIZE_MEMBER(att_serialize_all);
|
||||
CFG_SERIALIZE_MEMBER(att_param_shader_engine_mask);
|
||||
CFG_SERIALIZE_MEMBER(att_param_buffer_size);
|
||||
CFG_SERIALIZE_MEMBER(att_param_simd_select);
|
||||
CFG_SERIALIZE_MEMBER(att_param_target_cu);
|
||||
CFG_SERIALIZE_MEMBER(att_capability);
|
||||
CFG_SERIALIZE_MEMBER(att_param_perfcounters);
|
||||
|
||||
static_cast<const base_type&>(*this).save(ar);
|
||||
}
|
||||
|
||||
#undef CFG_SERIALIZE_MEMBER
|
||||
#undef CFG_SERIALIZE_NAMED_MEMBER
|
||||
}
|
||||
|
||||
template <config_context ContextT>
|
||||
config&
|
||||
|
||||
@@ -1606,10 +1606,16 @@ using domain_stats_vec_t = tool::domain_stats_vec_t;
|
||||
|
||||
template <typename Tp, domain_type DomainT>
|
||||
void
|
||||
generate_output(tool::buffered_output<Tp, DomainT>& output_v, domain_stats_vec_t& contributions_v)
|
||||
generate_output(tool::buffered_output<Tp, DomainT>& output_v,
|
||||
uint64_t& num_output_v,
|
||||
domain_stats_vec_t& contributions_v)
|
||||
{
|
||||
if(!output_v) return;
|
||||
|
||||
// if it has reached this point, the generator is not empty
|
||||
num_output_v += 1;
|
||||
|
||||
// opens temporary file and sets read position to beginning
|
||||
output_v.read();
|
||||
|
||||
if(tool::get_config().stats || tool::get_config().summary_output)
|
||||
@@ -1668,38 +1674,46 @@ tool_fini(void* /*tool_data*/)
|
||||
auto pc_sampling_host_trap_output =
|
||||
tool::pc_sampling_host_trap_buffered_output_t{tool::get_config().pc_sampling_host_trap};
|
||||
|
||||
auto node_id_sort = [](const auto& lhs, const auto& rhs) { return lhs.node_id < rhs.node_id; };
|
||||
auto node_id_sort = [](const auto& lhs, const auto& rhs) { return lhs.node_id < rhs.node_id; };
|
||||
auto agents_output = CHECK_NOTNULL(tool_metadata)->agents;
|
||||
std::sort(agents_output.begin(), agents_output.end(), node_id_sort);
|
||||
|
||||
auto _agents = CHECK_NOTNULL(tool_metadata)->agents;
|
||||
std::sort(_agents.begin(), _agents.end(), node_id_sort);
|
||||
uint64_t num_output = 0;
|
||||
auto contributions = domain_stats_vec_t{};
|
||||
|
||||
if(tool::get_config().csv_output)
|
||||
generate_output(kernel_dispatch_output, num_output, contributions);
|
||||
generate_output(hsa_output, num_output, contributions);
|
||||
generate_output(hip_output, num_output, contributions);
|
||||
generate_output(memory_copy_output, num_output, contributions);
|
||||
generate_output(memory_allocation_output, num_output, contributions);
|
||||
generate_output(marker_output, num_output, contributions);
|
||||
generate_output(rccl_output, num_output, contributions);
|
||||
generate_output(counters_output, num_output, contributions);
|
||||
generate_output(scratch_memory_output, num_output, contributions);
|
||||
generate_output(rocdecode_output, num_output, contributions);
|
||||
generate_output(pc_sampling_host_trap_output, num_output, contributions);
|
||||
|
||||
if(tool::get_config().advanced_thread_trace && !tool::get_config().att_capability.empty() &&
|
||||
!tool_metadata->att_filenames.empty())
|
||||
{
|
||||
tool::generate_csv(tool::get_config(), *tool_metadata, _agents);
|
||||
num_output += 1;
|
||||
}
|
||||
|
||||
auto contributions = domain_stats_vec_t{};
|
||||
ROCP_INFO << "Number of services generating output: " << num_output;
|
||||
|
||||
generate_output(kernel_dispatch_output, contributions);
|
||||
generate_output(hsa_output, contributions);
|
||||
generate_output(hip_output, contributions);
|
||||
generate_output(memory_copy_output, contributions);
|
||||
generate_output(memory_allocation_output, contributions);
|
||||
generate_output(marker_output, contributions);
|
||||
generate_output(rccl_output, contributions);
|
||||
generate_output(counters_output, contributions);
|
||||
generate_output(scratch_memory_output, contributions);
|
||||
generate_output(rocdecode_output, contributions);
|
||||
generate_output(pc_sampling_host_trap_output, contributions);
|
||||
if(tool::get_config().csv_output && num_output > 0)
|
||||
{
|
||||
tool::generate_csv(tool::get_config(), *tool_metadata, agents_output);
|
||||
}
|
||||
|
||||
if(tool::get_config().stats && tool::get_config().csv_output)
|
||||
if(tool::get_config().stats && tool::get_config().csv_output && num_output > 0)
|
||||
{
|
||||
tool::generate_csv(tool::get_config(), *tool_metadata, contributions);
|
||||
}
|
||||
|
||||
if(tool::get_config().advanced_thread_trace)
|
||||
{
|
||||
std::unordered_map<std::string_view, rocprofiler::att_wrapper::tool_att_capability_t>
|
||||
const std::unordered_map<std::string_view, rocprofiler::att_wrapper::tool_att_capability_t>
|
||||
tool_att_capability_map = {
|
||||
{"testing", rocprofiler::att_wrapper::ATT_CAPABILITIES_TESTING},
|
||||
{"summary", rocprofiler::att_wrapper::ATT_CAPABILITIES_SUMMARY},
|
||||
@@ -1711,7 +1725,7 @@ tool_fini(void* /*tool_data*/)
|
||||
|
||||
auto att_capability_value = tool_att_capability_map.at(tool::get_config().att_capability);
|
||||
auto decoder = rocprofiler::att_wrapper::ATTDecoder(att_capability_value);
|
||||
ROCP_FATAL_IF(!decoder.valid()) << "Decoder library not found at ROCPORF_ATT_LIBRARY_PATH";
|
||||
ROCP_FATAL_IF(!decoder.valid()) << "Decoder library not found at ROCPROF_ATT_LIBRARY_PATH";
|
||||
auto codeobj = tool_metadata->get_code_object_load_info();
|
||||
auto output_path = tool::format_path(tool::get_config().output_path);
|
||||
for(auto& [dispatch_id, att_filename_data] : tool_metadata->att_filenames)
|
||||
@@ -1731,7 +1745,7 @@ tool_fini(void* /*tool_data*/)
|
||||
}
|
||||
}
|
||||
|
||||
if(tool::get_config().json_output)
|
||||
if(tool::get_config().json_output && num_output > 0)
|
||||
{
|
||||
auto json_ar = tool::open_json(tool::get_config());
|
||||
|
||||
@@ -1757,11 +1771,11 @@ tool_fini(void* /*tool_data*/)
|
||||
tool::close_json(json_ar);
|
||||
}
|
||||
|
||||
if(tool::get_config().pftrace_output)
|
||||
if(tool::get_config().pftrace_output && num_output > 0)
|
||||
{
|
||||
tool::write_perfetto(tool::get_config(),
|
||||
*tool_metadata,
|
||||
_agents,
|
||||
agents_output,
|
||||
hip_output.get_generator(),
|
||||
hsa_output.get_generator(),
|
||||
kernel_dispatch_output.get_generator(),
|
||||
@@ -1773,7 +1787,7 @@ tool_fini(void* /*tool_data*/)
|
||||
rocdecode_output.get_generator());
|
||||
}
|
||||
|
||||
if(tool::get_config().otf2_output)
|
||||
if(tool::get_config().otf2_output && num_output > 0)
|
||||
{
|
||||
auto hip_elem_data = hip_output.load_all();
|
||||
auto hsa_elem_data = hsa_output.load_all();
|
||||
@@ -1788,7 +1802,7 @@ tool_fini(void* /*tool_data*/)
|
||||
tool::write_otf2(tool::get_config(),
|
||||
*tool_metadata,
|
||||
getpid(),
|
||||
_agents,
|
||||
agents_output,
|
||||
&hip_elem_data,
|
||||
&hsa_elem_data,
|
||||
&kernel_dispatch_elem_data,
|
||||
@@ -1800,7 +1814,7 @@ tool_fini(void* /*tool_data*/)
|
||||
&rocdecode_elem_data);
|
||||
}
|
||||
|
||||
if(tool::get_config().summary_output)
|
||||
if(tool::get_config().summary_output && num_output > 0)
|
||||
{
|
||||
tool::generate_stats(tool::get_config(), *tool_metadata, contributions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user