Skip to content

Commit 1abfb23

Browse files
[2/n] L0 Immediate commandlist improvements
Allow flushTask usage only for Compute Related-To: LOCI-1988 Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@intel.com>
1 parent d9886f6 commit 1abfb23

File tree

4 files changed

+128
-109
lines changed

4 files changed

+128
-109
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
135135
this->partitionCount = static_cast<uint32_t>(this->device->getNEODevice()->getDeviceBitfield().count());
136136
}
137137

138-
if (this->cmdListType == CommandListType::TYPE_IMMEDIATE) {
138+
if (this->cmdListType == CommandListType::TYPE_IMMEDIATE && !isCopyOnly()) {
139139
this->isFlushTaskSubmissionEnabled = NEO::DebugManager.flags.EnableFlushTaskSubmission.get();
140140
commandContainer.setFlushTaskUsedForImmediate(this->isFlushTaskSubmissionEnabled);
141141
}

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_4.cpp

Lines changed: 111 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020-2021 Intel Corporation
2+
* Copyright (C) 2020-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -9,6 +9,7 @@
99
#include "shared/test/common/helpers/unit_test_helper.h"
1010
#include "shared/test/common/test_macros/test.h"
1111

12+
#include "level_zero/core/source/image/image_hw.h"
1213
#include "level_zero/core/test/unit_tests/fixtures/device_fixture.h"
1314
#include "level_zero/core/test/unit_tests/fixtures/host_pointer_manager_fixture.h"
1415
#include "level_zero/core/test/unit_tests/fixtures/module_fixture.h"
@@ -122,6 +123,115 @@ HWTEST2_F(CommandListCreate, givenImmediateCommandListWhenAppendWriteGlobalTimes
122123
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
123124
}
124125

126+
HWTEST2_F(CommandListCreate, givenUseCsrImmediateSubmissionEnabledForCopyImmediateCommandListThenAppendImageCopyRegionReturnsSuccess, IsAtLeastXeHpCore) {
127+
DebugManagerStateRestore restorer;
128+
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
129+
const ze_command_queue_desc_t queueDesc = {};
130+
void *srcPtr = reinterpret_cast<void *>(0x1234);
131+
void *dstPtr = reinterpret_cast<void *>(0x2345);
132+
133+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
134+
ze_result_t returnValue;
135+
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
136+
device,
137+
&queueDesc,
138+
false,
139+
NEO::EngineGroupType::Copy,
140+
returnValue));
141+
ASSERT_NE(nullptr, commandList0);
142+
143+
ze_image_desc_t desc = {};
144+
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
145+
desc.type = ZE_IMAGE_TYPE_3D;
146+
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
147+
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
148+
desc.width = 11;
149+
desc.height = 13;
150+
desc.depth = 17;
151+
152+
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
153+
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
154+
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
155+
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
156+
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
157+
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
158+
imageHWSrc->initialize(device, &desc);
159+
imageHWDst->initialize(device, &desc);
160+
161+
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
162+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
163+
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
164+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
165+
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
166+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
167+
}
168+
169+
HWTEST2_F(CommandListCreate, givenUseCsrImmediateSubmissionDisabledForCopyImmediateCommandListThenAppendImageCopyRegionReturnsSuccess, IsAtLeastXeHpCore) {
170+
DebugManagerStateRestore restorer;
171+
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
172+
173+
const ze_command_queue_desc_t queueDesc = {};
174+
175+
void *srcPtr = reinterpret_cast<void *>(0x1234);
176+
void *dstPtr = reinterpret_cast<void *>(0x2345);
177+
178+
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
179+
ze_result_t returnValue;
180+
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
181+
device,
182+
&queueDesc,
183+
false,
184+
NEO::EngineGroupType::Copy,
185+
returnValue));
186+
ASSERT_NE(nullptr, commandList0);
187+
188+
ze_image_desc_t desc = {};
189+
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
190+
desc.type = ZE_IMAGE_TYPE_3D;
191+
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
192+
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
193+
desc.width = 11;
194+
desc.height = 13;
195+
desc.depth = 17;
196+
197+
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
198+
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
199+
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
200+
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
201+
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
202+
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
203+
imageHWSrc->initialize(device, &desc);
204+
imageHWDst->initialize(device, &desc);
205+
206+
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
207+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
208+
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
209+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
210+
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
211+
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
212+
}
213+
214+
HWTEST_F(CommandListCreate, givenUseCsrImmediateSubmissionEnabledForCopyImmediateCommandListthenAppendMemoryCopyRegionReturnsSuccess) {
215+
DebugManagerStateRestore restorer;
216+
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
217+
218+
void *srcPtr = reinterpret_cast<void *>(0x1234);
219+
void *dstPtr = reinterpret_cast<void *>(0x2345);
220+
uint32_t width = 16;
221+
uint32_t height = 16;
222+
ze_copy_region_t sr = {0U, 0U, 0U, width, height, 0U};
223+
ze_copy_region_t dr = {0U, 0U, 0U, width, height, 0U};
224+
225+
ze_command_queue_desc_t queueDesc = {};
226+
ze_result_t returnValue = ZE_RESULT_SUCCESS;
227+
auto commandList = CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Copy, returnValue);
228+
229+
auto result = commandList->appendMemoryCopyRegion(dstPtr, &dr, 0, 0, srcPtr, &sr, 0, 0, nullptr, 0, nullptr);
230+
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
231+
232+
commandList->destroy();
233+
}
234+
125235
HWTEST_F(CommandListCreate, GivenCommandListWhenUnalignedPtrThenLeftMiddleAndRightCopyAdded) {
126236
using XY_COPY_BLT = typename FamilyType::XY_COPY_BLT;
127237
ze_result_t returnValue;

level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_5.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,9 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndImmediateCommandListWhenAppendW
731731
EXPECT_EQ(used, commandContainer.getCommandStream()->getUsed());
732732
}
733733

