Skip to content

Commit 38577be

Browse files
Enable blitter support for read/write images OpenCL
Signed-off-by: Kamil Kopryk <[email protected]>
1 parent ebbd042 commit 38577be

File tree

5 files changed

+7
-23
lines changed

5 files changed

+7
-23
lines changed

opencl/source/cl_device/cl_device.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 Intel Corporation
2+
* Copyright (C) 2020-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -227,7 +227,7 @@ cl_command_queue_capabilities_intel ClDevice::getQueueFamilyCapabilities(EngineG
227227
if (hwHelper.isCopyOnlyEngineType(type)) {
228228
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_KERNEL_INTEL);
229229
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_FILL_BUFFER_INTEL); // clEnqueueFillBuffer
230-
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL); // clEnqueueCopyImage
230+
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_INTEL); // clEnqueueReadImage, clEnqueueWriteImage, clEnqueueCopyImage
231231
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_FILL_IMAGE_INTEL); // clEnqueueFillImage
232232
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_BUFFER_IMAGE_INTEL); // clEnqueueCopyBufferToImage
233233
disabledProperties |= static_cast<cl_command_queue_capabilities_intel>(CL_QUEUE_CAPABILITY_TRANSFER_IMAGE_BUFFER_INTEL); // clEnqueueCopyImageToBuffer

opencl/source/command_queue/command_queue.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,13 @@ bool CommandQueue::blitEnqueueAllowed(cl_command_type cmdType) const {
675675
}
676676

677677
bool CommandQueue::blitEnqueueImageAllowed(const size_t *origin, const size_t *region) {
678-
auto blitEnqueuImageAllowed = false;
678+
auto blitEnqueueImageAllowed = (origin[0] + region[0] <= BlitterConstants::maxBlitWidth) && (origin[1] + region[1] <= BlitterConstants::maxBlitHeight);
679679

680680
if (DebugManager.flags.EnableBlitterForReadWriteImage.get() != -1) {
681-
blitEnqueuImageAllowed = DebugManager.flags.EnableBlitterForReadWriteImage.get();
682-
blitEnqueuImageAllowed &= (origin[0] + region[0] <= BlitterConstants::maxBlitWidth) && (origin[1] + region[1] <= BlitterConstants::maxBlitHeight);
681+
blitEnqueueImageAllowed = DebugManager.flags.EnableBlitterForReadWriteImage.get();
683682
}
684683

685-
return blitEnqueuImageAllowed;
684+
return blitEnqueueImageAllowed;
686685
}
687686

688687
bool CommandQueue::isBlockedCommandStreamRequired(uint32_t commandType, const EventsRequest &eventsRequest, bool blockedQueue) const {

opencl/test/unit_test/command_queue/command_queue_tests.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,6 @@ TEST(CommandQueue, giveClCommandWhenCallingBlitEnqueueAllowedThenReturnCorrectVa
11961196

11971197
TEST(CommandQueue, givenCopySizeAndOffsetWhenCallingBlitEnqueueImageAllowedThenReturnCorrectValue) {
11981198
DebugManagerStateRestore restorer;
1199-
DebugManager.flags.EnableBlitterForReadWriteImage.set(1);
12001199
MockContext context{};
12011200
MockCommandQueue queue(&context, context.getDevice(0), 0);
12021201

opencl/test/unit_test/command_queue/enqueue_read_image_tests.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -434,7 +434,6 @@ HWTEST_F(EnqueueReadImageTest, givenDeviceWithBlitterSupportWhenEnqueueReadImage
434434
DebugManagerStateRestore restorer;
435435
DebugManager.flags.OverrideInvalidEngineWithDefault.set(1);
436436
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
437-
DebugManager.flags.EnableBlitterForReadWriteImage.set(1);
438437

439438
auto &capabilityTable = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
440439
capabilityTable.blitterOperationsSupported = true;
@@ -451,12 +450,6 @@ HWTEST_F(EnqueueReadImageTest, givenDeviceWithBlitterSupportWhenEnqueueReadImage
451450
EnqueueReadImageHelper<>::enqueueReadImage(mockCmdQ.get(), image.get(), CL_TRUE, origin, region);
452451
EXPECT_TRUE(mockCmdQ->isBlitEnqueueImageAllowed);
453452
}
454-
{
455-
DebugManager.flags.EnableBlitterForReadWriteImage.set(-1);
456-
size_t region[] = {BlitterConstants::maxBlitWidth, BlitterConstants::maxBlitHeight, 1};
457-
EnqueueReadImageHelper<>::enqueueReadImage(mockCmdQ.get(), image.get(), CL_TRUE, origin, region);
458-
EXPECT_FALSE(mockCmdQ->isBlitEnqueueImageAllowed);
459-
}
460453
{
461454
DebugManager.flags.EnableBlitterForReadWriteImage.set(0);
462455
size_t region[] = {BlitterConstants::maxBlitWidth, BlitterConstants::maxBlitHeight, 1};

opencl/test/unit_test/command_queue/enqueue_write_image_tests.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2017-2020 Intel Corporation
2+
* Copyright (C) 2017-2021 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -206,7 +206,6 @@ HWTEST_F(EnqueueWriteImageTest, givenDeviceWithBlitterSupportWhenEnqueueWriteIma
206206
DebugManagerStateRestore restorer;
207207
DebugManager.flags.OverrideInvalidEngineWithDefault.set(1);
208208
DebugManager.flags.EnableBlitterForEnqueueOperations.set(1);
209-
DebugManager.flags.EnableBlitterForReadWriteImage.set(1);
210209

211210
auto &capabilityTable = pClDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable;
212211
capabilityTable.blitterOperationsSupported = true;
@@ -223,12 +222,6 @@ HWTEST_F(EnqueueWriteImageTest, givenDeviceWithBlitterSupportWhenEnqueueWriteIma
223222
EnqueueWriteImageHelper<>::enqueueWriteImage(mockCmdQ.get(), image.get(), CL_FALSE, origin, region);
224223
EXPECT_TRUE(mockCmdQ->isBlitEnqueueImageAllowed);
225224
}
226-
{
227-
DebugManager.flags.EnableBlitterForReadWriteImage.set(-1);
228-
size_t region[] = {BlitterConstants::maxBlitWidth, BlitterConstants::maxBlitHeight, 1};
229-
EnqueueWriteImageHelper<>::enqueueWriteImage(mockCmdQ.get(), image.get(), CL_FALSE, origin, region);
230-
EXPECT_FALSE(mockCmdQ->isBlitEnqueueImageAllowed);
231-
}
232225
{
233226
DebugManager.flags.EnableBlitterForReadWriteImage.set(0);
234227
size_t region[] = {BlitterConstants::maxBlitWidth, BlitterConstants::maxBlitHeight, 1};

0 commit comments

Comments
 (0)