diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-20 15:44:31 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-06-20 15:45:57 +1000 |
commit | 7875ca3dafea377f6b496105b25d3ade1818aafc (patch) | |
tree | 65c0104da4158ddda7fa08c175374d21a5845250 | |
parent | 2e6ffb2e8b2415201862305327734a8210e545fa (diff) |
Native vector size queries for OpenCL 1.1 devices.
-rw-r--r-- | doc/src/opencl11.qdoc | 5 | ||||
-rw-r--r-- | src/opencl/qcldevice.cpp | 83 | ||||
-rw-r--r-- | src/opencl/qcldevice.h | 8 | ||||
-rw-r--r-- | util/clinfo/clinfo.cpp | 18 |
4 files changed, 112 insertions, 2 deletions
diff --git a/doc/src/opencl11.qdoc b/doc/src/opencl11.qdoc index 000d98e..3bf1862 100644 --- a/doc/src/opencl11.qdoc +++ b/doc/src/opencl11.qdoc @@ -57,7 +57,10 @@ \o New QCLDevice queries: \l{QCLDevice::languageVersion()}{languageVersion()}, \l{QCLDevice::preferredHalfFloatVectorSize()}{preferredHalfFloatVectorSize()}, - and \l{QCLDevice::hasUnifiedMemory()}{hasUnifiedMemory()}. + \l{QCLDevice::hasUnifiedMemory()}{hasUnifiedMemory()}, + \l{QCLDevice::nativeCharVectorSize()}{nativeCharVectorSize()}, + \l{QCLDevice::nativeShortVectorSize()}{nativeShortVectorSize()}, + etc. \o The \c{setOutOfOrder()} and \c{setProfilingEnabled()} functions have been removed from QCLCommandQueue because OpenCL 1.1 has deprecated the functionality, and we want diff --git a/src/opencl/qcldevice.cpp b/src/opencl/qcldevice.cpp index 986c920..30b510a 100644 --- a/src/opencl/qcldevice.cpp +++ b/src/opencl/qcldevice.cpp @@ -563,6 +563,89 @@ int QCLDevice::preferredHalfFloatVectorSize() const } /*! + Returns the native size for vectors of type \c{char} + in the device. For example, 4 indicates that 4 \c{char} + values can be packed into a vector and operated on as a + unit for optimal performance. Returns zero on OpenCL 1.0. +*/ +int QCLDevice::nativeCharVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR); +} + +/*! + Returns the native size for vectors of type \c{short} + in the device. For example, 4 indicates that 4 \c{short} + values can be packed into a vector and operated on as a + unit for optimal performance. Returns zero on OpenCL 1.0. +*/ +int QCLDevice::nativeShortVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT); +} + +/*! + Returns the native size for vectors of type \c{int} + in the device. For example, 4 indicates that 4 \c{int} + values can be packed into a vector and operated on as a + unit for optimal performance. Returns zero on OpenCL 1.0. +*/ +int QCLDevice::nativeIntVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_VECTOR_WIDTH_INT); +} + +/*! + Returns the native size for vectors of type \c{long} + in the device. For example, 2 indicates that 2 \c{long} + values can be packed into a vector and operated on as a + unit for optimal performance. Returns zero on OpenCL 1.0. +*/ +int QCLDevice::nativeLongVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG); +} + +/*! + Returns the native size for vectors of type \c{float} + in the device. For example, 4 indicates that 4 \c{float} + values can be packed into a vector and operated on as a + unit for optimal performance. Returns zero on OpenCL 1.0. +*/ +int QCLDevice::nativeFloatVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT); +} + +/*! + Returns the native size for vectors of type \c{double} + in the device. For example, 2 indicates that 2 \c{double} + values can be packed into a vector and operated on as a + unit for optimal performance. Returns zero on OpenCL 1.0, + or if the device does not support \c{double}. + + \sa hasDouble() +*/ +int QCLDevice::nativeDoubleVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE); +} + +/*! + Returns the native 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 on OpenCL 1.0, + or if the device does not support \c{half}. + + \sa hasHalfFloat() +*/ +int QCLDevice::nativeHalfFloatVectorSize() const +{ + return qt_cl_paramInt(m_id, CL_DEVICE_NATIVE_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 a874da2..b73d0cd 100644 --- a/src/opencl/qcldevice.h +++ b/src/opencl/qcldevice.h @@ -107,6 +107,14 @@ public: int preferredDoubleVectorSize() const; int preferredHalfFloatVectorSize() const; + int nativeCharVectorSize() const; + int nativeShortVectorSize() const; + int nativeIntVectorSize() const; + int nativeLongVectorSize() const; + int nativeFloatVectorSize() const; + int nativeDoubleVectorSize() const; + int nativeHalfFloatVectorSize() const; + enum FloatCapability { NotSupported = 0x0000, diff --git a/util/clinfo/clinfo.cpp b/util/clinfo/clinfo.cpp index b13ffb8..276d9f7 100644 --- a/util/clinfo/clinfo.cpp +++ b/util/clinfo/clinfo.cpp @@ -183,8 +183,24 @@ int main(int argc, char *argv[]) printf(", double%d", dsize); int hsize = dev.preferredHalfFloatVectorSize(); if (hsize) - printf(", half%d\n", hsize); + printf(", half%d", hsize); printf("\n"); + if (dev.nativeCharVectorSize()) { + printf(" Native Vector Sizes:\n"); + printf(" char%d, short%d, int%d, long%d, float%d", + dev.nativeCharVectorSize(), + dev.nativeShortVectorSize(), + dev.nativeIntVectorSize(), + dev.nativeLongVectorSize(), + dev.nativeFloatVectorSize()); + dsize = dev.nativeDoubleVectorSize(); + if (dsize) + printf(", double%d", dsize); + hsize = dev.nativeHalfFloatVectorSize(); + if (hsize) + printf(", half%d", hsize); + printf("\n"); + } printf(" Extensions :\n"); QStringList extns = dev.extensions(); foreach (QString ext, extns) |