refactor: Remove redundancy around gemCloseWorker in csr

Related-To: NEO-13922

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-02-12 11:36:31 +00:00
committed by Compute-Runtime-Automation
parent 9085f6aeca
commit c7c7ae9d49
11 changed files with 122 additions and 147 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -16,6 +16,7 @@
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/common/fixtures/mock_aub_center_fixture.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/engine_descriptor_helper.h"
#include "shared/test/common/helpers/execution_environment_helper.h"
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
#include "shared/test/common/test_macros/hw_test.h"
@@ -47,18 +48,17 @@ HWTEST_F(DeviceCommandStreamLeaksTest, WhenCreatingDeviceCsrThenValidPointerIsRe
EXPECT_NE(nullptr, ptr);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWithAubDumWhenItIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment);
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(true, *executionEnvironment, 0, 1));
auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1));
ptr->setupContext(*osContext);
auto drmCsrWithAubDump = (CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *)ptr.get();
EXPECT_EQ(drmCsrWithAubDump->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_FALSE(drmCsrWithAubDump->isGemCloseWorkerActive());
auto aubCSR = static_cast<CommandStreamReceiverWithAUBDump<DrmCommandStreamReceiver<FamilyType>> *>(ptr.get())->aubCSR.get();
EXPECT_NE(nullptr, aubCSR);
delete osContext;
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultDrmCsrWhenOsInterfaceIsNullptrThenValidateDrm) {
@@ -74,36 +74,54 @@ HWTEST_F(DeviceCommandStreamLeaksTest, givenDisabledGemCloseWorkerWhenCsrIsCreat
DebugManagerStateRestore restorer;
debugManager.flags.EnableGemCloseWorker.set(0u);
executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment);
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1));
ptr->setupContext(*osContext);
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_FALSE(drmCsr->isGemCloseWorkerActive());
delete osContext;
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenEnabledGemCloseWorkerWhenCsrIsCreatedThenGemCloseWorkerActiveModeIsSelected) {
DebugManagerStateRestore restorer;
debugManager.flags.EnableGemCloseWorker.set(1u);
executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment);
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1));
ptr->setupContext(*osContext);
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_TRUE(drmCsr->isGemCloseWorkerActive());
delete osContext;
}
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultGemCloseWorkerWhenCsrIsCreatedThenGemCloseWorkerActiveModeIsSelected) {
executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment);
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::regular}, PreemptionMode::ThreadGroup, 0b1));
ptr->setupContext(*osContext);
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
EXPECT_TRUE(drmCsr->isGemCloseWorkerActive());
delete osContext;
}
using DeviceCommandStreamSetInternalUsageTests = DeviceCommandStreamLeaksTest;
HWTEST_F(DeviceCommandStreamSetInternalUsageTests, givenValidDrmCsrThenGemCloseWorkerOperationModeIsSetToInactiveWhenInternalUsageIsSet) {
HWTEST_F(DeviceCommandStreamLeaksTest, givenDefaultGemCloseWorkerWhenInternalCsrIsCreatedThenGemCloseWorkerInactiveModeIsSelected) {
executionEnvironment->memoryManager = DrmMemoryManager::create(*executionEnvironment);
std::unique_ptr<CommandStreamReceiver> ptr(DeviceCommandStreamReceiver<FamilyType>::create(false, *executionEnvironment, 0, 1));
auto osContext = OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), 0, 0,
EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_CCS, EngineUsage::internal}, PreemptionMode::ThreadGroup, 0b1));
ptr->setupContext(*osContext);
auto drmCsr = (DrmCommandStreamReceiver<FamilyType> *)ptr.get();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerActive);
drmCsr->initializeDefaultsForInternalEngine();
EXPECT_EQ(drmCsr->peekGemCloseWorkerOperationMode(), GemCloseWorkerMode::gemCloseWorkerInactive);
EXPECT_FALSE(drmCsr->isGemCloseWorkerActive());
delete osContext;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2024 Intel Corporation
* Copyright (C) 2018-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -49,7 +49,7 @@ HWTEST_F(DrmCommandStreamMMTest, GivenForcePinThenMemoryManagerCreatesPinBb) {
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u, false);
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1);
auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment);
executionEnvironment.memoryManager.reset(memoryManager);
@@ -69,7 +69,7 @@ HWTEST_F(DrmCommandStreamMMTest, givenForcePinDisabledWhenMemoryManagerIsCreated
executionEnvironment.rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, 1);
auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment);
executionEnvironment.memoryManager.reset(memoryManager);

View File

