Add support for RCCL tracing (#1047)

* [Draft]: Add support for RCCL tracing

Address comments

* [Draft]: Add support for RCCL tracing

Address PR comments, changes from RCCL upstream

* Add RCCL library table registration

Working on adding support to rocprofiler-register

* Support compilation w/o <rccl/amd_detail/api_trace.h>

- dummy api_trace.h header
- return ROCPROFILER_STATUS_ERROR_NOT_IMPLEMENTED when RCCL does not have api_trace.h header

* RCCL API tracing tool support

- add to rocprofv3
- add to json-tool

---------

Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Αυτή η υποβολή περιλαμβάνεται σε:
Mythreya
2024-09-11 22:42:58 -07:00
υποβλήθηκε από GitHub
γονέας 72cbcedc9e
υποβολή 2a146259c7
43 αρχεία άλλαξαν με 2270 προσθήκες και 30 διαγραφές
@@ -43,6 +43,7 @@
#include "lib/rocprofiler-sdk/page_migration/page_migration.hpp"
#include "lib/rocprofiler-sdk/pc_sampling/code_object.hpp"
#include "lib/rocprofiler-sdk/pc_sampling/service.hpp"
#include "lib/rocprofiler-sdk/rccl/rccl.hpp"
#include <rocprofiler-sdk/context.h>
#include <rocprofiler-sdk/fwd.h>
@@ -846,6 +847,25 @@ rocprofiler_set_api_table(const char* name,
rocprofiler::intercept_table::notify_intercept_table_registration(
ROCPROFILER_MARKER_NAME_TABLE, lib_version, lib_instance, std::make_tuple(roctx_name));
}
else if(std::string_view{name} == "rccl")
{
// pass to rccl init
ROCP_ERROR_IF(num_tables > 1)
<< "rocprofiler expected RCCL library to pass 1 API table, not " << num_tables;
auto* rccl_api = static_cast<rcclApiFuncTable*>(tables[0]);
// any internal modifications to the rcclApiFuncTable need to be done before we make the
// copy or else those modifications will be lost when RCCL API tracing is enabled
// because the RCCL API tracing invokes the function pointers from the copy below
rocprofiler::rccl::copy_table(rccl_api, lib_instance);
// install rocprofiler API wrappers
rocprofiler::rccl::update_table(rccl_api);
rocprofiler::intercept_table::notify_intercept_table_registration(
ROCPROFILER_RCCL_TABLE, lib_version, lib_instance, std::make_tuple(rccl_api));
}
else
{
ROCP_ERROR << "rocprofiler does not accept API tables from " << name;