Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bashbaug committed Jul 13, 2024
1 parent e925cb4 commit eaf7230
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions docs/controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -707,14 +707,14 @@ The Intercept Layer for OpenCL Applications will wait for this many milliseconds

### Execution Controls

##### `ExitOnEnqueueCount` (uint64_t)

If set to a nonzero value, the Intercept Layer for OpenCL Applications will exit the application on achieved enqueue count. This can be used to debug sporadic issues in applications. In case issue is not visible in identified faulting kernel, not needed to wait application normal exit

##### `NoErrors` (bool)

If set to a nonzero value, the Intercept Layer for OpenCL Applications will cause all OpenCL APIs to return a successful error status.

##### `ExitOnEnqueueCount` (uint64_t)

If set to a nonzero value, the Intercept Layer for OpenCL Applications will exit the application when the enqueue counter reaches the specified value. This can be useful to debug sporadic issues by exiting an application immediately, without needing to wait for the application to exit normally.

##### `NullContextCallback` (bool)

If set to a nonzero value, the Intercept Layer for OpenCL Applications will force the context callback to be NULL. With both context callback logging and NULL context callback set, the context callback will still be logged, but any application context callback will not be called.
Expand Down
2 changes: 1 addition & 1 deletion intercept/src/controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ CLI_CONTROL( cl_uint, AubCaptureStartWait, 0, "The
CLI_CONTROL( cl_uint, AubCaptureEndWait, 0, "The Intercept Layer for OpenCL Applications will wait for this many milliseconds before ending aub capture.")

CLI_CONTROL_SEPARATOR( Execution Controls: )
CLI_CONTROL( uint64_t, ExitOnEnqueueCount, 0, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will exit the application on achieved enqueue count. This can be used to debug sporadic issues in applications. In case issue is not visible in identified faulting kernel, not needed to wait application normal exit")
CLI_CONTROL( bool, NoErrors, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will cause all OpenCL APIs to return a successful error status." )
CLI_CONTROL( uint64_t, ExitOnEnqueueCount, 0, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will exit the application when the enqueue counter reaches the specified value. This can be useful to debug sporadic issues by exiting an application immediately, without needing to wait for the application to exit normally." )
CLI_CONTROL( bool, NullContextCallback, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will force the context callback to be NULL. With both context callback logging and NULL context callback set, the context callback will still be logged, but any application context callback will not be called." )
CLI_CONTROL( bool, FinishAfterEnqueue, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications inserts a call to clFinish() after every enqueue. The command queue that the command was just enqueued to is passed to clFinish(). This can be used to debug possible timing or resource management issues and will likely impact performance." )
CLI_CONTROL( bool, FlushAfterEnqueue, false, "If set to a nonzero value, the Intercept Layer for OpenCL Applications inserts a call to clFlush() after every enqueue. The command queue that the command was just enqueued to is passed to clFlush(). This can also be used to debug possible timing or resource management issues and is slightly less obtrusive than FinishAfterEnqueue but still will likely impact performance. If both FinishAfterEnqueue and FlushAfterEnqueue are nonzero then the Intercept Layer for OpenCL Applications will only insert a call to clFinish() after every enqueue, because clFinish() implies clFlush()." )
Expand Down
14 changes: 11 additions & 3 deletions intercept/src/intercept.h
Original file line number Diff line number Diff line change
Expand Up @@ -1947,18 +1947,26 @@ inline uint64_t CLIntercept::getEnqueueCounter() const

inline uint64_t CLIntercept::incrementEnqueueCounter()
{
uint64_t enqueueCounter = m_EnqueueCounter.load();
if( enqueueCounter != 0 ) {
if( m_Config.ExitOnEnqueueCount != 0 )
{
uint64_t enqueueCounter = m_EnqueueCounter.load();
if( enqueueCounter >= m_Config.ExitOnEnqueueCount )
{
log("Exit enqueue counter " + std::to_string(enqueueCounter) + " reached - exiting the application...\n");
// Note: we need to release the mutex before calling exit:
{
std::lock_guard<std::mutex> lock(m_Mutex);
logf("Exit enqueue counter reached (%" PRIu64 " >= %" PRIu64 "): exiting the application.\n",
enqueueCounter,
m_Config.ExitOnEnqueueCount);
}
exit(0);
}
}

uint64_t reportInterval = m_Config.ReportInterval;
if( reportInterval != 0 )
{
uint64_t enqueueCounter = m_EnqueueCounter.load();
if( enqueueCounter != 0 && enqueueCounter % reportInterval == 0 )
{
report();
Expand Down

0 comments on commit eaf7230

Please sign in to comment.