MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / CommandQueue

Method CommandQueue

include/CL/opencl.hpp:6967–7027  ·  view source on GitHub ↗

! * \brief Constructs a CommandQueue based on passed properties. * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified. */

Source from the content-addressed store, hash-verified

6965 * Will return an CL_INVALID_QUEUE_PROPERTIES error if CL_QUEUE_ON_DEVICE is specified.
6966 */
6967 CommandQueue(
6968 cl_command_queue_properties properties,
6969 cl_int* err = nullptr)
6970 {
6971 cl_int error;
6972
6973 Context context = Context::getDefault(&error);
6974 detail::errHandler(error, __CREATE_CONTEXT_ERR);
6975
6976 if (error != CL_SUCCESS) {
6977 if (err != nullptr) {
6978 *err = error;
6979 }
6980 }
6981 else {
6982 Device device = context.getInfo<CL_CONTEXT_DEVICES>()[0];
6983 bool useWithProperties;
6984
6985#if CL_HPP_TARGET_OPENCL_VERSION >= 200 && CL_HPP_MINIMUM_OPENCL_VERSION < 200
6986 // Run-time decision based on the actual platform
6987 {
6988 cl_uint version = detail::getContextPlatformVersion(context());
6989 useWithProperties = (version >= 0x20000); // OpenCL 2.0 or above
6990 }
6991#elif CL_HPP_TARGET_OPENCL_VERSION >= 200
6992 useWithProperties = true;
6993#else
6994 useWithProperties = false;
6995#endif
6996
6997#if CL_HPP_TARGET_OPENCL_VERSION >= 200
6998 if (useWithProperties) {
6999 cl_queue_properties queue_properties[] = {
7000 CL_QUEUE_PROPERTIES, properties, 0 };
7001 if ((properties & CL_QUEUE_ON_DEVICE) == 0) {
7002 object_ = ::clCreateCommandQueueWithProperties(
7003 context(), device(), queue_properties, &error);
7004 }
7005 else {
7006 error = CL_INVALID_QUEUE_PROPERTIES;
7007 }
7008
7009 detail::errHandler(error, __CREATE_COMMAND_QUEUE_WITH_PROPERTIES_ERR);
7010 if (err != nullptr) {
7011 *err = error;
7012 }
7013 }
7014#endif // CL_HPP_TARGET_OPENCL_VERSION >= 200
7015#if CL_HPP_MINIMUM_OPENCL_VERSION < 200
7016 if (!useWithProperties) {
7017 object_ = ::clCreateCommandQueue(
7018 context(), device(), properties, &error);
7019
7020 detail::errHandler(error, __CREATE_COMMAND_QUEUE_ERR);
7021 if (err != nullptr) {
7022 *err = error;
7023 }
7024 }

Callers

nothing calls this directly

Calls 5

errHandlerFunction · 0.85
clCreateCommandQueueFunction · 0.85
getInfoMethod · 0.45

Tested by

no test coverage detected