Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pvelesko committed Aug 29, 2024
1 parent 3790ccd commit 8946619
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend/OpenCL/CHIPBackendOpenCL.cc
Original file line number Diff line number Diff line change
Expand Up @@ -807,19 +807,25 @@ float CHIPEventOpenCL::getElapsedTime(chipstar::Event *OtherIn) {

// Handle overflow
const uint64_t MaxValue = std::numeric_limits<uint64_t>::max();
bool overflow = false;

Check warning on line 810 in src/backend/OpenCL/CHIPBackendOpenCL.cc

View workflow job for this annotation

GitHub Actions / cpp-linter

src/backend/OpenCL/CHIPBackendOpenCL.cc:810:8 [readability-identifier-naming]

invalid case style for local variable 'overflow'
if (EndGPU < BeginGPU) {
logError("Overflow detected in CHIPEventOpenCL::getElapsedTime()");
EndGPU += MaxValue - BeginGPU;
overflow = true;
}

int64_t Elapsed = EndGPU - BeginGPU;
if (overflow) {
logError("Overflow detected in CHIPEventOpenCL::getElapsedTime()");
}

const int64_t NANOSECS = 1000000000;
int64_t MS = (Elapsed / NANOSECS) * 1000;
int64_t NS = Elapsed % NANOSECS;
float FractInMS = ((float)NS) / 1000000.0f;
float Ms = (float)MS + FractInMS;

if (ReversedEvents)
if (ReversedEvents && !overflow)

Check warning on line 828 in src/backend/OpenCL/CHIPBackendOpenCL.cc

View workflow job for this annotation

GitHub Actions / cpp-linter

src/backend/OpenCL/CHIPBackendOpenCL.cc:828:35 [readability-braces-around-statements]

statement should be inside braces
Ms = -Ms;

return Ms;
Expand Down

0 comments on commit 8946619

Please sign in to comment.