diff --git a/docs/controls.md b/docs/controls.md index 51e159f0..94011c42 100644 --- a/docs/controls.md +++ b/docs/controls.md @@ -129,6 +129,12 @@ The old name may still be used for backwards compatibility, but switching to the If set to a nonzero value, the Intercept Layer for OpenCL Applications will break into the debugger when it is loaded. +### Tracing Controls + +##### `BetaExtensionIntercepting` (bool) + +If set to a nonzero value, the Intercept Layer for OpenCL Applications will intercept extension APIs for beta extensions that are subject to change. If an application uses beta extensions and does not function correctly with the Intercept Layer for OpenCL Applications, setting this control to zero may allow the application to function correctly, albeit without the ability to debug and analyze the beta extension APIs. + ### Logging Controls ##### `SuppressLogging` (bool) diff --git a/intercept/src/controls.h b/intercept/src/controls.h index d4033189..4115d176 100644 --- a/intercept/src/controls.h +++ b/intercept/src/controls.h @@ -12,6 +12,9 @@ #define CLI_CONTROL_SEPARATOR( _name ) #endif +CLI_CONTROL_SEPARATOR( Tracing Controls: ) +CLI_CONTROL( bool, BetaExtensionIntercepting, true, "If set to a nonzero value, the Intercept Layer for OpenCL Applications will intercept extension APIs for beta extensions that are subject to change. If an application uses beta extensions and does not function correctly with the Intercept Layer for OpenCL Applications, setting this control to zero may allow the application to function correctly, albeit without the ability to debug and analyze the beta extension APIs." ) + CLI_CONTROL_SEPARATOR( Logging Controls: ) CLI_CONTROL( bool, SuppressLogging, false, "If set to a nonzero value, suppresses all logging output from the Intercept Layer for OpenCL Applications. This is particularly useful for tools that only want report data." ) CLI_CONTROL( bool, AppendFiles, false, "By default, the Intercept Layer for OpenCL Applications log files will be created from scratch when the intercept DLL is loaded, and any Intercept Layer for OpenCL Applications report files will be created from scratch when the intercept DLL is unloaded. If AppendFiles is set to a nonzero value, the Intercept Layer for OpenCL Applications will append to an existing file instead of recreating it. This can be useful if an application loads and unloads the intercept DLL multiple times, or to simply preserve log or report data from run-to-run." ) diff --git a/intercept/src/intercept.cpp b/intercept/src/intercept.cpp index 6af66c33..2421ad23 100644 --- a/intercept/src/intercept.cpp +++ b/intercept/src/intercept.cpp @@ -13658,31 +13658,40 @@ void* CLIntercept::getExtensionFunctionAddress( CHECK_RETURN_EXTENSION_FUNCTION( clEnqueueReleaseDX9MediaSurfacesKHR ); #endif - // cl_khr_command_buffer - CHECK_RETURN_EXTENSION_FUNCTION( clCreateCommandBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clFinalizeCommandBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clRetainCommandBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clReleaseCommandBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clEnqueueCommandBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandBarrierWithWaitListKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyBufferRectKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyBufferToImageKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyImageKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyImageToBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandFillBufferKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandFillImageKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandSVMMemcpyKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandSVMMemFillKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clCommandNDRangeKernelKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clGetCommandBufferInfoKHR ); - - // cl_khr_command_buffer_multi_device - CHECK_RETURN_EXTENSION_FUNCTION( clRemapCommandBufferKHR ); - - // cl_khr_command_buffer_mutable_dispatch - CHECK_RETURN_EXTENSION_FUNCTION( clUpdateMutableCommandsKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clGetMutableCommandInfoKHR ); + // cl_khr_command_buffer (beta) + if( config().BetaExtensionIntercepting ) + { + CHECK_RETURN_EXTENSION_FUNCTION( clCreateCommandBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clFinalizeCommandBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clRetainCommandBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clReleaseCommandBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clEnqueueCommandBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandBarrierWithWaitListKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyBufferRectKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyBufferToImageKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyImageKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandCopyImageToBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandFillBufferKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandFillImageKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandSVMMemcpyKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandSVMMemFillKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clCommandNDRangeKernelKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clGetCommandBufferInfoKHR ); + } + + // cl_khr_command_buffer_multi_device (beta) + if( config().BetaExtensionIntercepting ) + { + CHECK_RETURN_EXTENSION_FUNCTION( clRemapCommandBufferKHR ); + } + + // cl_khr_command_buffer_mutable_dispatch (beta) + if( config().BetaExtensionIntercepting ) + { + CHECK_RETURN_EXTENSION_FUNCTION( clUpdateMutableCommandsKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clGetMutableCommandInfoKHR ); + } // cl_khr_create_command_queue CHECK_RETURN_EXTENSION_FUNCTION( clCreateCommandQueueWithPropertiesKHR ); @@ -13726,11 +13735,14 @@ void* CLIntercept::getExtensionFunctionAddress( // cl_khr_suggested_local_work_size CHECK_RETURN_EXTENSION_FUNCTION( clGetKernelSuggestedLocalWorkSizeKHR ); - // cl_khr_unified_svm - CHECK_RETURN_EXTENSION_FUNCTION( clSVMAllocWithPropertiesKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clSVMFreeWithPropertiesKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMPointerInfoKHR ); - CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMSuggestedTypeIndexKHR ); + // cl_khr_unified_svm (beta) + if( config().BetaExtensionIntercepting ) + { + CHECK_RETURN_EXTENSION_FUNCTION( clSVMAllocWithPropertiesKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clSVMFreeWithPropertiesKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMPointerInfoKHR ); + CHECK_RETURN_EXTENSION_FUNCTION( clGetSVMSuggestedTypeIndexKHR ); + } // cl_ext_buffer_device_address CHECK_RETURN_EXTENSION_FUNCTION( clSetKernelArgDevicePointerEXT );