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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How was this working at all? How can
add_events_per_gpu
take a state object that is created only after?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nvpw_cuda_metricscontext_create
creates CUPTI metrics contexts which are needed for enumeration of metrics, and not required by add events. Before, if add events failed, the function would exit without creating these, and on exit the component would try to destroy these and fail with segfault. So Creating these before add events successfully destroys these.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think naming is a little confusing. My interpretation of the code was that state is the control state object and
nvpw_cuda_metricscontext_create
creates the control state object, whileadd_events_per_gpu
adds events to the control state object.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cuptip_control_create
creates thestate
object, then callsnvpw_cuda_metricscontext_create
thenadd_events_per_gpu
.nvpw_cuda_metricscontext_create
creates the CUPTI MetricsContext object as members of the state object. The naming might be confusing because too many things are called "context".