Move fillReusableAllocationLists to first append

Related-To: NEO-7422

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2023-02-15 12:34:14 +00:00
committed by Compute-Runtime-Automation
parent b485c025d0
commit 4c32529b5b
8 changed files with 29 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ NEO::LogicalStateHelper *CommandListCoreFamilyImmediate<gfxCoreFamily>::getLogic
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamilyImmediate<gfxCoreFamily>::checkAvailableSpace(uint32_t numEvents) {
this->commandContainer.fillReusableAllocationLists();
size_t semaphoreSize = NEO::EncodeSempahore<GfxFamily>::getSizeMiSemaphoreWait() * numEvents;
if (this->commandContainer.getCommandStream()->getAvailableSpace() < maxImmediateCommandSize + semaphoreSize) {

View File

@@ -167,7 +167,6 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device
commandList->isBcsSplitNeeded = deviceImp->bcsSplit.setupDevice(productFamily, internalUsage, desc, csr);
commandList->commandContainer.setImmediateCmdListCsr(csr);
commandList->commandContainer.fillReusableAllocationLists();
if (commandList->isWaitForEventsFromHostEnabled()) {
commandList->numThreads = NEO::SysCalls::getNumThreads();

View File

@@ -1093,6 +1093,7 @@ HWTEST2_F(CommandListStateBaseAddressTest,
givenStateBaseAddressTrackingWhenImmediateCmdListAppendKernelChangesHeapsAndExecuteThenFinalBaseAddressStateIsStoredInCsr,
IsAtLeastSkl) {
NEO::DebugManager.flags.DisableResourceRecycling.set(true);
NEO::DebugManager.flags.SetAmountOfReusableAllocations.set(0u);
NEO::StateBaseAddressPropertiesSupport sbaPropertiesSupport = {};
auto &productHelper = device->getProductHelper();

View File

@@ -308,6 +308,7 @@ HWTEST2_F(CommandListTest, givenImmediateCommandListWhenAppendMemoryRangesBarrie
cmdList.isFlushTaskSubmissionEnabled = true;
cmdList.cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
result = cmdList.appendMemoryRangesBarrier(numRanges, &rangeSizes,
ranges, nullptr, 0,
@@ -328,6 +329,7 @@ HWTEST2_F(CommandListTest, givenImmediateCommandListWhenAppendMemoryRangesBarrie
cmdList.isFlushTaskSubmissionEnabled = false;
cmdList.cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
result = cmdList.appendMemoryRangesBarrier(numRanges, &rangeSizes,
ranges, nullptr, 0,
@@ -341,6 +343,7 @@ HWTEST2_F(CommandListTest, givenImmediateCommandListWhenFlushImmediateThenOverri
MockCommandListImmediateHw<gfxCoreFamily> cmdList;
cmdList.cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
cmdList.initialize(device, NEO::EngineGroupType::Copy, 0u);
cmdList.commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ze_event_pool_desc_t eventPoolDesc = {};
eventPoolDesc.count = 1;

View File

@@ -785,6 +785,7 @@ HWTEST2_F(CmdlistAppendLaunchKernelTests,
desc.mode = ZE_COMMAND_QUEUE_MODE_SYNCHRONOUS;
MockCommandQueueHw<gfxCoreFamily> mockCommandQueue(device, device->getNEODevice()->getDefaultEngine().commandStreamReceiver, &desc);
commandList->cmdQImmediate = &mockCommandQueue;
commandList->commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ze_group_count_t groupCount = {3, 2, 1};
CmdListKernelLaunchParams launchParams = {};

View File

@@ -873,6 +873,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendLaun
cmdList.cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
cmdList.csr = device->getNEODevice()->getDefaultEngine().commandStreamReceiver;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
returnValue = cmdList.appendLaunchCooperativeKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, false);
@@ -888,6 +889,7 @@ HWTEST2_F(CommandListAppendLaunchKernel, givenImmediateCommandListWhenAppendLaun
cmdList.cmdListType = CommandList::CommandListType::TYPE_IMMEDIATE;
cmdList.csr = device->getNEODevice()->getDefaultEngine().commandStreamReceiver;
cmdList.initialize(device, NEO::EngineGroupType::RenderCompute, 0u);
cmdList.commandContainer.setImmediateCmdListCsr(device->getNEODevice()->getDefaultEngine().commandStreamReceiver);
ze_group_count_t groupCount{1, 1, 1};
ze_result_t returnValue;
returnValue = cmdList.appendLaunchCooperativeKernel(kernel->toHandle(), &groupCount, nullptr, 0, nullptr, false);

View File

@@ -1003,9 +1003,24 @@ HWTEST2_F(CreateCommandListXeHpcTest, whenDestroyImmediateCommandListThenGlobalA
EXPECT_FALSE(static_cast<DeviceImp *>(device)->allocationsForReuse->peekIsEmpty());
}
HWTEST2_F(CreateCommandListXeHpcTest, whenFlagDisabledAndCreateImmediateCommandListThenAllocationListEmpty, IsXeHpcCore) {
HWTEST2_F(CreateCommandListXeHpcTest, whenFlagEnabledAndCreateImmediateCommandListThenAllocationListEmpty, IsXeHpcCore) {
DebugManagerStateRestore restore;
DebugManager.flags.SetAmountOfReusableAllocations.set(0);
DebugManager.flags.SetAmountOfReusableAllocations.set(2);
const ze_command_queue_desc_t desc = {};
bool internalEngine = true;
ze_result_t returnValue;
std::unique_ptr<L0::CommandList> commandList(CommandList::createImmediate(productFamily,
device,
&desc,
internalEngine,
NEO::EngineGroupType::RenderCompute,
returnValue));
ASSERT_NE(nullptr, commandList);
EXPECT_TRUE(static_cast<DeviceImp *>(device)->allocationsForReuse->peekIsEmpty());
}
HWTEST2_F(CreateCommandListXeHpcTest, whenCreateImmediateCommandListThenAllocationListEmpty, IsXeHpcCore) {
const ze_command_queue_desc_t desc = {};
bool internalEngine = true;