mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
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:

committed by
Compute-Runtime-Automation

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();
|
||||
|
Reference in New Issue
Block a user