[khronos-opencl-clhpp] 01/13: New upstream version 2.0.10+git12-g5dd8bb9
Andreas Beckmann
anbe at moszumanska.debian.org
Thu Jan 25 04:35:42 UTC 2018
This is an automated email from the git hooks/post-receive script.
anbe pushed a commit to branch master
in repository khronos-opencl-clhpp.
commit 1f7c16a4cf8643133534bc333a744a1683ec1d51
Author: Andreas Beckmann <anbe at debian.org>
Date: Wed Jan 24 23:04:57 2018 +0100
New upstream version 2.0.10+git12-g5dd8bb9
---
LICENSE.txt | 25 +++++
input_cl.hpp | 6 +-
input_cl2.hpp | 323 ++++++++++++++++++++++++++++++++++++++--------------------
3 files changed, 243 insertions(+), 111 deletions(-)
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..e022241
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,25 @@
+Copyright (c) 2008-2015 The Khronos Group Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and/or associated documentation files (the
+"Materials"), to deal in the Materials without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Materials, and to
+permit persons to whom the Materials are furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Materials.
+
+MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS
+KHRONOS STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS
+SPECIFICATIONS AND HEADER INFORMATION ARE LOCATED AT
+ https://www.khronos.org/registry/
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
diff --git a/input_cl.hpp b/input_cl.hpp
index ad62b0f..9a00e26 100644
--- a/input_cl.hpp
+++ b/input_cl.hpp
@@ -6242,7 +6242,7 @@ public:
*/
cl_int enqueueMarkerWithWaitList(
const VECTOR_CLASS<Event> *events = 0,
- Event *event = 0)
+ Event *event = 0) const
{
cl_event tmp;
cl_int err = detail::errHandler(
@@ -6272,7 +6272,7 @@ public:
*/
cl_int enqueueBarrierWithWaitList(
const VECTOR_CLASS<Event> *events = 0,
- Event *event = 0)
+ Event *event = 0) const
{
cl_event tmp;
cl_int err = detail::errHandler(
@@ -6298,7 +6298,7 @@ public:
cl_mem_migration_flags flags,
const VECTOR_CLASS<Event>* events = NULL,
Event* event = NULL
- )
+ ) const
{
cl_event tmp;
diff --git a/input_cl2.hpp b/input_cl2.hpp
index 0d6e805..4ac4822 100644
--- a/input_cl2.hpp
+++ b/input_cl2.hpp
@@ -52,6 +52,8 @@
* #define CL_HPP_USE_DX_INTEROP
* cl_khr_sub_groups
* #define CL_HPP_USE_CL_SUB_GROUPS_KHR
+ * cl_khr_image2d_from_buffer
+ * #define CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR
*
* Doxygen documentation for this header is available here:
*
@@ -1826,9 +1828,7 @@ public:
cl_type& operator ()() { return object_; }
- const cl_type get() const { return object_; }
-
- cl_type get() { return object_; }
+ cl_type get() const { return object_; }
protected:
template<typename Func, typename U>
@@ -3494,7 +3494,7 @@ public:
{
size_type maxSize = std::numeric_limits<size_type>::max() / sizeof(T);
- for (Device &d : context_.getInfo<CL_CONTEXT_DEVICES>()) {
+ for (const Device &d : context_.getInfo<CL_CONTEXT_DEVICES>()) {
maxSize = std::min(
maxSize,
static_cast<size_type>(d.getInfo<CL_DEVICE_MAX_MEM_ALLOC_SIZE>()));
@@ -4589,7 +4589,7 @@ public:
#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 120
}
-#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 || defined(CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR)
/*! \brief Constructs a 2D Image from a buffer.
* \note This will share storage with the underlying buffer.
*
@@ -4630,7 +4630,7 @@ public:
*err = error;
}
}
-#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+#endif //#if CL_HPP_TARGET_OPENCL_VERSION >= 200 || defined(CL_HPP_USE_CL_IMAGE2D_FROM_BUFFER_KHR)
#if CL_HPP_TARGET_OPENCL_VERSION >= 200
/*! \brief Constructs a 2D Image from an image.
@@ -5925,27 +5925,28 @@ public:
);
}
- template<int index, int ArrayLength, class D, typename T0, typename... Ts>
- void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, const pointer<T0, D> &t0, Ts... ts)
+ template<int index, int ArrayLength, class D, typename T0, typename T1, typename... Ts>
+ void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, const pointer<T0, D> &t0, const pointer<T1, D> &t1, Ts & ... ts)
{
pointerList[index] = static_cast<void*>(t0.get());
- setSVMPointersHelper<index + 1, Ts...>(ts...);
+ setSVMPointersHelper<index + 1, ArrayLength>(pointerList, t1, ts...);
}
- template<int index, int ArrayLength, typename T0, typename... Ts>
+ template<int index, int ArrayLength, typename T0, typename T1, typename... Ts>
typename std::enable_if<std::is_pointer<T0>::value, void>::type
- setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0, Ts... ts)
+ setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0, T1 t1, Ts... ts)
{
pointerList[index] = static_cast<void*>(t0);
- setSVMPointersHelper<index + 1, Ts...>(ts...);
+ setSVMPointersHelper<index + 1, ArrayLength>(pointerList, t1, ts...);
}
-
+
template<int index, int ArrayLength, typename T0, class D>
void setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, const pointer<T0, D> &t0)
{
pointerList[index] = static_cast<void*>(t0.get());
}
+
template<int index, int ArrayLength, typename T0>
typename std::enable_if<std::is_pointer<T0>::value, void>::type
setSVMPointersHelper(std::array<void*, ArrayLength> &pointerList, T0 t0)
@@ -5954,7 +5955,7 @@ public:
}
template<typename T0, typename... Ts>
- cl_int setSVMPointers(const T0 &t0, Ts... ts)
+ cl_int setSVMPointers(const T0 &t0, Ts & ... ts)
{
std::array<void*, 1 + sizeof...(Ts)> pointerList;
@@ -6416,7 +6417,7 @@ public:
return devInfo;
}
- for (cl::Device d : devs) {
+ for (const cl::Device &d : devs) {
typename detail::param_traits<
detail::cl_program_build_info, name>::param_type param;
result = getBuildInfo(d, name, ¶m);
@@ -6697,31 +6698,49 @@ public:
}
else {
Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+ bool useWithProperties;
-#if CL_HPP_TARGET_OPENCL_VERSION >= 200
- cl_queue_properties queue_properties[] = {
- CL_QUEUE_PROPERTIES, properties, 0 };
- if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
- object_ = ::clCreateCommandQueueWithProperties(
- context(), device(), queue_properties, &error);
- }
- else {
- error = CL_INVALID_QUEUE_PROPERTIES;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
}
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
+ useWithProperties = true;
+#else
+ useWithProperties = false;
+#endif
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (useWithProperties) {
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties, 0 };
+ if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+ }
+ else {
+ error = CL_INVALID_QUEUE_PROPERTIES;
+ }
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#else
- object_ = ::clCreateCommandQueue(
- context(), device(), properties, &error);
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ if (!useWithProperties) {
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
- if (err != NULL) {
- *err = error;
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#endif
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
}
}
@@ -6745,28 +6764,46 @@ public:
}
else {
Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
+ bool useWithProperties;
-#if CL_HPP_TARGET_OPENCL_VERSION >= 200
- cl_queue_properties queue_properties[] = {
- CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
+ }
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
+ useWithProperties = true;
+#else
+ useWithProperties = false;
+#endif
- object_ = ::clCreateCommandQueueWithProperties(
- context(), device(), queue_properties, &error);
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (useWithProperties) {
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
- if (err != NULL) {
- *err = error;
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#else
- object_ = ::clCreateCommandQueue(
- context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
-
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
- if (err != NULL) {
- *err = error;
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ if (!useWithProperties) {
+ object_ = ::clCreateCommandQueue(
+ context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#endif
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
+
}
}
@@ -6780,6 +6817,7 @@ public:
cl_int* err = NULL)
{
cl_int error;
+ bool useWithProperties;
vector<cl::Device> devices;
error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
@@ -6793,31 +6831,47 @@ public:
return;
}
-#if CL_HPP_TARGET_OPENCL_VERSION >= 200
- cl_queue_properties queue_properties[] = {
- CL_QUEUE_PROPERTIES, properties, 0 };
- if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
- object_ = ::clCreateCommandQueueWithProperties(
- context(), devices[0](), queue_properties, &error);
- }
- else {
- error = CL_INVALID_QUEUE_PROPERTIES;
- }
-
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
}
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
+ useWithProperties = true;
#else
- object_ = ::clCreateCommandQueue(
- context(), devices[0](), properties, &error);
+ useWithProperties = false;
+#endif
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (useWithProperties) {
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties, 0 };
+ if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), devices[0](), queue_properties, &error);
+ }
+ else {
+ error = CL_INVALID_QUEUE_PROPERTIES;
+ }
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#endif
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ if (!useWithProperties) {
+ object_ = ::clCreateCommandQueue(
+ context(), devices[0](), properties, &error);
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
}
/*!
@@ -6830,6 +6884,7 @@ public:
cl_int* err = NULL)
{
cl_int error;
+ bool useWithProperties;
vector<cl::Device> devices;
error = context.getInfo(CL_CONTEXT_DEVICES, &devices);
@@ -6843,26 +6898,42 @@ public:
return;
}
-#if CL_HPP_TARGET_OPENCL_VERSION >= 200
- cl_queue_properties queue_properties[] = {
- CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
- object_ = ::clCreateCommandQueueWithProperties(
- context(), devices[0](), queue_properties, &error);
-
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
}
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
+ useWithProperties = true;
#else
- object_ = ::clCreateCommandQueue(
- context(), devices[0](), static_cast<cl_command_queue_properties>(properties), &error);
+ useWithProperties = false;
+#endif
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (useWithProperties) {
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), devices[0](), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#endif
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ if (!useWithProperties) {
+ object_ = ::clCreateCommandQueue(
+ context(), devices[0](), static_cast<cl_command_queue_properties>(properties), &error);
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
}
/*!
@@ -6876,26 +6947,44 @@ public:
cl_int* err = NULL)
{
cl_int error;
+ bool useWithProperties;
-#if CL_HPP_TARGET_OPENCL_VERSION >= 200
- cl_queue_properties queue_properties[] = {
- CL_QUEUE_PROPERTIES, properties, 0 };
- object_ = ::clCreateCommandQueueWithProperties(
- context(), device(), queue_properties, &error);
-
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
}
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
+ useWithProperties = true;
#else
- object_ = ::clCreateCommandQueue(
- context(), device(), properties, &error);
+ useWithProperties = false;
+#endif
- detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
- if (err != NULL) {
- *err = error;
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (useWithProperties) {
+ cl_queue_properties queue_properties[] = {
+ CL_QUEUE_PROPERTIES, properties, 0 };
+ object_ = ::clCreateCommandQueueWithProperties(
+ context(), device(), queue_properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
}
-#endif
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ if (!useWithProperties) {
+ object_ = ::clCreateCommandQueue(
+ context(), device(), properties, &error);
+
+ detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
+ if (err != NULL) {
+ *err = error;
+ }
+ }
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
}
/*!
@@ -6908,19 +6997,36 @@ public:
QueueProperties properties,
cl_int* err = NULL)
{
- cl_int error;
+ cl_int error;
+ bool useWithProperties;
+
+#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ // Run-time decision based on the actual platform
+ {
+ cl_uint version = detail::getContextPlatformVersion(context());
+ useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
+ }
+#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
+ useWithProperties = true;
+#else
+ useWithProperties = false;
+#endif
#if CL_HPP_TARGET_OPENCL_VERSION >= 200
+ if (useWithProperties) {
cl_queue_properties queue_properties[] = {
CL_QUEUE_PROPERTIES, static_cast<cl_queue_properties>(properties), 0 };
object_ = ::clCreateCommandQueueWithProperties(
context(), device(), queue_properties, &error);
-
+
detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
if (err != NULL) {
*err = error;
}
-#else
+ }
+#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
+#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ if (!useWithProperties) {
object_ = ::clCreateCommandQueue(
context(), device(), static_cast<cl_command_queue_properties>(properties), &error);
@@ -6928,8 +7034,9 @@ public:
if (err != NULL) {
*err = error;
}
-#endif
}
+#endif // CL_HPP_MINIMUM_OPENCL_VERSION < 200
+ }
static CommandQueue getDefault(cl_int * err = NULL)
{
@@ -7773,7 +7880,7 @@ public:
*/
cl_int enqueueMarkerWithWaitList(
const vector<Event> *events = 0,
- Event *event = 0)
+ Event *event = 0) const
{
cl_event tmp;
cl_int err = detail::errHandler(
@@ -7803,7 +7910,7 @@ public:
*/
cl_int enqueueBarrierWithWaitList(
const vector<Event> *events = 0,
- Event *event = 0)
+ Event *event = 0) const
{
cl_event tmp;
cl_int err = detail::errHandler(
@@ -7829,7 +7936,7 @@ public:
cl_mem_migration_flags flags,
const vector<Event>* events = NULL,
Event* event = NULL
- )
+ ) const
{
cl_event tmp;
@@ -9425,7 +9532,7 @@ public:
}
template<typename T0, typename... T1s>
- cl_int setSVMPointers(const T0 &t0, T1s... ts)
+ cl_int setSVMPointers(const T0 &t0, T1s &... ts)
{
return kernel_.setSVMPointers(t0, ts...);
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/khronos-opencl-clhpp.git
More information about the Pkg-opencl-commits
mailing list