-
Notifications
You must be signed in to change notification settings - Fork 34
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 5 #61
Open
yoann-heitz
wants to merge
22
commits into
ROCm:rocm-4.3.x
Choose a base branch
from
dorsal-lab:rocm-4.3.x-PR5
base: rocm-4.3.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Definition of roctx_trace_entry_t has been moved to a new header. This new header will contain the definitions of all the <API>_trace_entry_t types used to flush the payloads of the events. The purpose of this modification is to have only one header that needs to be included by developers that want to implement new plugins with the interface proposal. Some fields types of the <API>_trace_entry_t structures are defined either in tool.cpp or in headers lying in /src/core (/src/core/trace_buffer.h). Since trace_buffer.h is removed once ROCTrace has been installed, the definition of these types has been moved to the new header and deleted from the ancient header to avoid redefinition issues.
This modification allows to copy the new header to /opt/rocm/roctracer/include and /opt/rocm/include/roctracer when installing ROCTracer
When specifying --output-plugin with rocprof command, the default rocTX flushing function is overloaded and the original text file is not created
This was done in the same way as with rocTX. However a new wrapping function that will call the overloaded function is defined and used as callback function since the callback flushing function must be constant and can not directly be overloaded.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is the last pull request for the interface proposal. It adds instructions to overload user-defined flushing functions (that respect some specifications).
An example of a CTF plugin can be found here : https://github.com/dorsal-lab/rocprofiler_ctf_plugin/tree/rocm-4.3.x-PR5 (be sure to use the rocm-4.3.x-PR5 branch for tests).
Relative to the fourth pull request, this one starts at commit 0d36ffa