@@ -26,7 +26,7 @@ using namespace NEO;
HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenL0ApiConfigWhenCreatingDrmCsrThenEnableImmediateDispatch) {
VariableBackup<ApiSpecificConfig::ApiType> backup(&apiTypeForUlts, ApiSpecificConfig::L0);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1);
EXPECT_EQ(DispatchMode::immediateDispatch, csr.dispatchMode);
}
@@ -42,7 +42,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenEnabledDirectSubmissionWhenGetting
debugManager.flags.EnableDrmCompletionFence.set(1);
debugManager.flags.EnableDirectSubmission.set(1);
debugManager.flags.DirectSubmissionDisableMonitorFence.set(0);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr(executionEnvironment, 0, 1);
csr.setupContext(*osContext);
EXPECT_EQ(nullptr, csr.completionFenceValuePointer);
@@ -101,10 +101,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, GivenExecBufferErrorWhenFlushInternalTh
EXPECT_EQ(SubmissionStatus::outOfHostMemory, ret);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDefaultDrmCSRWhenItIsCreatedThenGemCloseWorkerModeIsInactive) {
EXPECT_EQ(GemCloseWorkerMode::gemCloseWorkerInactive, static_cast<const DrmCommandStreamReceiver<FamilyType> *>(csr)->peekGemCloseWorkerOperationMode());
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenCommandStreamWhenItIsFlushedWithGemCloseWorkerInDefaultModeThenWorkerDecreasesTheRefCount) {
auto commandBuffer = mm->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr->getRootDeviceIndex(), MemoryConstants::pageSize});
ASSERT_NE(nullptr, commandBuffer);
@@ -263,13 +259,6 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDebugFlagSetWhenFlushingTh
mm->freeGraphicsMemory(commandBuffer);
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmCsrCreatedWithInactiveGemCloseWorkerPolicyThenThreadIsNotCreated) {
TestedDrmCommandStreamReceiver<FamilyType> testedCsr(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
EXPECT_EQ(GemCloseWorkerMode::gemCloseWorkerInactive, testedCsr.peekGemCloseWorkerOperationMode());
}
HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenDrmAllocationWhenGetBufferObjectToModifyIsCalledForAGivenHandleIdThenTheCorrespondingBufferObjectGetsModified) {
auto size = 1024u;
auto allocation = new DrmAllocation(0, 1u /*num gmms*/, AllocationType::unknown, nullptr, nullptr, size, static_cast<osHandle>(0u), MemoryPool::memoryNull);
@@ -968,9 +957,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
device->resetCommandStreamReceiver(testedCsr);
@@ -999,9 +988,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
device->resetCommandStreamReceiver(testedCsr);
@@ -1033,9 +1022,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = false;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
device->resetCommandStreamReceiver(testedCsr);
@@ -1063,9 +1052,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenWaitUserFenceFlagNotSetWhe
debugManager.flags.EnableUserFenceForCompletionWait.set(0);
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync());
device->resetCommandStreamReceiver(testedCsr);
@@ -1104,9 +1093,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenGemWaitUsedWhenKmdTimeoutU
debugManager.flags.EnableUserFenceForCompletionWait.set(0);
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync());
device->resetCommandStreamReceiver(testedCsr);
@@ -1129,9 +1118,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
device->resetCommandStreamReceiver(testedCsr);
@@ -1178,9 +1167,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->configureGpuFaultCheckThreshold();
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
@@ -1229,9 +1218,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = false;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
device->resetCommandStreamReceiver(testedCsr);
@@ -1257,9 +1246,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync());
device->resetCommandStreamReceiver(testedCsr);
@@ -1286,9 +1275,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
TestedDrmCommandStreamReceiver<FamilyType> *testedCsr =
new TestedDrmCommandStreamReceiver<FamilyType>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
new TestedDrmCommandStreamReceiver<FamilyType>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
device->resetCommandStreamReceiver(testedCsr);
@@ -1317,9 +1306,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
@@ -1334,9 +1323,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
@@ -1351,9 +1340,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync());
@@ -1369,9 +1358,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(
*this->executionEnvironment,
1);
EXPECT_FALSE(testedCsr->useUserFenceWait);
EXPECT_TRUE(testedCsr->isUsedNotifyEnableForPostSync());
@@ -1387,9 +1376,9 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest,
mock->isVmBindAvailableCall.returnValue = true;
std::unique_ptr<TestedDrmCommandStreamReceiver<FamilyType>> testedCsr =
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(GemCloseWorkerMode::gemCloseWorkerInactive,
*this->executionEnvironment,
1);
std::make_unique<TestedDrmCommandStreamReceiver<FamilyType>>(
*this->executionEnvironment,
1);
EXPECT_TRUE(testedCsr->useUserFenceWait);
EXPECT_FALSE(testedCsr->isUsedNotifyEnableForPostSync());
@@ -1462,7 +1451,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContaine
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1);
mockCsr.setupContext(*osContext.get());
auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
EXPECT_GT(operationHandler->mergeWithResidencyContainerCalled, 0u);
@@ -1493,7 +1482,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenMergeWithResidencyContaine
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1);
mockCsr.setupContext(*osContext.get());
auto res = mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
EXPECT_GT(operationHandler->mergeWithResidencyContainerCalled, 0u);
@@ -1527,7 +1516,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenNoAllocsInMemoryOperationH
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1);
mockCsr.setupContext(*osContext.get());
mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());
@@ -1561,7 +1550,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamEnhancedTest, givenAllocsInMemoryOperationHan
EncodeNoop<FamilyType>::alignToCacheLine(cs);
BatchBuffer batchBuffer = BatchBufferHelper::createDefaultBatchBuffer(cs.getGraphicsAllocation(), &cs, cs.getUsed());
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr mockCsr(*executionEnvironment, rootDeviceIndex, 1);
mockCsr.setupContext(*osContext.get());
mockCsr.flush(batchBuffer, mockCsr.getResidencyAllocations());

