aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/runtime/CL/CLScheduler.h
diff options
context:
space:
mode:
authorsteniu01 <steven.niu@arm.com>2017-09-27 17:00:11 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitf01f9de88c8bced98387e0c735de3c1fb27a031f (patch)
tree365e714f44c46ae854b979cbfa58d17f1b19b504 /arm_compute/runtime/CL/CLScheduler.h
parent4bd2cb8aec96de89eb9cf652b83298bf89486bca (diff)
downloadComputeLibrary-f01f9de88c8bced98387e0c735de3c1fb27a031f.tar.gz
COMPMID-545 add CL printf support
Change-Id: I685a68e7bc8d2cdff19851d839f244206b3d5790 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/89391 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@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.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/arm_compute/runtime/CL/CLScheduler.h b/arm_compute/runtime/CL/CLScheduler.h
index 11affebc48..1a7befc046 100644
--- a/arm_compute/runtime/CL/CLScheduler.h
+++ b/arm_compute/runtime/CL/CLScheduler.h
@@ -32,6 +32,28 @@
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/CLTuner.h"
+#if defined(ARM_COMPUTE_DEBUG_ENABLED)
+namespace
+{
+void printf_callback(const char *buffer, unsigned int len, size_t complete, void *user_data)
+{
+ printf("%.*s", len, buffer);
+}
+
+// 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
+};
+}
+#endif /* defined(ARM_COMPUTE_DEBUG_ENABLED) */
+
namespace arm_compute
{
class ICLKernel;
@@ -60,6 +82,10 @@ public:
*/
void default_init(ICLTuner *cl_tuner = nullptr)
{
+#if defined(ARM_COMPUTE_DEBUG_ENABLED)
+ 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());
init(cl::Context::getDefault(), cl::CommandQueue::getDefault(), cl::Device::getDefault(), cl_tuner);
}