From 83252e73060ed73c4b0f5a152cf5b931147402d5 Mon Sep 17 00:00:00 2001 From: Maciej Dziuban Date: Fri, 25 Sep 2020 16:42:45 +0200 Subject: [PATCH] Add isCopyOnly field Change-Id: Ia056af66af437c22738fd15abff12e1ad226509a Signed-off-by: Maciej Dziuban Related-To: NEO-5120 --- opencl/source/command_queue/command_queue.cpp | 2 +- opencl/source/command_queue/command_queue.h | 2 ++ .../unit_test/command_queue/command_queue_tests.cpp | 13 +++++++++++++ opencl/test/unit_test/mocks/mock_command_queue.h | 2 ++ shared/test/unit_test/mocks/mock_device.h | 1 + 5 files changed, 19 insertions(+), 1 deletion(-) diff --git a/opencl/source/command_queue/command_queue.cpp b/opencl/source/command_queue/command_queue.cpp index e53a97ee67..46457b7cb4 100644 --- a/opencl/source/command_queue/command_queue.cpp +++ b/opencl/source/command_queue/command_queue.cpp @@ -637,7 +637,7 @@ bool CommandQueue::queueDependenciesClearRequired() const { } bool CommandQueue::blitEnqueueAllowed(cl_command_type cmdType) const { - bool blitAllowed = device->getHardwareInfo().capabilityTable.blitterOperationsSupported; + bool blitAllowed = device->getHardwareInfo().capabilityTable.blitterOperationsSupported || this->isCopyOnly; if (DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.get() != -1) { blitAllowed &= !!DebugManager.flags.EnableBlitterOperationsForReadWriteBuffers.get(); diff --git a/opencl/source/command_queue/command_queue.h b/opencl/source/command_queue/command_queue.h index f5df18346d..63bd3941a6 100644 --- a/opencl/source/command_queue/command_queue.h +++ b/opencl/source/command_queue/command_queue.h @@ -358,6 +358,8 @@ class CommandQueue : public BaseObject<_cl_command_queue> { bool perfCountersEnabled = false; + bool isCopyOnly = false; + LinearStream *commandStream = nullptr; bool isSpecialCommandQueue = false; diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index dfd908c4b4..c4c5aeb859 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -1137,3 +1137,16 @@ TEST(CommandQueue, givenBlitterOperationsSupportedWhenCreatingQueueThenTimestamp MockCommandQueue cmdQ(&context, context.getDevice(0), 0); EXPECT_NE(nullptr, cmdQ.timestampPacketContainer); } + +TEST(CommandQueue, givenCopyOnlyQueueWhenCallingBlitEnqueueAllowedThenReturnTrue) { + MockContext context{}; + HardwareInfo *hwInfo = context.getDevice(0)->getRootDeviceEnvironment().getMutableHardwareInfo(); + MockCommandQueue queue(&context, context.getDevice(0), 0); + hwInfo->capabilityTable.blitterOperationsSupported = false; + + queue.isCopyOnly = false; + EXPECT_FALSE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER)); + + queue.isCopyOnly = true; + EXPECT_TRUE(queue.blitEnqueueAllowed(CL_COMMAND_READ_BUFFER)); +} diff --git a/opencl/test/unit_test/mocks/mock_command_queue.h b/opencl/test/unit_test/mocks/mock_command_queue.h index 21713c3b07..1ad4326352 100644 --- a/opencl/test/unit_test/mocks/mock_command_queue.h +++ b/opencl/test/unit_test/mocks/mock_command_queue.h @@ -18,9 +18,11 @@ namespace NEO { class MockCommandQueue : public CommandQueue { public: + using CommandQueue::blitEnqueueAllowed; using CommandQueue::bufferCpuCopyAllowed; using CommandQueue::device; using CommandQueue::gpgpuEngine; + using CommandQueue::isCopyOnly; using CommandQueue::obtainNewTimestampPacketNodes; using CommandQueue::requiresCacheFlushAfterWalker; using CommandQueue::throttle; diff --git a/shared/test/unit_test/mocks/mock_device.h b/shared/test/unit_test/mocks/mock_device.h index 7927b4f224..33f37ea184 100644 --- a/shared/test/unit_test/mocks/mock_device.h +++ b/shared/test/unit_test/mocks/mock_device.h @@ -41,6 +41,7 @@ class MockDevice : public RootDevice { using Device::createDeviceInternals; using Device::createEngine; using Device::deviceInfo; + using Device::engineGroups; using Device::engines; using Device::executionEnvironment; using Device::getGlobalMemorySize;