[rocprofv3] Add rocpd output support (part 1: prelude) (#401)

* [rocprofv3] Add rocpd output support (part 1: prelude)

- git submodules for sqlite3, GOTCHA, and pybind11
- HIP stream data
- rocprofiler_query_intercept_table_name(...)
- serialization load
- rocprofiler::sdk::get_perfetto_category(KindT)
- rocprofiler::sdk::parse::strip
- common library updates
  - md5sum
  - hasher
  - simple_timer
  - static_tl_object
  - get_process_start_time_ns(pid_t)
- output library updates
  - node_info
  - file_generator (generator is now virtual base class)
  - stream info updates

* Added submodules

* Code review updates

* Minor unused-but-set-X warning fixes

* Update CI

- install libsqlite3-dev package

* Update CI

- install libsqlite3-dev package

* Fix static thread-local object memory leak

- also fix signal handler chaining

* Remove URL from comment

* Remove page migration exception

* Enable ROCPROFILER_BUILD_SQLITE3 by default

- try find_package(SQLite3) first and then build when ROCPROFILER_BUILD_SQLITE3=ON

* Fix gotcha installation

- make install of target optional

* Validate tracing + counter collection dispatch data

- i.e. correlation ids, thread ids, timestamps

* Make find_package(SQLite3) optional

- ROCm CI does not have SQLite3 dev package installed and cannot build from source (missing tclsh)

* Fixes to tracing + counter collection test

* get_process_start_time_ns update

- original implementation did not work

* Fix pytest-packages test_perfetto_data for counter collection

- erroneous failure when used with same PMC + multiple agents

* cmake policy: option() honors normal variables

- for GOTCHA submodule

* Improve samples/api_buffered_tracing stability

- reduce likelihood of sporadic exception throw

* Update gotcha submodule

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
This commit is contained in:
Madsen, Jonathan
2025-05-18 20:11:26 -05:00
committed by GitHub
parent 65786f619d
commit 7166b1ab58
86 changed files with 4120 additions and 1730 deletions
@@ -50,6 +50,29 @@ namespace
template <rocprofiler_intercept_table_t... Idx>
using library_sequence_t = std::integer_sequence<rocprofiler_intercept_table_t, Idx...>;
#define ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(TABLE, NAME) \
template <> \
struct intercept_table_info<ROCPROFILER_##TABLE##_TABLE> \
{ \
static constexpr auto value = ROCPROFILER_##TABLE##_TABLE; \
static constexpr auto name = NAME; \
static constexpr auto length = std::string_view{NAME}.length(); \
static constexpr auto data = std::pair<const char*, size_t>{name, length}; \
};
template <rocprofiler_intercept_table_t Idx>
struct intercept_table_info;
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(HSA, "HSA")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(HIP_RUNTIME, "HIP (runtime)")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(HIP_COMPILER, "HIP (compiler)")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(MARKER_CORE, "MARKER (ROCTx)")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(MARKER_CONTROL, "MARKER (ROCTx Control)")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(MARKER_NAME, "MARKER (ROCTx Name)")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(RCCL, "RCCL")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(ROCDECODE, "rocDecode")
ROCPROFILER_INTERCEPT_TABLE_KIND_STRING(ROCJPEG, "rocJPEG")
// this is used to loop over the different libraries
constexpr auto intercept_library_seq = library_sequence_t<ROCPROFILER_HSA_TABLE,
ROCPROFILER_HIP_RUNTIME_TABLE,
@@ -85,6 +108,25 @@ get_intercept()
return _v;
}
// adds callbacks to intercept instance(s)
template <rocprofiler_intercept_table_t Idx, rocprofiler_intercept_table_t... Tail>
auto
get_intercept_table_info(rocprofiler_intercept_table_t kind, library_sequence_t<Idx, Tail...>)
{
using info_type = intercept_table_info<Idx>;
using return_type = decltype(info_type::data);
if(info_type::value == kind)
{
return info_type::data;
}
if constexpr(sizeof...(Tail) > 0)
return get_intercept_table_info(kind, library_sequence_t<Tail...>{});
return return_type{nullptr, 0};
}
// adds callbacks to intercept instance(s)
template <rocprofiler_intercept_table_t... Idx>
void
@@ -208,6 +250,20 @@ template void notify_intercept_table_registration(rocprofiler_intercept_table_t,
} // namespace rocprofiler
extern "C" {
rocprofiler_status_t
rocprofiler_query_intercept_table_name(rocprofiler_intercept_table_t kind,
const char** name,
uint64_t* name_len)
{
auto&& val = rocprofiler::intercept_table::get_intercept_table_info(
kind, rocprofiler::intercept_table::intercept_library_seq);
if(name) *name = val.first;
if(name_len) *name_len = val.second;
return (val.first) ? ROCPROFILER_STATUS_SUCCESS : ROCPROFILER_STATUS_ERROR_KIND_NOT_FOUND;
}
rocprofiler_status_t
rocprofiler_at_intercept_table_registration(rocprofiler_intercept_library_cb_t callback,
int libs,