diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-20 16:48:56 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-20 16:48:56 +1000 |
commit | a62682d2d151ca75c3f1bd1be57a197d6d9fed1d (patch) | |
tree | ac0b07ba47615419d4b79c72607a17c81dc0c76f | |
parent | 7875ca3dafea377f6b496105b25d3ade1818aafc (diff) |
Add OpenCL 1.1 preferred work size query to QCLKernel
-rw-r--r-- | src/opencl/qclext_p.h | 3 | ||||
-rw-r--r-- | src/opencl/qclkernel.cpp | 20 | ||||
-rw-r--r-- | src/opencl/qclkernel.h | 2 |
3 files changed, 25 insertions, 0 deletions
diff --git a/src/opencl/qclext_p.h b/src/opencl/qclext_p.h index 68a17b7..a50df50 100644 --- a/src/opencl/qclext_p.h +++ b/src/opencl/qclext_p.h @@ -90,6 +90,9 @@ #ifndef CL_MEM_OFFSET #define CL_MEM_OFFSET 0x1108 #endif +#ifndef CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE +#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3 +#endif // OpenCL-OpenGL sharing. #ifndef CL_INVALID_CL_SHAREGROUP_REFERENCE_KHR diff --git a/src/opencl/qclkernel.cpp b/src/opencl/qclkernel.cpp index b63cc02..aceaa9f 100644 --- a/src/opencl/qclkernel.cpp +++ b/src/opencl/qclkernel.cpp @@ -43,6 +43,7 @@ #include "qclprogram.h" #include "qclbuffer.h" #include "qclcontext.h" +#include "qclext_p.h" #include <QtCore/qvarlengtharray.h> #include <QtCore/qpoint.h> #include <QtGui/qvector2d.h> @@ -510,6 +511,25 @@ QCLWorkSize QCLKernel::bestLocalWorkSizeImage3D() const } /*! + Returns the preferred work group size multiple, which is a + performance hint for the local work group size on OpenCL 1.1 + systems. Returns zero if the system is OpenCL 1.0, or a + preferred work group size multiple is not available. +*/ +size_t QCLKernel::preferredWorkSizeMultiple() const +{ + Q_D(const QCLKernel); + size_t size; + if (clGetKernelWorkGroupInfo + (d->id, d->context->defaultDevice().deviceId(), + CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE, + sizeof(size), &size, 0) != CL_SUCCESS) + return 0; + else + return size; +} + +/*! Sets argument \a index for this kernel to \a value. The argument is assumed to have been declared with the diff --git a/src/opencl/qclkernel.h b/src/opencl/qclkernel.h index 9ad1d1e..f0721c0 100644 --- a/src/opencl/qclkernel.h +++ b/src/opencl/qclkernel.h @@ -109,6 +109,8 @@ public: QCLWorkSize bestLocalWorkSizeImage2D() const; QCLWorkSize bestLocalWorkSizeImage3D() const; + size_t preferredWorkSizeMultiple() const; + void setArg(int index, cl_int value); void setArg(int index, cl_uint value); void setArg(int index, cl_long value); |