734-
HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndCopyOnlyImmediateCommandListWhenAppendWaitEventsWithHostScopeThenMiFlushAndSemWaitAreAddedViaFlushTask) {
734+
HWTEST_F(CommandListCreate, givenFlushTaskFlagEnabledAndAsyncCmdQueueAndCopyOnlyImmediateCommandListWhenAppendWaitEventsWithHostScopeThenMiFlushAndSemWaitAreAdded) {
735+
DebugManagerStateRestore restorer;
736+
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
735737
using SEMAPHORE_WAIT = typename FamilyType::MI_SEMAPHORE_WAIT;
736738

737739
ze_command_queue_desc_t desc = {};
@@ -794,6 +796,19 @@ HWTEST_F(CommandListCreate, givenAsyncCmdQueueAndCopyOnlyImmediateCommandListWhe
794796
EXPECT_EQ(used, commandContainer.getCommandStream()->getUsed());
795797
}
796798

799+
HWTEST_F(CommandListCreate, givenFlushTaskFlagEnabledAndAsyncCmdQueueWithCopyOnlyImmediateCommandListCreatedThenSlushTaskSubmissionIsSetToFalse) {
800+
DebugManagerStateRestore restorer;
801+
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
802+
803+
ze_command_queue_desc_t desc = {};
804+
desc.mode = ZE_COMMAND_QUEUE_MODE_ASYNCHRONOUS;
805+
ze_result_t returnValue;
806+
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::Copy, returnValue));
807+
ASSERT_NE(nullptr, commandList);
808+
809+
EXPECT_EQ(false, commandList->isFlushTaskSubmissionEnabled);
810+
}
811+
797812
HWTEST2_F(CommandListCreate, givenIndirectAccessFlagsAreChangedWhenResetingCommandListThenExpectAllFlagsSetToDefault, IsAtLeastSkl) {
798813
using GfxFamily = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
799814

level_zero/core/test/unit_tests/sources/debugger/test_l0_debugger_2.cpp

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -275,112 +275,6 @@ HWTEST_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForI
275275
commandList->destroy();
276276
}
277277

