OpenCL Queue Families extension 14/n

Check capabilities in clEnqueueWaitForEvents

Related-To: NEO-5120
Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com>
This commit is contained in:
Maciej Dziuban
2021-01-28 16:41:08 +00:00
committed by Compute-Runtime-Automation
parent e33e71dee5
commit 08506dc81e
2 changed files with 27 additions and 1 deletions

View File

@@ -3568,6 +3568,12 @@ cl_int CL_API_CALL clEnqueueWaitForEvents(cl_command_queue commandQueue,
return retVal;
}
if (!pCommandQueue->validateCapabilitiesForEventWaitList(numEvents, eventList)) {
retVal = CL_INVALID_OPERATION;
TRACING_EXIT(clEnqueueWaitForEvents, &retVal);
return retVal;
}
retVal = Event::waitForEvents(numEvents, eventList);
TRACING_EXIT(clEnqueueWaitForEvents, &retVal);

View File

@@ -1,14 +1,17 @@
/*
* Copyright (C) 2017-2020 Intel Corporation
* Copyright (C) 2017-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/helpers/array_count.h"
#include "opencl/source/command_queue/command_queue.h"
#include "opencl/source/context/context.h"
#include "opencl/source/event/event.h"
#include "opencl/source/event/user_event.h"
#include "opencl/test/unit_test/mocks/mock_event.h"
#include "cl_api_tests.h"
@@ -35,6 +38,23 @@ TEST_F(clEnqueueWaitForEventsTests, GivenInvalidCommandQueueWhenClEnqueueWaitFor
ASSERT_EQ(CL_SUCCESS, retVal);
}
TEST_F(clEnqueueWaitForEventsTests, GivenQueueIncapableWhenEnqueingWaitForEventsThenInvalidOperationReturned) {
MockEvent<Event> events[] = {
{pCommandQueue, CL_COMMAND_READ_BUFFER, 0, 0},
{pCommandQueue, CL_COMMAND_READ_BUFFER, 0, 0},
{pCommandQueue, CL_COMMAND_READ_BUFFER, 0, 0},
};
const cl_event waitList[] = {events, events + 1, events + 2};
const cl_uint waitListSize = static_cast<cl_uint>(arrayCount(waitList));
auto retVal = clEnqueueWaitForEvents(pCommandQueue, waitListSize, waitList);
EXPECT_EQ(CL_SUCCESS, retVal);
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_SINGLE_QUEUE_EVENT_WAIT_LIST_INTEL);
retVal = clEnqueueWaitForEvents(pCommandQueue, waitListSize, waitList);
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
}
TEST_F(clEnqueueWaitForEventsTests, GivenProperParamsWhenClEnqueueWaitForEventsIsCalledAndEventStatusIsCompleteThenWaitAndReturnSuccess) {
struct MyEvent : public UserEvent {
MyEvent(Context *context)