Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface proposal : pull request 3 #59

Open
wants to merge 8 commits into
base: rocm-4.3.x
Choose a base branch
from

Conversation

yoann-heitz
Copy link

@yoann-heitz yoann-heitz commented Sep 23, 2021

This is the third pull request for the proposal for a plugin interface for the rocprof command. In this pull request, the signatures of the flushing functions are standardized for every API/kind of event.

The signatures of all flushing functions are now of this kind : void <API>_flush_cb( <API>_trace_entry_t *entry)
Where <API> is the kind of event or API that is traced and <API>_trace_entry_t is a wrapping data structure containing the payloads of the traced events.

Relative to the second pull request, this one starts at commit 77d23b6

Replaced all C++ standard vectors with C arrays in functions used to enable fine-grained control. These vectors appeared to be empty at the moment when roctracer_enable_op_callback is called in OnLoad function. This may be due to the fact that this function is called by another .so or DLL library and exchanging STL objects (like C++ vectors) through these kinds of libraries can lead to unexpected behavior when the libraries were not compiled with the same compiler and compiler version. The use of C native objects can solve these issues.
Added a ring buffer to trace KFD API and separated lines of code dedicated to flushing into text from lines of code dedicated to collecting events data for KFD API. Added a new structure to store KFD events data into the newly added buffer. This commit aims for rocprof to have the same behavior when tracing KFD API as when tracing HSA or HIP APIs.
In some cases (if ROCTX_CLOCK_TIME is defined), the timestamp of the rocTX event must be processed before flushing the data. This commit aims to separate the computation of the timestamp from the flushing part : a wrapping function is defined to do it and the roctx_flush_cb function only contains operation on C++ string streams and flushing instructions
Index incrementation was initially done inside HSA activity flushing function. Separated the flushing instructions from the index incrementation with a wrapping function. The pid is also given as a parameter to the flushing function.
When collecting statistics about HIP API, the initial flushing function also fills an EvtStats structure. With this commit, flushing instruction are wrapped into another function that is called after this structure is filled if needed. The flushing function only contains flushing instructions in this commit.
Instructions for flushing HIP activities informations into hcc_ops_trace.txt have been put into a wrapping function
Updated HSA activity flushing function signature in order to have a standard signature for all flushing functions. The function name has been changed and a wrapping data structure has been defined and is now the only one parameter for the new function
As for HSA activity, a new data structure has been defined and the signature updated to conform to other flushing functions signatures. The new datatype is named hip_activity_trace_entry_t. Another similar type (hip_act_trace_entry_t) is already defined to collect HIP activity statistics into a csv file. To avoid confusions, these two types could be merged or the name of one of them could be changed in a future patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant