Skip to content

Commit 8b5c567

Browse files
Remove wait on user fence during cmdlist destroy/reset
Signed-off-by: Kamil Kopryk <[email protected]> Related-To: NEO-7156
1 parent c694ccd commit 8b5c567

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,32 @@ HWTEST2_F(CommandListCreate, GivenGpuHangOnExecutingCommandListsWhenCreatingImme
10821082
commandList->cmdQImmediate = oldCommandQueue;
10831083
}
10841084

1085+
TEST_F(CommandListCreate, givenImmediateCommandListWhenThereIsNoEnoughSpaceForImmediateCommandThenNextCommandBufferIsUsed) {
1086+
ze_command_queue_desc_t desc = {};
1087+
desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
1088+
ze_result_t returnValue;
1089+
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::RenderCompute, returnValue));
1090+
ASSERT_NE(nullptr, commandList);
1091+
1092+
commandList->isFlushTaskSubmissionEnabled = true;
1093+
1094+
EXPECT_EQ(device, commandList->device);
1095+
EXPECT_EQ(CommandList::CommandListType::TYPE_IMMEDIATE, commandList->cmdListType);
1096+
EXPECT_NE(nullptr, commandList->cmdQImmediate);
1097+
1098+
void *srcPtr = reinterpret_cast<void *>(0x1234);
1099+
void *dstPtr = reinterpret_cast<void *>(0x2345);
1100+
1101+
// reduce available cmd buffer size, so next command can't fit in 1st and we need to use 2nd cmd buffer
1102+
size_t useSize = commandList->commandContainer.getCommandStream()->getMaxAvailableSpace() - maxImmediateCommandSize + 1;
1103+
commandList->commandContainer.getCommandStream()->getSpace(useSize);
1104+
EXPECT_EQ(1U, commandList->commandContainer.getCmdBufferAllocations().size());
1105+
1106+
auto result = commandList->appendMemoryCopy(dstPtr, srcPtr, 8, nullptr, 0, nullptr);
1107+
ASSERT_EQ(ZE_RESULT_SUCCESS, result);
1108+
EXPECT_EQ(2U, commandList->commandContainer.getCmdBufferAllocations().size());
1109+
}
1110+
10851111
HWTEST2_F(CommandListCreate, GivenGpuHangOnSynchronizingWhenCreatingImmediateCommandListAndWaitingOnEventsThenDeviceLostIsReturned, IsSKL) {
10861112
ze_command_queue_desc_t desc = {};
10871113
desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;

shared/source/command_container/cmdcontainer.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
236236
void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
237237
for (size_t i = startIndex; i < cmdBufferAllocations.size(); i++) {
238238
if (this->reusableAllocationList) {
239-
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
240239
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
241240
} else {
242241
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);

shared/source/command_container/cmdcontainer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum class ErrorCode {
3535

3636
class CommandContainer : public NonCopyableOrMovableClass {
3737
public:
38-
static constexpr size_t defaultListCmdBufferSize = MemoryConstants::kiloByte * 256;
38+
static constexpr size_t defaultListCmdBufferSize = 1u * MemoryConstants ::megaByte;
3939
static constexpr size_t cmdBufferReservedSize = MemoryConstants::cacheLineSize +
4040
CSRequirements::csOverfetchSize;
4141
static constexpr size_t totalCmdBufferSize = defaultListCmdBufferSize + cmdBufferReservedSize;

shared/test/unit_test/command_container/command_container_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWithAllocsListWhenAllocateAndReset
219219
auto cmdBuffer1 = cmdBufferAllocs[1];
220220

221221
cmdContainer->reset();
222-
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 1u);
222+
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 0u);
223223
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
224224
EXPECT_EQ(cmdBufferAllocs[0], cmdBuffer0);
225225
EXPECT_FALSE(allocList.peekIsEmpty());
@@ -231,7 +231,7 @@ TEST_F(CommandContainerTest, givenCmdContainerWithAllocsListWhenAllocateAndReset
231231
EXPECT_TRUE(allocList.peekIsEmpty());
232232

233233
cmdContainer.reset();
234-
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 3u);
234+
EXPECT_EQ(memoryManager->handleFenceCompletionCalled, 0u);
235235
EXPECT_FALSE(allocList.peekIsEmpty());
236236
allocList.freeAllGraphicsAllocations(pDevice);
237237
}

0 commit comments

Comments
 (0)