Skip to content

Commit f4b4110

Browse files
[5/n] L0 immediate commandlist improvements
- Allow flushTask usage for XeHp+ only - Fix black box test to only use Copy queue if found Related-To: LOCI-1988 Signed-off-by: Aravind Gopalakrishnan <[email protected]>
1 parent 492721a commit f4b4110

File tree

8 files changed

+65
-11
lines changed

8 files changed

+65
-11
lines changed

level_zero/core/source/cmdlist/cmdlist_hw.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ struct CommandListCoreFamily : CommandListImp {
245245
NEO::PipeControlArgs createBarrierFlags();
246246
void appendMultiTileBarrier(NEO::Device &neoDevice);
247247
size_t estimateBufferSizeMultiTileBarrier(const NEO::HardwareInfo &hwInfo);
248+
bool isFlushTaskSupported();
248249

249250
uint64_t getInputBufferSize(NEO::ImageType imageType, uint64_t bytesPerPixel, const ze_image_region_t *region);
250251
MOCKABLE_VIRTUAL AlignedAllocationData getAlignedAllocation(Device *device, const void *buffer, uint64_t bufferSize, bool hostCopyAllowed);

level_zero/core/source/cmdlist/cmdlist_hw.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::initialize(Device *device, NEO
136136
}
137137

138138
if (this->cmdListType == CommandListType::TYPE_IMMEDIATE && !isCopyOnly() && !isInternal()) {
139-
this->isFlushTaskSubmissionEnabled = true;
139+
this->isFlushTaskSubmissionEnabled = this->isFlushTaskSupported();
140140
if (NEO::DebugManager.flags.EnableFlushTaskSubmission.get() != -1) {
141141
this->isFlushTaskSubmissionEnabled = !!NEO::DebugManager.flags.EnableFlushTaskSubmission.get();
142142
}

level_zero/core/source/cmdlist/cmdlist_hw_base.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,4 +202,9 @@ inline size_t CommandListCoreFamily<gfxCoreFamily>::estimateBufferSizeMultiTileB
202202
return 0;
203203
}
204204

205+
template <GFXCORE_FAMILY gfxCoreFamily>
206+
inline bool CommandListCoreFamily<gfxCoreFamily>::isFlushTaskSupported() {
207+
return false;
208+
}
209+
205210
} // namespace L0

level_zero/core/source/cmdlist/cmdlist_hw_xehp_and_later.inl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,9 @@ inline size_t CommandListCoreFamily<gfxCoreFamily>::estimateBufferSizeMultiTileB
348348
false);
349349
}
350350

351+
template <GFXCORE_FAMILY gfxCoreFamily>
352+
inline bool CommandListCoreFamily<gfxCoreFamily>::isFlushTaskSupported() {
353+
return true;
354+
}
355+
351356
} // namespace L0

level_zero/core/test/black_box_tests/common/zello_common.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ uint32_t getCommandQueueOrdinal(ze_device_handle_t &device) {
111111
return computeQueueGroupOrdinal;
112112
}
113113

