diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-20 10:15:49 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-20 10:16:02 +1000 |
commit | 7045dbb981f535346699c06bb77449e9070b9255 (patch) | |
tree | 091e0289f51cfc91488e713b2c09008b6ecc2cb6 | |
parent | 8c8bacd1ba2c3813316466c9067accc9f434cf81 (diff) |
Preferred half vector size device query.
-rw-r--r-- | src/opencl/qcldevice.cpp | 16 | ||||
-rw-r--r-- | src/opencl/qcldevice.h | 1 | ||||
-rw-r--r-- | util/clinfo/clinfo.cpp | 8 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/opencl/qcldevice.cpp b/src/opencl/qcldevice.cpp index 956e25a..0a90b95 100644 --- a/src/opencl/qcldevice.cpp +++ b/src/opencl/qcldevice.cpp @@ -534,6 +534,22 @@ int QCLDevice::preferredDoubleVectorSize() const } /*! + Returns the preferred size for vectors of type \c{half} + in the device. For example, 2 indicates that 2 \c{half} + values can be packed into a vector and operated on as a + unit for optimal performance. + + Returns zero if the device does not support \c{half}, + or the device does not support OpenCL 1.1. + + \sa hasHalfFloat() +*/ +int QCLDevice::preferredHalfFloatVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF); +} + +/*! \enum QCLDevice::FloatCapability This enum defines the floating-point capabilities of the \c{float} or \c{double} type on an OpenCL device. diff --git a/src/opencl/qcldevice.h b/src/opencl/qcldevice.h index 638dcbc..cb3438f 100644 --- a/src/opencl/qcldevice.h +++ b/src/opencl/qcldevice.h @@ -104,6 +104,7 @@ public: int preferredLongVectorSize() const; int preferredFloatVectorSize() const; int preferredDoubleVectorSize() const; + int preferredHalfFloatVectorSize() const; enum FloatCapability { diff --git a/util/clinfo/clinfo.cpp b/util/clinfo/clinfo.cpp index aa7519a..f28cd09 100644 --- a/util/clinfo/clinfo.cpp +++ b/util/clinfo/clinfo.cpp @@ -177,9 +177,11 @@ int main(int argc, char *argv[]) dev.preferredFloatVectorSize()); int dsize = dev.preferredDoubleVectorSize(); if (dsize) - printf(", double%d\n", dsize); - else - printf("\n"); + printf(", double%d", dsize); + int hsize = dev.preferredHalfFloatVectorSize(); + if (hsize) + printf(", half%d\n", hsize); + printf("\n"); printf(" Extensions :\n"); QStringList extns = dev.extensions(); foreach (QString ext, extns) |