Add RemoveUserFenceInCmdlistResetAndDestroy debug flag

Related-To: NEO-7156
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2022-09-19 16:21:08 +00:00
committed by Compute-Runtime-Automation
parent 3d5e34f727
commit 17d87a4c69
5 changed files with 38 additions and 2 deletions

View File

@ -52,6 +52,10 @@ CommandContainer::CommandContainer() {
}
residencyContainer.reserve(startingResidencyContainerSize);
if (DebugManager.flags.RemoveUserFenceInCmdlistResetAndDestroy.get() != -1) {
isHandleFenceCompletionRequired = !static_cast<bool>(DebugManager.flags.RemoveUserFenceInCmdlistResetAndDestroy.get());
}
}
CommandContainer::CommandContainer(uint32_t maxNumAggregatedIdds) : CommandContainer() {
@ -248,8 +252,12 @@ IndirectHeap *CommandContainer::getHeapWithRequiredSizeAndAlignment(HeapType hea
void CommandContainer::handleCmdBufferAllocations(size_t startIndex) {
for (size_t i = startIndex; i < cmdBufferAllocations.size(); i++) {
if (this->reusableAllocationList) {
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
if (isHandleFenceCompletionRequired) {
this->device->getMemoryManager()->handleFenceCompletion(cmdBufferAllocations[i]);
}
reusableAllocationList->pushFrontOne(*cmdBufferAllocations[i]);
} else {
this->device->getMemoryManager()->freeGraphicsMemory(cmdBufferAllocations[i]);
}

View File

@ -110,6 +110,8 @@ class CommandContainer : public NonCopyableOrMovableClass {
bool systolicModeSupport = false;
protected:
size_t getTotalCmdBufferSize();
void *iddBlock = nullptr;
Device *device = nullptr;
AllocationsList *reusableAllocationList = nullptr;
@ -129,7 +131,7 @@ class CommandContainer : public NonCopyableOrMovableClass {
std::vector<GraphicsAllocation *> deallocationContainer;
bool isFlushTaskUsedForImmediate = false;
size_t getTotalCmdBufferSize();
bool isHandleFenceCompletionRequired = true;
};
} // namespace NEO

View File

@ -213,6 +213,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, UseContextEndOffsetForEventCompletion, -1, "Use
DECLARE_DEBUG_VARIABLE(int32_t, ForceWddmLowPriorityContextValue, -1, "Force scheduling priority value during Wddm low priority context creation. -1 - default.")
DECLARE_DEBUG_VARIABLE(int32_t, FailBuildProgramWithStatefulAccess, -1, "-1: default, 0: disable, 1: enable, Fail build program/module creation whenever stateful access is discovered (except built in kernels).")
DECLARE_DEBUG_VARIABLE(int32_t, ForceImagesSupport, -1, "-1: default, 0: disable, 1: enable. Override support for Images.")
DECLARE_DEBUG_VARIABLE(int32_t, RemoveUserFenceInCmdlistResetAndDestroy, -1, "-1: default - disabled, 0: disable, 1: enable. If enabled remove user fence during cmdlist reset and destroy.")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideCmdListCmdBufferSizeInKb, -1, "-1: default, 0: disable, >0: size in KB. Override cmd list command buffer size in KB.")
DECLARE_DEBUG_VARIABLE(int32_t, OverrideL1CachePolicyInSurfaceStateAndStateless, -1, "-1: default, >=0 : following policy will be programmed in render surface state (for regular buffers) and stateless L1 caching")
DECLARE_DEBUG_VARIABLE(int32_t, PlaformSupportEvictIfNecessaryFlag, -1, "-1: default - platform specific, 0: disable, 1: enable")

View File

@ -449,6 +449,7 @@ EnableBcsSwControlWa = -1
ExperimentalEnableL0DebuggerForOpenCL = 0
DebuggerDisableSingleAddressSbaTracking = 0
ForceImagesSupport = -1
RemoveUserFenceInCmdlistResetAndDestroy = -1
ForceCsrLockInBcsEnqueueOnlyForGpgpuSubmission = -1
ExperimentalEnableTileAttach = 0
DirectSubmissionDisablePrefetcher = -1

View File

@ -236,6 +236,30 @@ TEST_F(CommandContainerTest, givenCmdContainerWithAllocsListWhenAllocateAndReset
allocList.freeAllGraphicsAllocations(pDevice);
}
TEST_F(CommandContainerTest, givenReusableAllocationsAndRemoveUserFenceInCmdlistResetAndDestroyFlagWhenAllocateAndResetThenHandleFenceCompletionIsNotCalled) {
DebugManagerStateRestore restore;
DebugManager.flags.RemoveUserFenceInCmdlistResetAndDestroy.set(1);
AllocationsList allocList;
auto cmdContainer = std::make_unique<CommandContainer>();
cmdContainer->initialize(pDevice, &allocList, true);
auto &cmdBufferAllocs = cmdContainer->getCmdBufferAllocations();
auto memoryManager = static_cast<MockMemoryManager *>(pDevice->getMemoryManager());
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
EXPECT_EQ(cmdBufferAllocs.size(), 1u);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdContainer->reset();
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
cmdContainer->allocateNextCommandBuffer();
EXPECT_EQ(cmdBufferAllocs.size(), 2u);
cmdContainer.reset();
EXPECT_EQ(0u, memoryManager->handleFenceCompletionCalled);
allocList.freeAllGraphicsAllocations(pDevice);
}
TEST_F(CommandContainerTest, givenCommandContainerDuringInitWhenAllocateHeapMemoryFailsThenErrorIsReturned) {
CommandContainer cmdContainer;
auto tempMemoryManager = pDevice->executionEnvironment->memoryManager.release();