From 01ff1accfa230066dbc9e62104f44d99fb7722e9 Mon Sep 17 00:00:00 2001 From: Filip Hazubski Date: Mon, 18 Mar 2019 13:34:14 +0100 Subject: [PATCH] Refactor queue extra properties validation Change-Id: If95190159b3885653507c0ffc243d8b45aaa6cc7 Signed-off-by: Filip Hazubski --- Jenkinsfile | 2 +- runtime/api/api.cpp | 7 ++++++- runtime/helpers/queue_helpers.cpp | 6 +++++- runtime/helpers/queue_helpers.h | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 94efd19acf..8bfc1f2aa2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ #!groovy dependenciesRevision='ec7183fc6b8fde18df4a38ab2aa6d6f364b507f1-1216' strategy='EQUAL' -allowedCD=274 +allowedCD=275 allowedF=4 diff --git a/runtime/api/api.cpp b/runtime/api/api.cpp index 6db0beee16..a82cc8a44f 100644 --- a/runtime/api/api.cpp +++ b/runtime/api/api.cpp @@ -3820,7 +3820,7 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte tokenValue != CL_QUEUE_SIZE && tokenValue != CL_QUEUE_PRIORITY_KHR && tokenValue != CL_QUEUE_THROTTLE_KHR && - !processExtraTokens(pDevice, *pContext, propertiesAddress)) { + !isExtraToken(propertiesAddress)) { err.set(CL_INVALID_VALUE); return commandQueue; } @@ -3828,6 +3828,11 @@ cl_command_queue CL_API_CALL clCreateCommandQueueWithProperties(cl_context conte tokenValue = *propertiesAddress; } + if (!verifyExtraTokens(pDevice, *pContext, properties)) { + err.set(CL_INVALID_VALUE); + return commandQueue; + } + auto commandQueueProperties = getCmdQueueProperties(properties); uint32_t maxOnDeviceQueueSize = pDevice->getDeviceInfo().queueOnDeviceMaxSize; uint32_t maxOnDeviceQueues = pDevice->getDeviceInfo().maxOnDeviceQueues; diff --git a/runtime/helpers/queue_helpers.cpp b/runtime/helpers/queue_helpers.cpp index 136be11edc..cd0a709d88 100644 --- a/runtime/helpers/queue_helpers.cpp +++ b/runtime/helpers/queue_helpers.cpp @@ -8,10 +8,14 @@ #include "runtime/helpers/queue_helpers.h" namespace OCLRT { -bool processExtraTokens(Device *&device, Context &context, const cl_queue_properties *property) { +bool isExtraToken(const cl_queue_properties *property) { return false; } +bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_properties *properties) { + return true; +} + void CommandQueue::processProperties(const cl_queue_properties *properties) { } } // namespace OCLRT diff --git a/runtime/helpers/queue_helpers.h b/runtime/helpers/queue_helpers.h index ba80065ec5..38f34b4f4d 100644 --- a/runtime/helpers/queue_helpers.h +++ b/runtime/helpers/queue_helpers.h @@ -113,5 +113,6 @@ returnType getCmdQueueProperties(const cl_queue_properties *properties, } return retVal; } -bool processExtraTokens(Device *&device, Context &context, const cl_queue_properties *property); +bool isExtraToken(const cl_queue_properties *property); +bool verifyExtraTokens(Device *&device, Context &context, const cl_queue_properties *properties); } // namespace OCLRT