Revert "Fix for task count hang issue"

This reverts commit 340ba8bf56.

Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2022-05-25 10:19:53 -07:00
committed by Compute-Runtime-Automation
parent 8812f6250b
commit 359e848dbe
8 changed files with 27 additions and 123 deletions

View File

@@ -96,8 +96,6 @@ NEO::SubmissionStatus CommandQueueImp::submitBatchBuffer(size_t offset, NEO::Res
csr->setActivePartitions(partitionCount);
auto ret = csr->submitBatchBuffer(batchBuffer, csr->getResidencyAllocations());
if (ret != NEO::SubmissionStatus::SUCCESS) {
commandStream->getGraphicsAllocation()->updateTaskCount(csr->peekTaskCount(), csr->getOsContext().getContextId());
commandStream->getGraphicsAllocation()->updateResidencyTaskCount(csr->peekTaskCount(), csr->getOsContext().getContextId());
return ret;
}

View File

@@ -22,7 +22,6 @@
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/pipe_control_args.h"
#include "shared/source/helpers/preamble.h"
#include "shared/source/memory_manager/graphics_allocation.h"
#include "shared/source/memory_manager/memory_manager.h"
#include "shared/source/memory_manager/residency_container.h"
#include "shared/source/os_interface/hw_info_config.h"
@@ -476,30 +475,27 @@ ze_result_t CommandQueueHw<gfxCoreFamily>::executeCommandLists(
csr->setLatestFlushedTaskCount(this->taskCount);
}
ze_result_t retVal = ZE_RESULT_SUCCESS;
csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
if (getSynchronousMode() == ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS) {
const auto synchronizeResult = this->synchronize(std::numeric_limits<uint64_t>::max());
if (synchronizeResult == ZE_RESULT_ERROR_DEVICE_LOST) {
retVal = ZE_RESULT_ERROR_DEVICE_LOST;
return ZE_RESULT_ERROR_DEVICE_LOST;
}
} else {
csr->pollForCompletion();
}
this->heapContainer.clear();
if ((ret != NEO::SubmissionStatus::SUCCESS) || (retVal == ZE_RESULT_ERROR_DEVICE_LOST)) {
for (auto &gfx : csr->getResidencyAllocations()) {
gfx->updateTaskCount(csr->peekLatestFlushedTaskCount(), csr->getOsContext().getContextId());
}
if (retVal != ZE_RESULT_ERROR_DEVICE_LOST) {
retVal = ZE_RESULT_ERROR_UNKNOWN;
}
csr->pollForCompletion();
if (ret != NEO::SubmissionStatus::SUCCESS) {
if (ret == NEO::SubmissionStatus::OUT_OF_MEMORY) {
retVal = ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
return ZE_RESULT_ERROR_OUT_OF_DEVICE_MEMORY;
}
return ZE_RESULT_ERROR_UNKNOWN;
}
csr->makeSurfacePackNonResident(csr->getResidencyAllocations());
return retVal;
return ZE_RESULT_SUCCESS;
}
template <GFXCORE_FAMILY gfxCoreFamily>

View File

@@ -353,15 +353,11 @@ HWTEST_F(CommandQueueCreate, givenContainerWithAllocationsWhenResidencyContainer
false,
returnValue));
ResidencyContainer container;
uint32_t peekTaskCountBefore = commandQueue->csr->peekTaskCount();
uint32_t flushedTaskCountBefore = commandQueue->csr->peekLatestFlushedTaskCount();
NEO::SubmissionStatus ret = commandQueue->submitBatchBuffer(0, container, nullptr, false);
commandQueue->submitBatchBuffer(0, container, nullptr, false);
EXPECT_EQ(csr->makeResidentCalledTimes, 0u);
EXPECT_EQ(ret, NEO::SubmissionStatus::SUCCESS);
EXPECT_EQ((peekTaskCountBefore + 1), commandQueue->csr->peekTaskCount());
EXPECT_EQ((flushedTaskCountBefore + 1), commandQueue->csr->peekLatestFlushedTaskCount());
EXPECT_EQ(commandQueue->commandStream->getGraphicsAllocation()->getTaskCount(commandQueue->csr->getOsContext().getContextId()), commandQueue->csr->peekTaskCount());
EXPECT_EQ(commandQueue->commandStream->getGraphicsAllocation()->getTaskCount(commandQueue->csr->getOsContext().getContextId()), commandQueue->csr->peekTaskCount());
EXPECT_EQ(commandQueue->commandStream->getGraphicsAllocation()->getResidencyTaskCount(commandQueue->csr->getOsContext().getContextId()), commandQueue->csr->peekTaskCount());
commandQueue->destroy();
}
@@ -378,14 +374,9 @@ HWTEST_F(CommandQueueCreate, givenCommandStreamReceiverFailsThenSubmitBatchBuffe
false,
returnValue));
ResidencyContainer container;
uint32_t peekTaskCountBefore = commandQueue->csr->peekTaskCount();
uint32_t flushedTaskCountBefore = commandQueue->csr->peekLatestFlushedTaskCount();
NEO::SubmissionStatus ret = commandQueue->submitBatchBuffer(0, container, nullptr, false);
EXPECT_EQ(ret, NEO::SubmissionStatus::FAILED);
EXPECT_EQ(peekTaskCountBefore, commandQueue->csr->peekTaskCount());
EXPECT_EQ(flushedTaskCountBefore, commandQueue->csr->peekLatestFlushedTaskCount());
EXPECT_EQ(commandQueue->commandStream->getGraphicsAllocation()->getTaskCount(commandQueue->csr->getOsContext().getContextId()), commandQueue->csr->peekTaskCount());
EXPECT_EQ(commandQueue->commandStream->getGraphicsAllocation()->getResidencyTaskCount(commandQueue->csr->getOsContext().getContextId()), commandQueue->csr->peekTaskCount());
commandQueue->destroy();
}
@@ -1526,57 +1517,6 @@ HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenExecuteComma
commandList->destroy();
}
HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenResetGraphicsTaskCounts, IsAtLeastSkl) {
ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr;
device->getCsrForOrdinalAndIndex(&csr, 0u, 0u);
auto commandQueue = new MockCommandQueueSubmitBatchBuffer<gfxCoreFamily>(device, csr, &desc);
commandQueue->submitBatchBufferResult = NEO::SubmissionStatus::FAILED;
commandQueue->initialize(false, false);
auto commandList = new CommandListCoreFamily<gfxCoreFamily>();
commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
auto commandListHandle = commandList->toHandle();
void *alloc = alignedMalloc(0x100, 0x100);
NEO::GraphicsAllocation graphicsAllocation1(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u);
NEO::GraphicsAllocation graphicsAllocation2(0, NEO::AllocationType::BUFFER, alloc, 0u, 0u, 1u, MemoryPool::System4KBPages, 1u);
graphicsAllocation1.updateTaskCount(3, csr->getOsContext().getContextId());
graphicsAllocation2.updateTaskCount(3, csr->getOsContext().getContextId());
commandList->commandContainer.addToResidencyContainer(&graphicsAllocation1);
commandList->commandContainer.addToResidencyContainer(&graphicsAllocation2);
auto res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, res);
EXPECT_EQ(0u, graphicsAllocation1.getTaskCount(csr->getOsContext().getContextId()));
EXPECT_EQ(0u, graphicsAllocation2.getTaskCount(csr->getOsContext().getContextId()));
commandQueue->destroy();
commandList->destroy();
alignedFree(alloc);
}
HWTEST2_F(ExecuteCommandListTests, givenFailingSubmitBatchBufferThenWaitForCompletionFalse, IsAtLeastSkl) {
ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr;
device->getCsrForOrdinalAndIndex(&csr, 0u, 0u);
auto commandQueue = new MockCommandQueueSubmitBatchBuffer<gfxCoreFamily>(device, csr, &desc);
commandQueue->submitBatchBufferResult = NEO::SubmissionStatus::FAILED;
commandQueue->initialize(false, false);
auto commandList = new CommandListCoreFamily<gfxCoreFamily>();
commandList->initialize(device, NEO::EngineGroupType::Compute, 0u);
auto commandListHandle = commandList->toHandle();
uint32_t flushedTaskCountPrior = csr->peekTaskCount();
csr->setLatestFlushedTaskCount(flushedTaskCountPrior);
auto res = commandQueue->executeCommandLists(1, &commandListHandle, nullptr, false);
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, res);
EXPECT_EQ(csr->peekLatestFlushedTaskCount(), flushedTaskCountPrior);
commandQueue->destroy();
commandList->destroy();
}
HWTEST2_F(ExecuteCommandListTests, givenSuccessfulSubmitBatchBufferThenExecuteCommandListReturnsSuccess, IsAtLeastSkl) {
ze_command_queue_desc_t desc = {};
NEO::CommandStreamReceiver *csr;