278-
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
279-
DebugManagerStateRestore restorer;
280-
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);
281-
282-
const ze_command_queue_desc_t queueDesc = {};
283-
bool internalEngine = true;
284-
285-
void *srcPtr = reinterpret_cast<void *>(0x1234);
286-
void *dstPtr = reinterpret_cast<void *>(0x2345);
287-
288-
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
289-
ze_result_t returnValue;
290-
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
291-
device,
292-
&queueDesc,
293-
internalEngine,
294-
NEO::EngineGroupType::Copy,
295-
returnValue));
296-
ASSERT_NE(nullptr, commandList0);
297-
298-
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
299-
if (neoDevice->getInternalCopyEngine()) {
300-
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
301-
} else {
302-
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
303-
}
304-
305-
ze_image_desc_t desc = {};
306-
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
307-
desc.type = ZE_IMAGE_TYPE_3D;
308-
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
309-
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
310-
desc.width = 11;
311-
desc.height = 13;
312-
desc.depth = 17;
313-
314-
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
315-
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
316-
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
317-
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
318-
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
319-
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
320-
imageHWSrc->initialize(device, &desc);
321-
imageHWDst->initialize(device, &desc);
322-
323-
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
324-
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
325-
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
326-
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
327-
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
328-
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
329-
}
330-
331-
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionDisabledForImmediateCommandListForAppendImageCopyRegionThenSuccessIsReturned, IsAtLeastXeHpCore) {
332-
DebugManagerStateRestore restorer;
333-
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(false);
334-
335-
const ze_command_queue_desc_t queueDesc = {};
336-
bool internalEngine = true;
337-
338-
void *srcPtr = reinterpret_cast<void *>(0x1234);
339-
void *dstPtr = reinterpret_cast<void *>(0x2345);
340-
341-
neoDevice->getRootDeviceEnvironment().getMutableHardwareInfo()->capabilityTable.blitterOperationsSupported = true;
342-
ze_result_t returnValue;
343-
std::unique_ptr<L0::CommandList> commandList0(CommandList::createImmediate(productFamily,
344-
device,
345-
&queueDesc,
346-
internalEngine,
347-
NEO::EngineGroupType::Copy,
348-
returnValue));
349-
ASSERT_NE(nullptr, commandList0);
350-
351-
CommandQueueImp *cmdQueue = reinterpret_cast<CommandQueueImp *>(commandList0->cmdQImmediate);
352-
if (neoDevice->getInternalCopyEngine()) {
353-
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalCopyEngine()->commandStreamReceiver);
354-
} else {
355-
EXPECT_EQ(cmdQueue->getCsr(), neoDevice->getInternalEngine().commandStreamReceiver);
356-
}
357-
358-
ze_image_desc_t desc = {};
359-
desc.stype = ZE_STRUCTURE_TYPE_IMAGE_DESC;
360-
desc.type = ZE_IMAGE_TYPE_3D;
361-
desc.format.layout = ZE_IMAGE_FORMAT_LAYOUT_8_8_8_8;
362-
desc.format.type = ZE_IMAGE_FORMAT_TYPE_UINT;
363-
desc.width = 11;
364-
desc.height = 13;
365-
desc.depth = 17;
366-
367-
desc.format.x = ZE_IMAGE_FORMAT_SWIZZLE_A;
368-
desc.format.y = ZE_IMAGE_FORMAT_SWIZZLE_0;
369-
desc.format.z = ZE_IMAGE_FORMAT_SWIZZLE_1;
370-
desc.format.w = ZE_IMAGE_FORMAT_SWIZZLE_X;
371-
auto imageHWSrc = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
372-
auto imageHWDst = std::make_unique<WhiteBox<::L0::ImageCoreFamily<gfxCoreFamily>>>();
373-
imageHWSrc->initialize(device, &desc);
374-
imageHWDst->initialize(device, &desc);
375-
376-
returnValue = commandList0->appendImageCopy(imageHWDst->toHandle(), imageHWSrc->toHandle(), nullptr, 0, nullptr);
377-
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
378-
returnValue = commandList0->appendImageCopyFromMemory(imageHWDst->toHandle(), srcPtr, nullptr, nullptr, 0, nullptr);
379-
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
380-
returnValue = commandList0->appendImageCopyToMemory(dstPtr, imageHWSrc->toHandle(), nullptr, nullptr, 0, nullptr);
381-
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
382-
}
383-
384278
HWTEST2_F(L0DebuggerInternalUsageTest, givenUseCsrImmediateSubmissionEnabledCommandListAndAppendMemoryCopyCalledInLoopThenMultipleCommandBufferAreUsedAndSuccessIsReturned, IsAtLeastSkl) {
385279
DebugManagerStateRestore restorer;
386280
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(true);

0 commit comments

Comments
 (0)