From c9a10729ad9d6b6fd3e4c81e22b67cda5b69952c Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Tue, 24 Feb 2026 21:59:39 -0800 Subject: [PATCH 1/3] apply host performance timing limits to chrome call logging --- intercept/src/intercept.cpp | 1 + intercept/src/intercept.h | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index 847ef2db..c62727c5 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -4045,6 +4045,7 @@ void CLIntercept::eventCallbackCaller( pIntercept->enumName().name_command_exec_status( status ).c_str(), status ); + const bool doHostPerformanceTiming = true; clock::time_point cpuStart = clock::now(); pIntercept->eventCallback( diff --git a/intercept/src/intercept.h b/intercept/src/intercept.h index 612a5708..692f9a09 100644 --- a/intercept/src/intercept.h +++ b/intercept/src/intercept.h @@ -2144,7 +2144,7 @@ inline CObjectTracker& CLIntercept::objectTracker() NULL, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -2166,7 +2166,7 @@ inline CObjectTracker& CLIntercept::objectTracker() NULL, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -2188,7 +2188,7 @@ inline CObjectTracker& CLIntercept::objectTracker() NULL, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ @@ -2210,7 +2210,7 @@ inline CObjectTracker& CLIntercept::objectTracker() sync_point, \ ##__VA_ARGS__ ); \ } \ - if( pIntercept->config().ChromeCallLogging ) \ + if( pIntercept->config().ChromeCallLogging && doHostPerformanceTiming ) \ { \ pIntercept->chromeCallLoggingExit( \ __FUNCTION__, \ From 0868128ebbe44dbaeb5d972b0af9cbf28ac3c87a Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Tue, 24 Feb 2026 22:43:54 -0800 Subject: [PATCH 2/3] fix a few more places where host performance timing limits should apply --- intercept/src/intercept.cpp | 7 ++----- intercept/src/intercept.h | 14 +++++++------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index c62727c5..2e4c098e 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -4044,9 +4044,7 @@ void CLIntercept::eventCallbackCaller( event, pIntercept->enumName().name_command_exec_status( status ).c_str(), status ); - - const bool doHostPerformanceTiming = true; - clock::time_point cpuStart = clock::now(); + HOST_PERFORMANCE_TIMING_START(); pIntercept->eventCallback( event, @@ -4059,8 +4057,7 @@ void CLIntercept::eventCallbackCaller( pEventCallbackInfo->pUserData ); } - clock::time_point cpuEnd = clock::now(); - + HOST_PERFORMANCE_TIMING_END(); CALL_LOGGING_EXIT( CL_SUCCESS ); delete pEventCallbackInfo; diff --git a/intercept/src/intercept.h b/intercept/src/intercept.h index 692f9a09..7801cbc7 100644 --- a/intercept/src/intercept.h +++ b/intercept/src/intercept.h @@ -3262,10 +3262,10 @@ inline bool CLIntercept::checkHostPerformanceTimingEnqueueLimits( #define HOST_PERFORMANCE_TIMING_START() \ CLIntercept::clock::time_point cpuStart, cpuEnd; \ bool doHostPerformanceTiming = \ - pIntercept->config().ChromeCallLogging || \ - ( pIntercept->config().HostPerformanceTiming && \ - pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ - pIntercept->checkConditionalTiming() ); \ + ( pIntercept->config().ChromeCallLogging || \ + pIntercept->config().HostPerformanceTiming ) && \ + pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ + pIntercept->checkConditionalTiming(); \ if( doHostPerformanceTiming ) \ { \ cpuStart = CLIntercept::clock::now(); \ @@ -3304,9 +3304,9 @@ inline bool CLIntercept::checkHostPerformanceTimingEnqueueLimits( bool doToolOverheadTiming = \ pIntercept->config().ToolOverheadTiming && \ ( pIntercept->config().ChromeCallLogging || \ - ( pIntercept->config().HostPerformanceTiming && \ - pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ - pIntercept->checkConditionalTiming() ) ); \ + pIntercept->config().HostPerformanceTiming ) && \ + pIntercept->checkHostPerformanceTimingEnqueueLimits( enqueueCounter ) &&\ + pIntercept->checkConditionalTiming(); \ if( doToolOverheadTiming ) \ { \ toolStart = CLIntercept::clock::now(); \ From f39e24b52ee9517307f58bf9b03ab8db4d057dee Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Tue, 24 Feb 2026 22:46:33 -0800 Subject: [PATCH 3/3] clarify that ChromeCallLogging also includes host performance timing --- docs/controls.md | 2 +- intercept/src/controls.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/controls.md b/docs/controls.md index 94011c42..c8a53f69 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -203,7 +203,7 @@ If set to a nonzero value, flushes buffered JSON records for Chrome Tracing afte ##### `ChromeCallLogging` (bool) -If set to a nonzero value, logs function entry and exit information for every OpenCL call to a JSON file that may be used for Chrome Tracing. +If set to a nonzero value, logs function entry and exit information and host performance timing for every OpenCL call to a JSON file that may be used for Chrome Tracing. ##### `ChromeFlowEvents` (bool) diff --git a/intercept/src/controls.h b/intercept/src/controls.h index 4115d176..8a66ba03 100644 --- a/intercept/src/controls.h +++ b/intercept/src/controls.h @@ -32,7 +32,7 @@ CLI_CONTROL( bool, CallLoggingElapsedTime, false, "If s CLI_CONTROL( bool, ITTCallLogging, false, "If set to a nonzero value, logs function entry and exit information for every OpenCL call using the ITT APIs. This feature will only function if the Intercept Layer for OpenCL Applications is built with ITT support." ) CLI_CONTROL( cl_uint, ChromeTraceBufferSize, 16384, "If set to a nonzero value, buffers JSON records for Chrome Tracing in memory before writing to a file. The buffer will be flushed when it fills, upon application termination, and optionally on blocking OpenCL calls.") CLI_CONTROL( bool, ChromeTraceBufferingBlockingCallFlush, true, "If set to a nonzero value, flushes buffered JSON records for Chrome Tracing after blocking OpenCL calls.") -CLI_CONTROL( bool, ChromeCallLogging, false, "If set to a nonzero value, logs function entry and exit information for every OpenCL call to a JSON file that may be used for Chrome Tracing." ) +CLI_CONTROL( bool, ChromeCallLogging, false, "If set to a nonzero value, logs function entry and exit information and host performance timing for every OpenCL call to a JSON file that may be used for Chrome Tracing." ) CLI_CONTROL( bool, ChromeFlowEvents, false, "If set to a nonzero value, adds flow events between OpenCL calls and OpenCL commands in a JSON file that may be used for Chrome Tracing. Requires both ChromeCallLogging and ChromePerformanceTiming." ) CLI_CONTROL( bool, ErrorLogging, false, "If set to a nonzero value, logs all OpenCL errors and the function name that caused the error." ) CLI_CONTROL( bool, ErrorAssert, false, "If set to a nonzero value, breaks into the debugger when an OpenCL error occurs." )