View File

@@ -1039,7 +1039,7 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmCommandStreamReceiverWhenCreate
executionEnvironment.rootDeviceEnvironments[1]->initGmm();
executionEnvironment.rootDeviceEnvironments[1]->osInterface = std::make_unique<OSInterface>();
executionEnvironment.rootDeviceEnvironments[1]->osInterface->setDriverModel(DrmMockCustom::create(*executionEnvironment.rootDeviceEnvironments[0]));
auto csr = std::make_unique<MockDrmCsr<FamilyType>>(executionEnvironment, 1, 1, GemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<MockDrmCsr<FamilyType>>(executionEnvironment, 1, 1);
auto pageTableManager = csr->createPageTableManager();
EXPECT_EQ(csr->pageTableManager.get(), pageTableManager);
}
@@ -1049,11 +1049,11 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenLocalMemoryEnabledWhenCreatingDrmC
DebugManagerStateRestore restore;
debugManager.flags.EnableLocalMemory.set(1);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1);
EXPECT_EQ(DispatchMode::batchedDispatch, csr1.dispatchMode);
debugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::immediateDispatch));
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1);
EXPECT_EQ(DispatchMode::immediateDispatch, csr2.dispatchMode);
}
@@ -1061,11 +1061,11 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenLocalMemoryEnabledWhenCreatingDrmC
DebugManagerStateRestore restore;
debugManager.flags.EnableLocalMemory.set(0);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr1(executionEnvironment, 0, 1);
EXPECT_EQ(DispatchMode::immediateDispatch, csr1.dispatchMode);
debugManager.flags.CsrDispatchMode.set(static_cast<int32_t>(DispatchMode::batchedDispatch));
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1, GemCloseWorkerMode::gemCloseWorkerInactive);
MockDrmCsr<FamilyType> csr2(executionEnvironment, 0, 1);
EXPECT_EQ(DispatchMode::batchedDispatch, csr2.dispatchMode);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -360,8 +360,8 @@ class DrmCommandStreamForceTileTest : public ::testing::Test {
}
MockDrmCommandStreamReceiver(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex,
DeviceBitfield deviceBitfield,
GemCloseWorkerMode mode, uint32_t inputHandleId)
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield, mode), expectedHandleId(inputHandleId) {
uint32_t inputHandleId)
: DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, rootDeviceIndex, deviceBitfield), expectedHandleId(inputHandleId) {
}
SubmissionStatus processResidency(ResidencyContainer &allocationsForResidency, uint32_t handleId) override {
@@ -393,7 +393,6 @@ class DrmCommandStreamForceTileTest : public ::testing::Test {
csr = new MockDrmCommandStreamReceiver<GfxFamily>(executionEnvironment,
rootDeviceIndex,
3,
GemCloseWorkerMode::gemCloseWorkerActive,
expectedHandleId);
ASSERT_NE(nullptr, csr);
csr->setupContext(*osContext);
@@ -514,7 +513,7 @@ struct DrmImplicitScalingCommandStreamTest : ::testing::Test {
template <typename FamilyType>
std::unique_ptr<DrmCommandStreamReceiver<FamilyType>> createCsr() {
auto csr = std::make_unique<DrmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0, 0b11, GemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<DrmCommandStreamReceiver<FamilyType>>(*executionEnvironment, 0, 0b11);
csr->setupContext(*osContext);
return csr;
}
@@ -598,8 +597,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu
EngineDescriptorHelper::getDefaultDescriptor(gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment->rootDeviceEnvironments[0])[0],
PreemptionHelper::getDefaultPreemptionMode(*defaultHwInfo)));
osContext->ensureContextInitialized(false);
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
GemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield());
csr->setupContext(*osContext);
auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1);
@@ -641,8 +639,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, whenForceExecu
uint32_t execCalled = 0;
};
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
GemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield());
csr->setupContext(*osContext);
auto tileInstancedBo0 = new BufferObject(0u, drm, 3, 40, 0, 1);
@@ -689,8 +686,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenDisabledI
uint32_t execCalled = 0;
uint32_t processResidencyCalled = 0;
};
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
GemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield());
csr->setupContext(*osContext);
const auto size = 1024u;
@@ -723,8 +719,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmImplicitScalingCommandStreamTest, givenMultiTile
uint32_t execCalled = 0;
};
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield(),
GemCloseWorkerMode::gemCloseWorkerActive);
auto csr = std::make_unique<MockCsr>(*executionEnvironment, 0, osContext->getDeviceBitfield());
csr->setupContext(*osContext);
const auto size = 1024u;