aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/CLScheduler.h
diff options
context:
space:
mode:
authorVidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com>2018-04-10 12:23:22 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:49:16 +0000
commiteb8a399ba655b85c6854676832eb11b0af4108fe (patch)
tree9d3c6d9f4979036ce5d828a61eaaf0d3df2e566f /arm_compute/runtime/CL/CLScheduler.h
parent3ebef32816435516f68cefba689dba7216464154 (diff)
downloadComputeLibrary-eb8a399ba655b85c6854676832eb11b0af4108fe.tar.gz
COMPMID-994 : Check cl_arm_printf is supported in the CLScheduler
Introduced static and dynamic checks before using printf vendor extension features (callbacks and buffers) Change-Id: Ib38cb3d8591bbb482d02a41918f4b52efde75267 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/126751 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/runtime/CL/CLScheduler.h')
-rw-r--r--arm_compute/runtime/CL/CLScheduler.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h
index e1e7ff637f..2fe3c2cf42 100644
--- a/arm_compute/runtime/CL/CLScheduler.h
+++ b/arm_compute/runtime/CL/CLScheduler.h
@@ -73,18 +73,28 @@ public:
if(!_is_initialised)
{
#if defined(ARM_COMPUTE_DEBUG_ENABLED)
- // Create a cl_context with a printf_callback and user specified buffer size.
- cl_context_properties properties[] =
+ bool is_cl_arm_printf_supported = false;
+
+ //query devices in the context for cl_arm_printf support
+ std::vector<cl::Device> def_platform_devices;
+ cl::Platform::getDefault().getDevices(CL_DEVICE_TYPE_DEFAULT, &def_platform_devices);
+ is_cl_arm_printf_supported = device_supports_extension(def_platform_devices[0], "cl_arm_printf");
+
+ if(is_cl_arm_printf_supported)
{
- // Enable a printf callback function for this context.
- CL_PRINTF_CALLBACK_ARM, reinterpret_cast<cl_context_properties>(printf_callback),
- // Request a minimum printf buffer size of 4MB for devices in the
- // context that support this extension.
- CL_PRINTF_BUFFERSIZE_ARM, static_cast<cl_context_properties>(0x100000),
- CL_CONTEXT_PLATFORM, reinterpret_cast<cl_context_properties>(cl::Platform::get()()),
- 0
- };
- cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT, properties));
+ // Create a cl_context with a printf_callback and user specified buffer size.
+ cl_context_properties properties[] =
+ {
+ // Enable a printf callback function for this context.
+ CL_PRINTF_CALLBACK_ARM, reinterpret_cast<cl_context_properties>(printf_callback),
+ // Request a minimum printf buffer size of 4MB for devices in the
+ // context that support this extension.
+ CL_PRINTF_BUFFERSIZE_ARM, static_cast<cl_context_properties>(0x100000),
+ CL_CONTEXT_PLATFORM, reinterpret_cast<cl_context_properties>(cl::Platform::get()()),
+ 0
+ };
+ cl::Context::setDefault(cl::Context(CL_DEVICE_TYPE_DEFAULT, properties));
+ }
#endif // defined(ARM_COMPUTE_DEBUG_ENABLED)
CLKernelLibrary::get().init("./cl_kernels/", cl::Context::getDefault(), cl::Device::getDefault());