114-
uint32_t getCopyOnlyCommandQueueOrdinal(ze_device_handle_t &device) {
114+
int32_t getCopyOnlyCommandQueueOrdinal(ze_device_handle_t &device) {
115115
uint32_t numQueueGroups = 0;
116116
SUCCESS_OR_TERMINATE(zeDeviceGetCommandQueueGroupProperties(device, &numQueueGroups, nullptr));
117117
if (numQueueGroups == 0) {
@@ -121,7 +121,7 @@ uint32_t getCopyOnlyCommandQueueOrdinal(ze_device_handle_t &device) {
121121
std::vector<ze_command_queue_group_properties_t> queueProperties(numQueueGroups);
122122
SUCCESS_OR_TERMINATE(zeDeviceGetCommandQueueGroupProperties(device, &numQueueGroups,
123123
queueProperties.data()));
124-
uint32_t copyOnlyQueueGroupOrdinal = 0;
124+
int32_t copyOnlyQueueGroupOrdinal = -1;
125125
for (uint32_t i = 0; i < numQueueGroups; i++) {
126126
if (!(queueProperties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COMPUTE) && (queueProperties[i].flags & ZE_COMMAND_QUEUE_GROUP_PROPERTY_FLAG_COPY)) {
127127
copyOnlyQueueGroupOrdinal = i;

level_zero/core/test/black_box_tests/zello_copy_only.cpp

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021 Intel Corporation
2+
* Copyright (C) 2021-2022 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -28,7 +28,12 @@ void testCopyBetweenHeapDeviceAndStack(ze_context_handle_t &context, ze_device_h
2828
ze_command_list_handle_t cmdList;
2929

3030
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
31-
uint32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
31+
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
32+
if (copyQueueGroup < 0) {
33+
std::cout << "No Copy queue group found. Skipping test run\n";
34+
validRet = true;
35+
return;
36+
}
3237

3338
cmdQueueDesc.pNext = nullptr;
3439
cmdQueueDesc.flags = 0;
@@ -98,7 +103,12 @@ void testCopyBetweenHostMemAndDeviceMem(ze_context_handle_t &context, ze_device_
98103
ze_command_list_handle_t cmdList;
99104

100105
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
101-
uint32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
106+
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
107+
if (copyQueueGroup < 0) {
108+
std::cout << "No Copy queue group found. Skipping test run\n";
109+
validRet = true;
110+
return;
111+
}
102112

103113
cmdQueueDesc.pNext = nullptr;
104114
cmdQueueDesc.flags = 0;
@@ -166,7 +176,12 @@ void testRegionCopyOf2DSharedMem(ze_context_handle_t &context, ze_device_handle_
166176
ze_command_list_handle_t cmdList;
167177

168178
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
169-
uint32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
179+
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
180+
if (copyQueueGroup < 0) {
181+
std::cout << "No Copy queue group found. Skipping test run\n";
182+
validRet = true;
183+
return;
184+
}
170185

171186
cmdQueueDesc.pNext = nullptr;
172187
cmdQueueDesc.flags = 0;
@@ -293,7 +308,12 @@ void testSharedMemDataAccessWithoutCopy(ze_context_handle_t &context, ze_device_
293308
ze_command_list_handle_t cmdList;
294309

295310
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
296-
uint32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
311+
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
312+
if (copyQueueGroup < 0) {
313+
std::cout << "No Copy queue group found. Skipping test run\n";
314+
validRet = true;
315+
return;
316+
}
297317

298318
cmdQueueDesc.pNext = nullptr;
299319
cmdQueueDesc.flags = 0;
@@ -398,7 +418,12 @@ void testRegionCopyOf3DSharedMem(ze_context_handle_t &context, ze_device_handle_
398418
ze_command_list_handle_t cmdList;
399419

400420
ze_command_queue_desc_t cmdQueueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC};
401-
uint32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
421+
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
422+
if (copyQueueGroup < 0) {
423+
std::cout << "No Copy queue group found. Skipping test run\n";
424+
validRet = true;
425+
return;
426+
}
402427

403428
cmdQueueDesc.pNext = nullptr;
404429
cmdQueueDesc.flags = 0;

level_zero/core/test/black_box_tests/zello_immediate.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ void testCopyBetweenHostMemAndDeviceMem(ze_context_handle_t &context, ze_device_
4747
char *stackBuffer = new char[allocSize];
4848
ze_command_list_handle_t cmdList;
4949

50-
uint32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
50+
int32_t copyQueueGroup = getCopyOnlyCommandQueueOrdinal(device);
51+
if (copyQueueGroup < 0) {
52+
std::cout << "No Copy queue group found. Skipping test run\n";
53+
validRet = true;
54+
return;
55+
}
5156

5257
createImmediateCommandList(device, context, copyQueueGroup, syncMode, cmdList);
5358

@@ -275,6 +280,11 @@ int main(int argc, char *argv[]) {
275280
std::cout << "\nTest case: Sync mode copy queue for memory copy\n";
276281
testCopyBetweenHostMemAndDeviceMem(context, device, true, outputValidationSuccessful);
277282
}
283+
if (outputValidationSuccessful) {
284+
//Async mode with Copy queue
285+
std::cout << "\nTest case: Async mode copy queue for memory copy\n";
286+
testCopyBetweenHostMemAndDeviceMem(context, device, false, outputValidationSuccessful);
287+
}
278288

279289
SUCCESS_OR_TERMINATE(zeContextDestroy(context));
280290
std::cout << "\nZello Immediate Results validation " << (outputValidationSuccessful ? "PASSED" : "FAILED") << "\n";

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,22 @@ class CommandListImmediateFlushTaskTests : public DeviceFixture {
244244
};
245245

246246
using CommandListImmediateFlushTaskComputeTests = Test<CommandListImmediateFlushTaskTests>;
247-
HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenCommandListIsInititalizedThenByDefaultFlushTaskSubmissionEnabled) {
247+
HWTEST2_F(CommandListImmediateFlushTaskComputeTests, givenCommandListIsInititalizedThenByDefaultFlushTaskSubmissionEnabled, IsAtLeastXeHpCore) {
248248
ze_command_queue_desc_t queueDesc = {};
249249
ze_result_t returnValue;
250250
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue));
251251

252252
EXPECT_EQ(true, commandList->isFlushTaskSubmissionEnabled);
253253
}
254254

255+
HWTEST2_F(CommandListImmediateFlushTaskComputeTests, givenCommandListIsInititalizedThenByDefaultFlushTaskSubmissionDisabled, IsAtMostGen12lp) {
256+
ze_command_queue_desc_t queueDesc = {};
257+
ze_result_t returnValue;
258+
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &queueDesc, false, NEO::EngineGroupType::Compute, returnValue));
259+
260+
EXPECT_EQ(false, commandList->isFlushTaskSubmissionEnabled);
261+
}
262+
255263
HWTEST_F(CommandListImmediateFlushTaskComputeTests, givenFlushTaskSubmissionDisabledWhenCommandListIsInititalizedThenFlushTaskIsSetToFalse) {
256264
NEO::DebugManager.flags.EnableFlushTaskSubmission.set(0);
257265

0 commit comments

Comments
 (0)