refactor: adjust unit tests to work with secondary engines
Related-To: NEO-12952, NEO-13789 Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
parent
c0838e1f76
commit
19a0a27862
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
* Copyright (C) 2022-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -342,6 +342,7 @@ void ImmediateCmdListSharedHeapsFixture::tearDown() {
|
|||
void ImmediateCmdListSharedHeapsFlushTaskFixtureInit::setUp(int32_t useImmediateFlushTask) {
|
||||
this->useImmediateFlushTask = useImmediateFlushTask;
|
||||
debugManager.flags.UseImmediateFlushTask.set(useImmediateFlushTask);
|
||||
debugManager.flags.ContextGroupSize.set(0);
|
||||
|
||||
ImmediateCmdListSharedHeapsFixture::setUp();
|
||||
}
|
||||
|
|
|
@ -1795,6 +1795,7 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierWit
|
|||
auto commandList0 = zeUniquePtr(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::renderCompute, returnValue));
|
||||
auto commandList = zeUniquePtr(CommandList::createImmediate(productFamily, device, &desc, false, NEO::EngineGroupType::renderCompute, returnValue));
|
||||
ASSERT_NE(nullptr, commandList);
|
||||
auto whiteBoxCmdList0 = static_cast<CommandList *>(commandList0.get());
|
||||
auto whiteBoxCmdList = static_cast<CommandList *>(commandList.get());
|
||||
whiteBoxCmdList->enableInOrderExecution();
|
||||
|
||||
|
@ -1813,7 +1814,7 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierWit
|
|||
ASSERT_EQ(ZE_RESULT_SUCCESS, eventPool->createEvent(&eventDesc, &event));
|
||||
std::unique_ptr<L0::Event> eventObject(L0::Event::fromHandle(event));
|
||||
|
||||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->getCsr(false));
|
||||
auto ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList0->getCsr(false));
|
||||
ultCsr->recordFlushedBatchBuffer = true;
|
||||
|
||||
auto directSubmission = new MockDirectSubmissionHw<FamilyType, RenderDispatcher<FamilyType>>(*ultCsr);
|
||||
|
@ -1838,6 +1839,9 @@ HWTEST2_F(CommandListCreateTests, givenInOrderExecutionWhenDispatchingBarrierWit
|
|||
ultCsr->unregisterClient(&client1);
|
||||
ultCsr->unregisterClient(&client2);
|
||||
|
||||
ultCsr = static_cast<NEO::UltCommandStreamReceiver<FamilyType> *>(whiteBoxCmdList->getCsr(false));
|
||||
ultCsr->recordFlushedBatchBuffer = true;
|
||||
|
||||
commandList->appendBarrier(event, 0, nullptr, false);
|
||||
|
||||
if (useImmediateFlushTask) {
|
||||
|
|
|
@ -3241,21 +3241,25 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
|||
returnValue = cmdListObject->close();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
auto sizeBeforeDestroy = csrStream.getUsed();
|
||||
|
||||
returnValue = cmdListObject->destroy();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
EXPECT_EQ(0u, csrStream.getUsed());
|
||||
EXPECT_EQ(sizeBeforeDestroy, csrStream.getUsed());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
||||
givenCommandListUsingPrivateSurfaceHeapWhenTaskCountZeroAndCommandListDestroyedThenCsrDoNotDispatchesStateCacheFlush,
|
||||
MatchAny) {
|
||||
HeapfulSupportedMatch) {
|
||||
auto &csr = neoDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
auto &csrStream = csr.commandStream;
|
||||
|
||||
ze_result_t returnValue;
|
||||
L0::ult::CommandList *cmdListObject = CommandList::whiteboxCast(CommandList::create(productFamily, device, engineGroupType, 0u, returnValue, false));
|
||||
|
||||
auto sizeBeforeDestroy = csrStream.getUsed();
|
||||
|
||||
returnValue = cmdListObject->destroy();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
|
@ -3264,7 +3268,7 @@ HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
|||
returnValue = cmdListObject->destroy();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
EXPECT_EQ(0u, csrStream.getUsed());
|
||||
EXPECT_EQ(sizeBeforeDestroy, csrStream.getUsed());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListStateBaseAddressPrivateHeapTest,
|
||||
|
|
|
@ -1437,7 +1437,7 @@ HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest, givenGlobalStatelessWh
|
|||
|
||||
HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
||||
givenGlobalStatelessWhenExecutingRegularCommandListThenBaseAddressPropertiesSetCorrectlyAndCommandProperlyDispatched,
|
||||
IsAtLeastXeHpCore) {
|
||||
IsWithinXeHpCoreAndXe3Core) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
commandList->heaplessModeEnabled = false;
|
||||
|
@ -1613,7 +1613,7 @@ HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
|||
|
||||
HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
||||
givenGlobalStatelessWhenExecutingRegularCommandListAndImmediateCommandListThenBaseAddressPropertiesSetCorrectlyAndCommandProperlyDispatchedOnlyOnce,
|
||||
IsAtLeastXeHpCore) {
|
||||
IsWithinXeHpCoreAndXe3Core) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
commandQueue->heaplessModeEnabled = false;
|
||||
|
@ -1764,7 +1764,7 @@ HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
|||
|
||||
HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
||||
givenGlobalStatelessWhenExecutingRegularCommandListAndPrivateHeapsCommandListThenBaseAddressPropertiesSetCorrectlyAndCommandProperlyDispatched,
|
||||
IsAtLeastXeHpCore) {
|
||||
IsWithinXeHpCoreAndXe3Core) {
|
||||
using STATE_BASE_ADDRESS = typename FamilyType::STATE_BASE_ADDRESS;
|
||||
|
||||
commandQueue->heaplessModeEnabled = false;
|
||||
|
@ -2715,13 +2715,15 @@ HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
auto cmdListHandle = cmdListObject->toHandle();
|
||||
auto usedBefore = csrStream.getUsed();
|
||||
|
||||
returnValue = commandQueue->executeCommandLists(1, &cmdListHandle, nullptr, true, nullptr);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
returnValue = cmdListObject->destroy();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
|
||||
EXPECT_EQ(0u, csrStream.getUsed());
|
||||
EXPECT_EQ(usedBefore, csrStream.getUsed());
|
||||
}
|
||||
|
||||
HWTEST2_F(CommandListStateBaseAddressGlobalStatelessTest,
|
||||
|
|
|
@ -795,7 +795,7 @@ TEST_F(DeviceCreateCommandQueueTest, givenLowPriorityDescWhenCreateCommandQueueI
|
|||
|
||||
TEST_F(DeviceCreateCommandQueueTest, givenCopyOrdinalWhenCreateCommandQueueWithLowPriorityDescIsCalledThenCopyCsrIsAssigned) {
|
||||
auto copyCsr = std::unique_ptr<NEO::CommandStreamReceiver>(neoDevice->createCommandStreamReceiver());
|
||||
EngineDescriptor copyEngineDescriptor({aub_stream::ENGINE_BCS, EngineUsage::regular}, neoDevice->getDeviceBitfield(), neoDevice->getPreemptionMode(), false);
|
||||
EngineDescriptor copyEngineDescriptor({aub_stream::ENGINE_BCS, EngineUsage::lowPriority}, neoDevice->getDeviceBitfield(), neoDevice->getPreemptionMode(), false);
|
||||
auto copyOsContext = neoDevice->getExecutionEnvironment()->memoryManager->createAndRegisterOsContext(copyCsr.get(), copyEngineDescriptor);
|
||||
copyCsr->setupContext(*copyOsContext);
|
||||
|
||||
|
@ -919,6 +919,7 @@ TEST_F(DeviceCreateCommandQueueTest, givenNormalPriorityDescWhenCreateCommandQue
|
|||
|
||||
ze_command_queue_handle_t commandQueueHandle = {};
|
||||
|
||||
neoDevice->disableSecondaryEngines = true;
|
||||
ze_result_t res = device->createCommandQueue(&desc, &commandQueueHandle);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
auto commandQueue = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle));
|
||||
|
@ -939,6 +940,7 @@ TEST_F(DeviceCreateCommandQueueTest,
|
|||
|
||||
ze_command_queue_handle_t commandQueueHandle = {};
|
||||
|
||||
neoDevice->disableSecondaryEngines = true;
|
||||
ze_result_t res = device->createCommandQueue(&desc, &commandQueueHandle);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
|
||||
auto commandQueue = static_cast<CommandQueueImp *>(L0::CommandQueue::fromHandle(commandQueueHandle));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
* Copyright (C) 2020-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -440,7 +440,7 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenImmCommandListsCreatedAnd
|
|||
neoDevice->getDefaultEngine().commandStreamReceiver->getOsContext().ensureContextInitialized(false);
|
||||
drmMock->ioctlCallsCount = 0;
|
||||
|
||||
ze_command_queue_desc_t queueDesc = {};
|
||||
ze_command_queue_desc_t queueDesc = {ZE_STRUCTURE_TYPE_COMMAND_QUEUE_DESC, nullptr, 0, 0, 0, ZE_COMMAND_QUEUE_MODE_DEFAULT, ZE_COMMAND_QUEUE_PRIORITY_NORMAL};
|
||||
ze_result_t returnValue;
|
||||
|
||||
ze_command_list_handle_t commandList1 = nullptr;
|
||||
|
@ -453,11 +453,11 @@ HWTEST_F(L0DebuggerLinuxTest, givenDebuggingEnabledWhenImmCommandListsCreatedAnd
|
|||
|
||||
returnValue = device->createCommandListImmediate(&queueDesc, &commandList2);
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, returnValue);
|
||||
EXPECT_EQ(1u, drmMock->ioctlCallsCount);
|
||||
EXPECT_EQ(1u, drmMock->notifyFirstCommandQueueCreatedCallsCount);
|
||||
EXPECT_EQ(2u, debuggerL0Hw->commandQueueCreatedCount);
|
||||
|
||||
CommandList::fromHandle(commandList1)->destroy();
|
||||
EXPECT_EQ(1u, drmMock->ioctlCallsCount);
|
||||
EXPECT_EQ(1u, drmMock->notifyFirstCommandQueueCreatedCallsCount);
|
||||
EXPECT_EQ(1u, debuggerL0Hw->commandQueueDestroyedCount);
|
||||
|
||||
CommandList::fromHandle(commandList2)->destroy();
|
||||
|
|
|
@ -1066,6 +1066,7 @@ HWTEST_F(CommandQueueHwTest, givenCommandQueueWhenDispatchingWorkThenRegisterCsr
|
|||
auto mockKernel = mockKernelWithInternals.mockKernel;
|
||||
|
||||
auto &csr = pDevice->getUltCommandStreamReceiver<FamilyType>();
|
||||
pDevice->disableSecondaryEngines = true;
|
||||
|
||||
size_t gws = 1;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -2748,6 +2748,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenMultipleFamiliesWhenCreatingQue
|
|||
|
||||
fillProperties(properties, 1, 0);
|
||||
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::regular);
|
||||
|
||||
device->disableSecondaryEngines = true;
|
||||
MockCommandQueue queueBcs(&context, context.getDevice(0), properties, false);
|
||||
EXPECT_EQ(engineBcs.commandStreamReceiver, queueBcs.getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS));
|
||||
EXPECT_TRUE(queueBcs.isCopyOnly);
|
||||
|
@ -2864,6 +2866,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenRootDeviceAndMultipleFamiliesWh
|
|||
|
||||
fillProperties(properties, 0, 0);
|
||||
EngineControl &defaultEngine = context.getDevice(0)->getDefaultEngine();
|
||||
|
||||
deviceFactory.rootDevices[0]->device.disableSecondaryEngines = true;
|
||||
MockCommandQueue defaultQueue(&context, context.getDevice(0), properties, false);
|
||||
EXPECT_EQ(&defaultEngine, &defaultQueue.getGpgpuEngine());
|
||||
EXPECT_FALSE(defaultQueue.isCopyOnly);
|
||||
|
@ -2873,6 +2877,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenRootDeviceAndMultipleFamiliesWh
|
|||
}
|
||||
|
||||
HWTEST_F(CommandQueueOnSpecificEngineTests, givenSubDeviceAndMultipleFamiliesWhenCreatingQueueOnSpecificEngineThenUseDefaultEngine) {
|
||||
DebugManagerStateRestore restore{};
|
||||
debugManager.flags.ContextGroupSize.set(0);
|
||||
|
||||
VariableBackup<HardwareInfo> backupHwInfo(defaultHwInfo.get());
|
||||
defaultHwInfo->capabilityTable.blitterOperationsSupported = true;
|
||||
|
@ -2894,6 +2900,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenSubDeviceAndMultipleFamiliesWhe
|
|||
|
||||
fillProperties(properties, 1, 0);
|
||||
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::regular);
|
||||
|
||||
MockCommandQueue queueBcs(&context, context.getDevice(0), properties, false);
|
||||
EXPECT_EQ(engineBcs.commandStreamReceiver, queueBcs.getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS));
|
||||
EXPECT_TRUE(queueBcs.isCopyOnly);
|
||||
|
@ -2909,11 +2916,14 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenBcsFamilySelectedWhenCreatingQu
|
|||
MockExecutionEnvironment mockExecutionEnvironment{};
|
||||
auto raiiGfxCoreHelper = overrideGfxCoreHelper<FamilyType, MockGfxCoreHelper<FamilyType, 0, 0, 1>>(*mockExecutionEnvironment.rootDeviceEnvironments[0]);
|
||||
|
||||
MockContext context{};
|
||||
auto mockDevice = std::make_unique<MockClDevice>(MockClDevice::createWithNewExecutionEnvironment<MockDevice>(nullptr));
|
||||
MockContext context{mockDevice.get(), false};
|
||||
cl_command_queue_properties properties[5] = {};
|
||||
|
||||
fillProperties(properties, 0, 0);
|
||||
EngineControl &engineBcs = context.getDevice(0)->getEngine(aub_stream::ENGINE_BCS, EngineUsage::regular);
|
||||
|
||||
mockDevice->device.disableSecondaryEngines = true;
|
||||
MockCommandQueue queueBcs(&context, context.getDevice(0), properties, false);
|
||||
EXPECT_EQ(engineBcs.commandStreamReceiver, queueBcs.getBcsCommandStreamReceiver(aub_stream::ENGINE_BCS));
|
||||
EXPECT_TRUE(queueBcs.isCopyOnly);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2021-2024 Intel Corporation
|
||||
* Copyright (C) 2021-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -568,7 +568,7 @@ struct BcsCsrSelectionCommandQueueTests : ::testing::Test {
|
|||
context = std::make_unique<MockContext>(clDevice.get());
|
||||
}
|
||||
|
||||
std::unique_ptr<MockCommandQueue> createQueueWithEngines(std::initializer_list<aub_stream::EngineType> engineTypes) {
|
||||
std::unique_ptr<MockCommandQueue> createQueueWithEngines(std::vector<aub_stream::EngineType> engineTypes) {
|
||||
auto queue = createQueue(nullptr);
|
||||
queue->clearBcsEngines();
|
||||
for (auto engineType : engineTypes) {
|
||||
|
@ -578,6 +578,24 @@ struct BcsCsrSelectionCommandQueueTests : ::testing::Test {
|
|||
return queue;
|
||||
}
|
||||
|
||||
std::vector<aub_stream::EngineType> getAllRegularBcsEngines() {
|
||||
std::vector<aub_stream::EngineType> bcsEngines;
|
||||
for (const auto &engine : device->getAllEngines()) {
|
||||
if (EngineHelpers::isBcs(engine.getEngineType()) && engine.getEngineUsage() == EngineUsage::regular) {
|
||||
bcsEngines.push_back(engine.getEngineType());
|
||||
}
|
||||
}
|
||||
return bcsEngines;
|
||||
}
|
||||
|
||||
std::vector<aub_stream::EngineType> getHalfOfRegularBcsEngines() {
|
||||
std::vector<aub_stream::EngineType> bcsEngines = getAllRegularBcsEngines();
|
||||
auto count = bcsEngines.size() / 2;
|
||||
bcsEngines.erase(bcsEngines.begin(), bcsEngines.begin() + count);
|
||||
|
||||
return bcsEngines;
|
||||
}
|
||||
|
||||
std::unique_ptr<MockCommandQueue> createQueueWithLinkBcsSelectedWithQueueFamilies(size_t linkBcsIndex) {
|
||||
const auto &productHelper = device->getRootDeviceEnvironment().getProductHelper();
|
||||
auto engineGroupType = EngineGroupType::linkedCopy;
|
||||
|
@ -799,36 +817,18 @@ HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenMultipleEnginesInQueueWhenSelec
|
|||
dstGraphicsAllocation.memoryPool = MemoryPool::localMemory;
|
||||
CsrSelectionArgs args{CL_COMMAND_COPY_BUFFER, &srcMemObj, &dstMemObj, 0u, nullptr};
|
||||
|
||||
const auto &productHelper = device->getRootDeviceEnvironment().getProductHelper();
|
||||
auto isBCS0Enabled = (aub_stream::ENGINE_BCS == productHelper.getDefaultCopyEngine());
|
||||
{
|
||||
auto queue = isBCS0Enabled ? createQueueWithEngines({aub_stream::ENGINE_BCS,
|
||||
aub_stream::ENGINE_BCS1,
|
||||
aub_stream::ENGINE_BCS2,
|
||||
aub_stream::ENGINE_BCS3,
|
||||
aub_stream::ENGINE_BCS4,
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8})
|
||||
: createQueueWithEngines({aub_stream::ENGINE_BCS1,
|
||||
aub_stream::ENGINE_BCS2,
|
||||
aub_stream::ENGINE_BCS3,
|
||||
aub_stream::ENGINE_BCS4,
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8});
|
||||
auto &&allEngines = getAllRegularBcsEngines();
|
||||
EXPECT_LE(2u, allEngines.size());
|
||||
auto queue = createQueueWithEngines(allEngines);
|
||||
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &selectedCsr);
|
||||
}
|
||||
{
|
||||
auto queue = createQueueWithEngines({
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8,
|
||||
});
|
||||
auto &&halfEngines = getHalfOfRegularBcsEngines();
|
||||
EXPECT_LE(2u, halfEngines.size());
|
||||
auto queue = createQueueWithEngines(halfEngines);
|
||||
CommandStreamReceiver &selectedCsr = queue->selectCsrForBuiltinOperation(args);
|
||||
EXPECT_EQ(&queue->getGpgpuCommandStreamReceiver(), &selectedCsr);
|
||||
}
|
||||
|
@ -849,23 +849,10 @@ HWTEST2_F(BcsCsrSelectionCommandQueueTests, givenMultipleEnginesInQueueWhenSelec
|
|||
const auto &productHelper = device->getRootDeviceEnvironment().getProductHelper();
|
||||
auto isBCS0Enabled = (aub_stream::ENGINE_BCS == productHelper.getDefaultCopyEngine());
|
||||
{
|
||||
auto queue = isBCS0Enabled ? createQueueWithEngines({aub_stream::ENGINE_BCS,
|
||||
aub_stream::ENGINE_BCS1,
|
||||
aub_stream::ENGINE_BCS2,
|
||||
aub_stream::ENGINE_BCS3,
|
||||
aub_stream::ENGINE_BCS4,
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8})
|
||||
: createQueueWithEngines({aub_stream::ENGINE_BCS1,
|
||||
aub_stream::ENGINE_BCS2,
|
||||
aub_stream::ENGINE_BCS3,
|
||||
aub_stream::ENGINE_BCS4,
|
||||
aub_stream::ENGINE_BCS5,
|
||||
aub_stream::ENGINE_BCS6,
|
||||
aub_stream::ENGINE_BCS7,
|
||||
aub_stream::ENGINE_BCS8});
|
||||
auto &&allEngines = getAllRegularBcsEngines();
|
||||
EXPECT_LE(2u, allEngines.size());
|
||||
auto queue = createQueueWithEngines(allEngines);
|
||||
|
||||
queue->bcsInitialized = false;
|
||||
|
||||
const auto nextCopyEngine = isBCS0Enabled ? aub_stream::ENGINE_BCS1 : aub_stream::ENGINE_BCS4;
|
||||
|
|
|
@ -2515,7 +2515,7 @@ HWTEST_F(StagingBufferTest, givenOutOfOrderCmdQueueWhenEnqueueStagingBufferMemcp
|
|||
HWTEST_F(StagingBufferTest, givenEnqueueStagingBufferMemcpyWhenTaskCountNotReadyThenCopySucessfullAndBuffersNotReused) {
|
||||
MockCommandQueueHw<FamilyType> myCmdQ(context, pClDevice, 0);
|
||||
auto initialUsmAllocs = svmManager->getNumAllocs();
|
||||
auto &csr = pCmdQ->getGpgpuCommandStreamReceiver();
|
||||
auto &csr = myCmdQ.getGpgpuCommandStreamReceiver();
|
||||
*csr.getTagAddress() = csr.peekTaskCount();
|
||||
retVal = myCmdQ.enqueueStagingBufferMemcpy(
|
||||
false, // cl_bool blocking_copy
|
||||
|
|
|
@ -326,6 +326,7 @@ void MemoryManager::checkGpuUsageAndDestroyGraphicsAllocations(GraphicsAllocatio
|
|||
auto osContextId = engine.osContext->getContextId();
|
||||
auto allocationTaskCount = gfxAllocation->getTaskCount(osContextId);
|
||||
if (gfxAllocation->isUsedByOsContext(osContextId) &&
|
||||
engine.commandStreamReceiver->getTagAllocation() != nullptr &&
|
||||
allocationTaskCount > *engine.commandStreamReceiver->getTagAddress()) {
|
||||
engine.commandStreamReceiver->getInternalAllocationStorage()->storeAllocation(std::unique_ptr<GraphicsAllocation>(gfxAllocation),
|
||||
DEFERRED_DEALLOCATION);
|
||||
|
|
|
@ -203,7 +203,7 @@ MemoryOperationsStatus DrmMemoryOperationsHandlerBind::evictUnusedAllocationsImp
|
|||
evict = false;
|
||||
break;
|
||||
}
|
||||
if (waitForCompletion) {
|
||||
if (waitForCompletion && engine.commandStreamReceiver->isInitialized()) {
|
||||
const auto waitStatus = engine.commandStreamReceiver->waitForCompletionWithTimeout(WaitParams{false, false, false, 0}, engine.commandStreamReceiver->peekLatestFlushedTaskCount());
|
||||
if (waitStatus == WaitStatus::gpuHang) {
|
||||
return MemoryOperationsStatus::gpuHangDetectedDuringOperation;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2024 Intel Corporation
|
||||
* Copyright (C) 2018-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -395,6 +395,7 @@ class DrmMockResources : public DrmMock {
|
|||
|
||||
uint32_t notifyFirstCommandQueueCreated(const void *data, size_t size) override {
|
||||
ioctlCallsCount++;
|
||||
notifyFirstCommandQueueCreatedCallsCount++;
|
||||
capturedCmdQData = std::make_unique<uint64_t[]>((size + sizeof(uint64_t) - 1) / sizeof(uint64_t));
|
||||
capturedCmdQSize = size;
|
||||
memcpy(capturedCmdQData.get(), data, size);
|
||||
|
@ -409,6 +410,7 @@ class DrmMockResources : public DrmMock {
|
|||
|
||||
uint32_t unregisteredHandle = 0;
|
||||
uint32_t unregisterCalledCount = 0;
|
||||
uint32_t notifyFirstCommandQueueCreatedCallsCount = 0;
|
||||
DrmResourceClass registeredClass = DrmResourceClass::maxSize;
|
||||
bool registerClassesCalled = false;
|
||||
uint64_t registeredData[128];
|
||||
|
|
|
@ -193,6 +193,13 @@ AILConfiguration *MockDevice::getAilConfigurationHelper() const {
|
|||
return Device::getAilConfigurationHelper();
|
||||
}
|
||||
|
||||
EngineControl *MockDevice::getSecondaryEngineCsr(EngineTypeUsage engineTypeUsage, bool allocateInterrupt) {
|
||||
if (disableSecondaryEngines) {
|
||||
return nullptr;
|
||||
}
|
||||
return RootDevice::getSecondaryEngineCsr(engineTypeUsage, allocateInterrupt);
|
||||
}
|
||||
|
||||
bool MockSubDevice::createEngine(EngineTypeUsage engineTypeUsage) {
|
||||
if (failOnCreateEngine) {
|
||||
return false;
|
||||
|
|
|
@ -182,6 +182,8 @@ class MockDevice : public RootDevice {
|
|||
return getGlobalMemorySizeReturn;
|
||||
}
|
||||
|
||||
EngineControl *getSecondaryEngineCsr(EngineTypeUsage engineTypeUsage, bool allocateInterrupt) override;
|
||||
|
||||
static ExecutionEnvironment *prepareExecutionEnvironment(const HardwareInfo *pHwInfo);
|
||||
static decltype(&createCommandStream) createCommandStreamReceiverFunc;
|
||||
|
||||
|
@ -195,6 +197,7 @@ class MockDevice : public RootDevice {
|
|||
AILConfiguration *mockAilConfigurationHelper = nullptr;
|
||||
uint64_t getGlobalMemorySizeReturn = 0u;
|
||||
bool callBaseGetGlobalMemorySize = true;
|
||||
bool disableSecondaryEngines = false;
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2019-2024 Intel Corporation
|
||||
* Copyright (C) 2019-2025 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -91,6 +91,10 @@ void DrmMemoryManagerFixture::tearDown() {
|
|||
enginesCount += engineContainer.size();
|
||||
}
|
||||
|
||||
for (auto &engineContainer : memoryManager->secondaryEngines) {
|
||||
enginesCount -= engineContainer.size();
|
||||
}
|
||||
|
||||
mock->ioctlExpected.contextDestroy = enginesCount;
|
||||
mock->ioctlExpected.gemClose = enginesCount;
|
||||
mock->ioctlExpected.gemWait = enginesCount;
|
||||
|
|
|
@ -2169,6 +2169,8 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche
|
|||
|
||||
TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) {
|
||||
auto &gfxCoreHelper = csr->getGfxCoreHelper();
|
||||
csr->initializeTagAllocation();
|
||||
|
||||
memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor(gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment.rootDeviceEnvironments[0])[0],
|
||||
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
|
||||
auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
|
||||
|
|
Loading…
Reference in New Issue