Skip to content

Commit

Permalink
Add StopOnEnqueueCount control
Browse files Browse the repository at this point in the history
If set, CLIntercept will terminate the application on achieved enqueue count.
Useful to debug applications with sporadic issues.

Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
  • Loading branch information
ivvenevt committed Jul 2, 2024
1 parent 29d98c3 commit 24392b2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/controls.md
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,10 @@ The Intercept Layer for OpenCL Applications will wait for this many milliseconds

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

##### `StopOnEnqueueCount` (cl_uint)

If set, CLIntercept will terminate the application on achieved enqueue count. Useful to debug sporadic issues in applications. In case issue is not visible in identified faulting kernel, not needed to wait application normal exit.

##### `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
1 change: 1 addition & 0 deletions intercept/src/controls.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ 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(cl_uint, StopOnEnqueueCount, UINT_MAX, "If set, CLIntercept will exit the application on achieved enqueue count")
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( 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." )
Expand Down
7 changes: 6 additions & 1 deletion intercept/src/intercept.h
Original file line number Diff line number Diff line change
Expand Up @@ -1947,10 +1947,15 @@ inline uint64_t CLIntercept::getEnqueueCounter() const

inline uint64_t CLIntercept::incrementEnqueueCounter()
{
uint64_t enqueueCounter = m_EnqueueCounter.load();
if( enqueueCounter == m_Config.StopOnEnqueueCount ) {
log(">>> Stop enqueue counter " + std::to_string(enqueueCounter) + " reached - terminating application...\n");
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 24392b2

Please sign in to comment.