From 66da05ee072e2fe493ac2b4820a6ef0bab4a0ffb Mon Sep 17 00:00:00 2001 From: Artur Gainullin Date: Mon, 22 Aug 2022 12:10:45 -0700 Subject: [PATCH] [SYCL] Properly apply a mask of supported queue properties in the OpenCL plugin "discard_events" property is passed to all backends during queue creation. OpenCL runtime itself is not aware of such property so we need to apply a mask of supported properties before calling OpenCL API for queue creation. By mistake mask was applied only for OpenCL 2.0, this PR makes it to be applied for OpenCL 1.2 as well. --- sycl/plugins/opencl/pi_opencl.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sycl/plugins/opencl/pi_opencl.cpp b/sycl/plugins/opencl/pi_opencl.cpp index 61dfcbd5bcc8c..dbb3c763b4b2c 100644 --- a/sycl/plugins/opencl/pi_opencl.cpp +++ b/sycl/plugins/opencl/pi_opencl.cpp @@ -413,15 +413,6 @@ pi_result piQueueCreate(pi_context context, pi_device device, CHECK_ERR_SET_NULL_RET(ret_err, queue, ret_err); - if (platVer.find("OpenCL 1.0") != std::string::npos || - platVer.find("OpenCL 1.1") != std::string::npos || - platVer.find("OpenCL 1.2") != std::string::npos) { - *queue = cast(clCreateCommandQueue( - cast(context), cast(device), - cast(properties), &ret_err)); - return cast(ret_err); - } - // Check that unexpected bits are not set. assert(!(properties & ~(PI_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | @@ -433,6 +424,16 @@ pi_result piQueueCreate(pi_context context, pi_device device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE | CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT; + if (platVer.find("OpenCL 1.0") != std::string::npos || + platVer.find("OpenCL 1.1") != std::string::npos || + platVer.find("OpenCL 1.2") != std::string::npos) { + *queue = cast(clCreateCommandQueue( + cast(context), cast(device), + cast(properties) & SupportByOpenCL, + &ret_err)); + return cast(ret_err); + } + cl_queue_properties CreationFlagProperties[] = { CL_QUEUE_PROPERTIES, cast(properties) & SupportByOpenCL, 0};