mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
OpenCL Queue Families extension 5/n
Check queue capabilities in enqueue calls for kernels, barriers and markers Signed-off-by: Maciej Dziuban <maciej.dziuban@intel.com> Related-To: NEO-5120
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
12ebe55679
commit
41a90e67d7
@@ -3398,6 +3398,12 @@ cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue commandQueue,
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (!pCommandQueue->validateCapabilityForOperation(CL_QUEUE_CAPABILITY_KERNEL_INTEL, eventWaitList, event)) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
TRACING_EXIT(clEnqueueNDRangeKernel, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
TakeOwnershipWrapper<Kernel> kernelOwnership(*pKernel, gtpinIsGTPinInitialized());
|
||||
if (gtpinIsGTPinInitialized()) {
|
||||
gtpinNotifyKernelSubmit(kernel, pCommandQueue);
|
||||
@@ -3481,6 +3487,12 @@ cl_int CL_API_CALL clEnqueueMarker(cl_command_queue commandQueue,
|
||||
|
||||
auto pCommandQueue = castToObject<CommandQueue>(commandQueue);
|
||||
if (pCommandQueue) {
|
||||
if (!pCommandQueue->validateCapability(CL_QUEUE_CAPABILITY_MARKER_INTEL)) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
TRACING_EXIT(clEnqueueMarker, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = pCommandQueue->enqueueMarkerWithWaitList(
|
||||
0,
|
||||
nullptr,
|
||||
@@ -3531,6 +3543,12 @@ cl_int CL_API_CALL clEnqueueBarrier(cl_command_queue commandQueue) {
|
||||
DBG_LOG_INPUTS("commandQueue", commandQueue);
|
||||
auto pCommandQueue = castToObject<CommandQueue>(commandQueue);
|
||||
if (pCommandQueue) {
|
||||
if (!pCommandQueue->validateCapability(CL_QUEUE_CAPABILITY_BARRIER_INTEL)) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
TRACING_EXIT(clEnqueueBarrier, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = pCommandQueue->enqueueBarrierWithWaitList(
|
||||
0,
|
||||
nullptr,
|
||||
@@ -3565,6 +3583,12 @@ cl_int CL_API_CALL clEnqueueMarkerWithWaitList(cl_command_queue commandQueue,
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (!pCommandQueue->validateCapabilityForOperation(CL_QUEUE_CAPABILITY_MARKER_INTEL, eventWaitList, event)) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
TRACING_EXIT(clEnqueueMarkerWithWaitList, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = pCommandQueue->enqueueMarkerWithWaitList(
|
||||
numEventsInWaitList,
|
||||
eventWaitList,
|
||||
@@ -3595,6 +3619,13 @@ cl_int CL_API_CALL clEnqueueBarrierWithWaitList(cl_command_queue commandQueue,
|
||||
TRACING_EXIT(clEnqueueBarrierWithWaitList, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
if (!pCommandQueue->validateCapabilityForOperation(CL_QUEUE_CAPABILITY_BARRIER_INTEL, eventWaitList, event)) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
TRACING_EXIT(clEnqueueBarrierWithWaitList, &retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
retVal = pCommandQueue->enqueueBarrierWithWaitList(
|
||||
numEventsInWaitList,
|
||||
eventWaitList,
|
||||
@@ -5800,6 +5831,11 @@ cl_int CL_API_CALL clEnqueueNDCountKernelINTEL(cl_command_queue commandQueue,
|
||||
pCommandQueue->getDevice().getSpecializedDevice<ClDevice>()->allocateSyncBufferHandler();
|
||||
}
|
||||
|
||||
if (!pCommandQueue->validateCapabilityForOperation(CL_QUEUE_CAPABILITY_KERNEL_INTEL, eventWaitList, event)) {
|
||||
retVal = CL_INVALID_OPERATION;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
TakeOwnershipWrapper<Kernel> kernelOwnership(*pKernel, gtpinIsGTPinInitialized());
|
||||
if (gtpinIsGTPinInitialized()) {
|
||||
gtpinNotifyKernelSubmit(kernel, pCommandQueue);
|
||||
|
||||
@@ -19,8 +19,15 @@ TEST_F(clEnqueueBarrierTests, GivenNullCommandQueueWhenEnqueuingThenInvalidComma
|
||||
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueBarrierTests, GivenValidCommandQueueWhenEnqueuingThenSuccessIsReturned) {
|
||||
TEST_F(clEnqueueBarrierTests, GivenValidCommandQueueWhenEnqueuingBarrierThenSuccessIsReturned) {
|
||||
auto retVal = clEnqueueBarrier(
|
||||
pCommandQueue);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueBarrierTests, GivenQueueIncapableWhenEnqueuingBarrierThenInvalidOperationIsReturned) {
|
||||
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_BARRIER_INTEL);
|
||||
auto retVal = clEnqueueBarrier(
|
||||
pCommandQueue);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
@@ -30,3 +30,13 @@ TEST_F(clEnqueueBarrierWithWaitListTests, GivenValidCommandQueueWhenEnqueuingBar
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueBarrierWithWaitListTests, GivenQueueIncapableWhenEnqueuingBarrierWithWaitListThenInvalidOperationIsReturned) {
|
||||
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_BARRIER_INTEL);
|
||||
auto retVal = clEnqueueBarrierWithWaitList(
|
||||
pCommandQueue,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,14 @@ TEST_F(clEnqueueMarkerTests, GivenValidCommandQueueWhenEnqueingMarkerThenSuccess
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueMarkerTests, GivenQueueIncapableWhenEnqueingMarkerThenInvalidOperationReturned) {
|
||||
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_MARKER_INTEL);
|
||||
auto retVal = clEnqueueMarker(
|
||||
pCommandQueue,
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
class CommandWithoutKernelTypesTests : public testing::TestWithParam<unsigned int /*commandTypes*/> {
|
||||
};
|
||||
|
||||
|
||||
@@ -30,3 +30,13 @@ TEST_F(clEnqueueMarkerWithWaitListTests, GivenValidCommandQueueWhenEnqueingMarke
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueMarkerWithWaitListTests, GivenQueueIncapableWhenEnqueingMarkerWithWaitListThenInvalidOperationIsReturned) {
|
||||
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_MARKER_INTEL);
|
||||
auto retVal = clEnqueueMarkerWithWaitList(
|
||||
pCommandQueue,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,30 @@ TEST_F(clEnqueueNDRangeKernelTests, GivenValidParametersWhenExecutingKernelThenS
|
||||
EXPECT_EQ(CL_SUCCESS, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueNDRangeKernelTests, GivenQueueIncapableWhenExecutingKernelThenInvalidOperationIsReturned) {
|
||||
cl_uint workDim = 1;
|
||||
size_t globalWorkOffset[3] = {0, 0, 0};
|
||||
size_t globalWorkSize[3] = {1, 1, 1};
|
||||
size_t localWorkSize[3] = {1, 1, 1};
|
||||
cl_uint numEventsInWaitList = 0;
|
||||
cl_event *eventWaitList = nullptr;
|
||||
cl_event *event = nullptr;
|
||||
|
||||
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_KERNEL_INTEL);
|
||||
retVal = clEnqueueNDRangeKernel(
|
||||
pCommandQueue,
|
||||
pKernel,
|
||||
workDim,
|
||||
globalWorkOffset,
|
||||
globalWorkSize,
|
||||
localWorkSize,
|
||||
numEventsInWaitList,
|
||||
eventWaitList,
|
||||
event);
|
||||
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
TEST_F(clEnqueueNDRangeKernelTests, GivenNullCommandQueueWhenExecutingKernelThenInvalidCommandQueueErrorIsReturned) {
|
||||
size_t globalWorkSize[3] = {1, 1, 1};
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "opencl/source/api/api.h"
|
||||
#include "opencl/source/built_ins/builtins_dispatch_builder.h"
|
||||
#include "opencl/test/unit_test/api/cl_api_tests.h"
|
||||
#include "opencl/test/unit_test/command_queue/enqueue_fixture.h"
|
||||
#include "opencl/test/unit_test/fixtures/hello_world_fixture.h"
|
||||
#include "opencl/test/unit_test/helpers/unit_test_helper.h"
|
||||
@@ -207,6 +208,34 @@ TEST_F(EnqueueKernelTest, GivenNullKernelWhenEnqueuingNDCountKernelINTELThenInva
|
||||
EXPECT_EQ(CL_INVALID_KERNEL, retVal);
|
||||
}
|
||||
|
||||
using clEnqueueNDCountKernelTests = api_tests;
|
||||
|
||||
TEST_F(clEnqueueNDCountKernelTests, GivenQueueIncapableWhenEnqueuingNDCountKernelINTELThenInvalidOperationIsReturned) {
|
||||
auto &hwHelper = HwHelper::get(::defaultHwInfo->platform.eRenderCoreFamily);
|
||||
if (!hwHelper.isCooperativeDispatchSupported(pCommandQueue->getGpgpuEngine().getEngineType(), ::defaultHwInfo->platform.eProductFamily)) {
|
||||
GTEST_SKIP();
|
||||
}
|
||||
|
||||
cl_uint workDim = 1;
|
||||
size_t globalWorkOffset[3] = {0, 0, 0};
|
||||
size_t workgroupCount[3] = {1, 1, 1};
|
||||
size_t localWorkSize[3] = {1, 1, 1};
|
||||
|
||||
this->disableQueueCapabilities(CL_QUEUE_CAPABILITY_KERNEL_INTEL);
|
||||
retVal = clEnqueueNDCountKernelINTEL(
|
||||
pCommandQueue,
|
||||
pKernel,
|
||||
workDim,
|
||||
globalWorkOffset,
|
||||
workgroupCount,
|
||||
localWorkSize,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
|
||||
EXPECT_EQ(CL_INVALID_OPERATION, retVal);
|
||||
}
|
||||
|
||||
TEST_F(EnqueueKernelTest, givenKernelWhenAllArgsAreSetThenClEnqueueNDCountKernelINTELReturnsSuccess) {
|
||||
const size_t n = 512;
|
||||
size_t workgroupCount[3] = {2, 1, 1};
|
||||
|
||||
Reference in New Issue
Block a user