Skip to content

Commit e925cb4

Browse files
authored
Add ExitOnEnqueueCount control (#371)
* Add StopOnEnqueueCount control 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> * add ExitOnEnqueueCount control If set to nonzero value, application will be forced to exit on achieved enqueue count. This can be used to debug sporadic applications issues. In case issue is not visible on specified enqueue, not needed to wait application normal exit. Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com> --------- Signed-off-by: Igor Venevtsev <igor.venevtsev@intel.com>
1 parent d36a5cc commit e925cb4

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

docs/controls.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,10 @@ The Intercept Layer for OpenCL Applications will wait for this many milliseconds
707707

708708
### Execution Controls
709709

710+
##### `ExitOnEnqueueCount` (uint64_t)
711+
712+
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
713+
710714
##### `NoErrors` (bool)
711715

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

intercept/src/controls.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ CLI_CONTROL( cl_uint, AubCaptureStartWait, 0, "The
172172
CLI_CONTROL( cl_uint, AubCaptureEndWait, 0, "The Intercept Layer for OpenCL Applications will wait for this many milliseconds before ending aub capture.")
173173

174174
CLI_CONTROL_SEPARATOR( Execution Controls: )
175+
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")
175176
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." )
176177
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." )
177178
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." )

intercept/src/intercept.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1947,10 +1947,18 @@ inline uint64_t CLIntercept::getEnqueueCounter() const
19471947

19481948
inline uint64_t CLIntercept::incrementEnqueueCounter()
19491949
{
1950+
uint64_t enqueueCounter = m_EnqueueCounter.load();
1951+
if( enqueueCounter != 0 ) {
1952+
if( enqueueCounter >= m_Config.ExitOnEnqueueCount )
1953+
{
1954+
log("Exit enqueue counter " + std::to_string(enqueueCounter) + " reached - exiting the application...\n");
1955+
exit(0);
1956+
}
1957+
}
1958+
19501959
uint64_t reportInterval = m_Config.ReportInterval;
19511960
if( reportInterval != 0 )
19521961
{
1953-
uint64_t enqueueCounter = m_EnqueueCounter.load();
19541962
if( enqueueCounter != 0 && enqueueCounter % reportInterval == 0 )
19551963
{
19561964
report();

0 commit comments

Comments
 (0)