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.
Summary:
Right now we take the TIDs returned from CUPTI and convert them from int64_t to int32_t which results in negative tids. Because Perfetto uses int32_t in its protobuf files (according to google/perfetto#886) we can't just convert to uint32_t because perfetto will just convert values back into their negative counterparts. To fix this, we convert to only positive values in int32_t by finding the absolute value of the original int32_t representation of the tid. We also make a special case for INT_MIN to map to 0 so that it is apparent how we handle overflow.
We add this sanitization to all tid outputs for hygiene purposes instead of just CUPTI output.
Differential Revision: D64490195