Skip to content

Commit

Permalink
Roctracer events show up out of order (#990)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #990

Add debug to show that some events in roctracer can start before the previous one ends

Differential Revision: D63033163
  • Loading branch information
sraikund16 authored and facebook-github-bot committed Sep 19, 2024
1 parent 3d355d1 commit c091960
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libkineto/src/RoctracerLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ void RoctracerLogger::activity_callback(const char* begin, const char* end, void
std::unique_lock<std::mutex> lock(s_flush.mutex_);
const roctracer_record_t* record = (const roctracer_record_t*)(begin);
const roctracer_record_t* end_record = (const roctracer_record_t*)(end);

static uint64_t last_end = 0;
static std::string last_kernel_name = "";
while (record < end_record) {
if (record->correlation_id > s_flush.maxCompletedCorrelationId_) {
s_flush.maxCompletedCorrelationId_ = record->correlation_id;
Expand All @@ -320,6 +321,11 @@ void RoctracerLogger::activity_callback(const char* begin, const char* end, void
? demangle(record->kernel_name)
: std::string()
);
if (record->begin_ns < last_end && !row->kernelName.empty() && !last_kernel_name.empty()) {
LOG(WARNING) << "Out of order activity: " << record->begin_ns << " < " << last_end << ". Difference: " << (last_end - record->begin_ns) << " ns. Kernel: " << row->kernelName << " last Kernel: " << last_kernel_name;
}
last_end = record->end_ns;
last_kernel_name = row->kernelName;
insert_row_to_buffer(row);
roctracer_next_record(record, &record);
}
Expand Down

0 comments on commit c091960

Please sign in to comment.