[rocprofiler-sdk] Update rocprofiler-sdk CONTRIBUTING.md (#1371)

This commit is contained in:
Jonathan R. Madsen
2025-10-20 21:46:24 -05:00
committed by GitHub
parent 32f9fa6ca5
commit 4cca398b56
23 changed files with 348 additions and 106 deletions
@@ -122,7 +122,9 @@ set_env(std::string_view env_id, bool value, int override)
template <typename Tp>
int
set_env(std::string_view env_id, Tp value, int override)
set_env(std::string_view env_id,
Tp value, // NOLINT(performance-unnecessary-value-param)
int override)
{
auto str_value = std::stringstream{};
str_value << value;
@@ -906,7 +906,7 @@ write_rocpd(
if(itr.kernel_id == 0 && itr.code_object_id == 0) continue;
auto json_data =
get_json_string([](auto& ar, const auto oitr) { cereal::save(ar, oitr); }, itr);
get_json_string([](auto& ar, const auto& oitr) { cereal::save(ar, oitr); }, itr);
auto stmt = get_insert_statement(
"rocpd_info_kernel_symbol{{uuid}}",
@@ -186,8 +186,8 @@ output_keys(std::string _tag)
{
for(size_t i = 0; i < _cmdline.size(); ++i)
{
const auto _l = std::string{(i == 0) ? "" : "_"};
auto _v = _cmdline.at(i);
const auto _l = std::string{(i == 0) ? "" : "_"};
const auto& _v = _cmdline.at(i);
_argv_string += _l + _v;
if(i > 0)
{
@@ -237,7 +237,7 @@ output_keys(std::string _tag)
{
for(size_t i = 0; i < _cmdline.size(); ++i)
{
auto _v = _cmdline.at(i);
const auto& _v = _cmdline.at(i);
auto itr = output_key{fmt::format("arg{}", i), _v, fmt::format("Argument #{}", i)};
_options.emplace_back(fmt::format("%{}%", itr.key), itr.value, itr.description);
_options.emplace_back(
@@ -529,42 +529,32 @@ PYBIND11_MODULE(libpyrocpd, pyrocpd)
// (1) the process with the earliest start time
// (2) find the process with the longest duration
uint64_t min_start_time = std::numeric_limits<uint64_t>::max();
uint64_t max_fini_time = 0;
uint64_t max_fini_time = std::numeric_limits<uint64_t>::min();
for(auto obj : {data.connection})
{
auto* conn = rocpd::interop::get_connection(std::move(obj));
// min start
sqlite3_stmt* _stmt_min_start;
sqlite3_prepare_v2(
conn, "SELECT MIN(start) FROM processes;", -1, &_stmt_min_start, nullptr);
uint64_t _min_start_time = std::numeric_limits<uint64_t>::max();
if(sqlite3_step(_stmt_min_start) == SQLITE_ROW)
sqlite3_stmt* _stmt_min_start_max_fini = nullptr;
uint64_t _min_start_time = std::numeric_limits<uint64_t>::max();
uint64_t _max_fini_time = std::numeric_limits<uint64_t>::min();
sqlite3_prepare_v2(conn,
"SELECT MIN(start), MAX(fini) FROM processes;",
-1,
&_stmt_min_start_max_fini,
nullptr);
if(sqlite3_step(_stmt_min_start_max_fini) == SQLITE_ROW)
{
_min_start_time =
static_cast<uint64_t>(sqlite3_column_int64(_stmt_min_start, 0));
static_cast<uint64_t>(sqlite3_column_int64(_stmt_min_start_max_fini, 0));
_max_fini_time =
static_cast<uint64_t>(sqlite3_column_int64(_stmt_min_start_max_fini, 1));
}
sqlite3_finalize(_stmt_min_start);
if(min_start_time > _min_start_time)
{
min_start_time = _min_start_time;
}
//// max fini
sqlite3_stmt* _stmt_max_fini;
sqlite3_prepare_v2(
conn, "SELECT MAX(fini) FROM processes;", -1, &_stmt_max_fini, nullptr);
uint64_t _max_fini_time = 0;
if(sqlite3_step(_stmt_max_fini) == SQLITE_ROW)
{
_max_fini_time = static_cast<uint64_t>(sqlite3_column_int64(_stmt_max_fini, 0));
}
sqlite3_finalize(_stmt_max_fini);
if(max_fini_time < _max_fini_time)
{
max_fini_time = _max_fini_time;
}
sqlite3_finalize(_stmt_min_start_max_fini);
min_start_time = std::min(min_start_time, _min_start_time);
max_fini_time = std::max(max_fini_time, _max_fini_time);
}
auto otf2_session =
@@ -538,9 +538,9 @@ write_otf2(const OTF2Session& otf2_session,
get_hash_id(_name),
region_info{_name, OTF2_REGION_ROLE_DATA_TRANSFER, OTF2_PARADIGM_HIP});
auto _extended_agent = agent_data.at(itr.dst_agent_abs_index);
auto _agent_handle = _extended_agent.types_agent.id.handle;
auto _evt_info = event_info{location_base{
const auto& _extended_agent = agent_data.at(itr.dst_agent_abs_index);
auto _agent_handle = _extended_agent.types_agent.id.handle;
auto _evt_info = event_info{location_base{
process.pid, itr.tid, _agent_handle, ROCPROFILER_AGENT_MEMORY_COPY_TYPE}};
auto agent_index_info = _extended_agent.agent_index;
@@ -587,8 +587,8 @@ write_otf2(const OTF2Session& otf2_session,
get_hash_id(_alloc_operation),
region_info{_alloc_operation, OTF2_REGION_ROLE_ALLOCATE, OTF2_PARADIGM_HIP});
auto _extended_agent = agent_data.at(itr.agent_abs_index);
auto _handle = _extended_agent.types_agent.id.handle;
const auto& _extended_agent = agent_data.at(itr.agent_abs_index);
auto _handle = _extended_agent.types_agent.id.handle;
auto _evt_info = event_info{location_base{
process.pid, itr.tid, _handle, ROCPROFILER_AGENT_MEMORY_ALLOC_TYPE}};
@@ -672,9 +672,9 @@ write_otf2(const OTF2Session& otf2_session,
_attr_str.emplace(get_hash_id(_perfetto_name), _perfetto_name);
auto* _attrs = create_attribute_list_for_name(_perfetto_name);
auto _extended_agent = agent_data.at(itr.agent_abs_index);
auto _handle = _extended_agent.types_agent.id.handle;
auto agent_index_info = _extended_agent.agent_index;
const auto& _extended_agent = agent_data.at(itr.agent_abs_index);
auto _handle = _extended_agent.types_agent.id.handle;
auto agent_index_info = _extended_agent.agent_index;
auto _evt_info = event_info{location_base{
process.pid, itr.tid, _handle, ROCPROFILER_AGENT_DISPATCH_TYPE, itr.queue_id}};
@@ -858,7 +858,7 @@ code_object_tracing_callback(rocprofiler_callback_tracing_record_t record,
[](auto& data_vec,
std::string file_name,
tool::rocprofiler_code_object_info_t* obj_data_v) {
data_vec.push_back({file_name,
data_vec.push_back({std::move(file_name),
obj_data_v->code_object_id,
obj_data_v->load_base,
obj_data_v->load_size});
@@ -900,7 +900,7 @@ code_object_tracing_callback(rocprofiler_callback_tracing_record_t record,
[](auto& data_vec,
std::string file_name,
tool::rocprofiler_code_object_info_t* obj_data_v) {
data_vec.push_back({file_name,
data_vec.push_back({std::move(file_name),
obj_data_v->code_object_id,
obj_data_v->load_base,
obj_data_v->load_size});
@@ -153,7 +153,7 @@ parse_cpu_info()
return 0;
};
auto value = match.back();
const auto& value = match.back();
if(itr.find("vendor_id") == 0)
info_v.vendor_id = value;
@@ -40,7 +40,7 @@ class consumer_thread_t
using consume_func_t = std::function<void(DataType&&)>;
public:
consumer_thread_t(consume_func_t func) { this->consume_fn = func; }
consumer_thread_t(consume_func_t func) { this->consume_fn = std::move(func); }
virtual ~consumer_thread_t() { exit(); }
void start()
@@ -612,7 +612,9 @@ update_table(const context_array_t& ctxs, hsa_amd_tool_table_t* _orig)
template <size_t TableIdx, size_t... OpIdx>
void
update_table(context_array_t ctxs, hsa_amd_tool_table_t* _orig, std::index_sequence<OpIdx...>)
update_table(const context_array_t& ctxs,
hsa_amd_tool_table_t* _orig,
std::index_sequence<OpIdx...>)
{
static_assert(
std::is_same<hsa_amd_tool_table_t, typename hsa_table_lookup<TableIdx>::type>::value,
@@ -67,7 +67,7 @@ set_tests_properties(
add_executable(pcs_bench_test)
target_compile_options(pcs_bench_test PRIVATE "-Ofast")
target_compile_options(pcs_bench_test PRIVATE "-O3" "-ffast-math")
target_sources(pcs_bench_test
PRIVATE ${ROCPROFILER_LIB_PC_SAMPLING_PARSER_BENCH_TEST_SOURCES})
target_include_directories(pcs_bench_test PRIVATE ${PCTEST_INCLUDE_DIR})
@@ -79,7 +79,7 @@ target_link_libraries(
GTest::gtest_main)
add_executable(pcs_thread_test)
target_compile_options(pcs_thread_test PRIVATE "-Ofast")
target_compile_options(pcs_thread_test PRIVATE "-O3" "-ffast-math")
target_sources(pcs_thread_test
PRIVATE ${ROCPROFILER_LIB_PC_SAMPLING_PARSER_MULTIGPU_TEST_SOURCES})
@@ -30,7 +30,8 @@
/**
* Benchmarks how fast the parser can process samples on a single threaded case
* Current: 5600X with -Ofast, up to >140 million samples/s or ~9GB/s R/W (18GB/s bidirectional)
* Current: 5600X with -O3 -ffast-math, up to >140 million samples/s or ~9GB/s R/W (18GB/s
* bidirectional)
*/
template <typename PcSamplingRecordT>
static bool
@@ -156,7 +156,8 @@ multithread_queue_hammer(size_t tid, Latch* latch)
/**
* Benchmarks how fast the parser can process samples on a single threaded case
* Current: 5600X with -Ofast, up to >140 million samples/s or ~9GB/s R/W (18GB/s bidirectional)
* Current: 5600X with -O3 -ffast-math, up to >140 million samples/s or ~9GB/s R/W (18GB/s
* bidirectional)
*/
template <typename PcSamplingRecordT>
static std::pair<size_t, size_t>
@@ -292,7 +292,8 @@ query_available_agents(rocprofiler_agent_version_t /* version */,
att_param.type = ROCPROFILER_THREAD_TRACE_PARAMETER_PERFCOUNTER;
att_param.simd_mask = 0xF;
for(auto& metric : metrics)
if(metric.name() == "SQ_WAVES") rocprofiler_counter_id_t{.handle = metric.id()};
if(metric.name() == "SQ_WAVES")
att_param.counter_id = rocprofiler_counter_id_t{.handle = metric.id()};
params.push_back(att_param);
}