mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
Allow to create HardwareContextController for multiple Devices
Change-Id: Ib066c937809536196182ca87359c487570cc2e89 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
46225890a9
commit
958d931cd9
@@ -191,7 +191,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH
|
||||
uint32_t engineIndex = 2;
|
||||
uint32_t deviceIndex = 3;
|
||||
|
||||
OsContext osContext(nullptr, 0, allEngineInstances[engineIndex], PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, allEngineInstances[engineIndex], PreemptionMode::Disabled);
|
||||
std::string fileName = "file_name.aub";
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
|
||||
@@ -211,7 +211,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) {
|
||||
OsContext osContext(nullptr, 0, lowPriorityGpgpuEngine, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled);
|
||||
std::string fileName = "file_name.aub";
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
|
||||
@@ -298,7 +298,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl
|
||||
executionEnvironment.aubCenter.reset(new AubCenter());
|
||||
|
||||
auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0];
|
||||
OsContext osContext(nullptr, 0, engineInstance, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled);
|
||||
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(**platformDevices, "", true, executionEnvironment);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(**platformDevices, "", true, executionEnvironment);
|
||||
@@ -688,7 +688,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
auto memoryManager = aubExecutionEnvironment->executionEnvironment->memoryManager.get();
|
||||
|
||||
auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
ResidencyContainer allocationsForResidency = {gfxDefaultAllocation};
|
||||
aubCsr->processResidency(allocationsForResidency);
|
||||
@@ -729,11 +728,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
|
||||
|
||||
ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation};
|
||||
@@ -754,12 +753,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
gfxBufferAllocation->setAubWritable(false);
|
||||
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
|
||||
gfxImageAllocation->setAubWritable(false);
|
||||
|
||||
@@ -783,12 +782,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER);
|
||||
gfxBufferAllocation->setAubWritable(false);
|
||||
|
||||
auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
;
|
||||
|
||||
gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE);
|
||||
gfxImageAllocation->setAubWritable(false);
|
||||
|
||||
@@ -804,6 +803,18 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
memoryManager->freeGraphicsMemory(gfxImageAllocation);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenAbort) {
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, "", CommandStreamReceiverType::CSR_AUB);
|
||||
mockAubCenter->aubManager = std::make_unique<MockAubManager>();
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
|
||||
uint32_t numSupportedDevices = 3;
|
||||
OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(*platformDevices[0], "", true, *pDevice->executionEnvironment);
|
||||
|
||||
EXPECT_THROW(aubCsr->setupContext(osContext), std::exception);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsntNonAubWritableThenWriteMemoryIsAllowed) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
@@ -1102,11 +1113,29 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
|
||||
|
||||
using HardwareContextContainerTests = ::testing::Test;
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenDeviceIndexWhenOsContextWithMultipleDevicesSupportedThenAbort) {
|
||||
MockAubManager aubManager;
|
||||
uint32_t numSupportedDevices = 2;
|
||||
uint32_t deviceIndex = 1;
|
||||
OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
|
||||
EXPECT_THROW(HardwareContextController(aubManager, osContext, deviceIndex, 0, 0), std::exception);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenOsContextWithoutMultipleDevicesSupportedWhenNoDeviceIndexPassedThenAbort) {
|
||||
MockAubManager aubManager;
|
||||
uint32_t numSupportedDevices = 1;
|
||||
OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
|
||||
EXPECT_THROW(HardwareContextController(aubManager, osContext, 0, 0), std::exception);
|
||||
}
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) {
|
||||
MockAubManager aubManager;
|
||||
HardwareContextController hwContextContainer(aubManager, 1, 2, 0);
|
||||
hwContextContainer.hardwareContexts.emplace_back(aubManager.createHardwareContext(2, 3));
|
||||
EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size());
|
||||
uint32_t numSupportedDevices = 2;
|
||||
OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, numSupportedDevices, 0);
|
||||
EXPECT_EQ(numSupportedDevices, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
auto mockHwContext1 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[1].get());
|
||||
@@ -1137,9 +1166,10 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa
|
||||
|
||||
TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) {
|
||||
MockAubManager aubManager;
|
||||
HardwareContextController hwContextContainer(aubManager, 1, 2, 0);
|
||||
hwContextContainer.hardwareContexts.emplace_back(aubManager.createHardwareContext(2, 3));
|
||||
EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size());
|
||||
uint32_t numSupportedDevices = 2;
|
||||
OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
HardwareContextController hwContextContainer(aubManager, osContext, 2, 0);
|
||||
EXPECT_EQ(numSupportedDevices, hwContextContainer.hardwareContexts.size());
|
||||
|
||||
auto mockHwContext0 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[0].get());
|
||||
auto mockHwContext1 = static_cast<MockHardwareContext *>(hwContextContainer.hardwareContexts[1].get());
|
||||
|
||||
@@ -709,7 +709,7 @@ HWTEST_F(AubCommandStreamReceiverTests, whenAubCommandStreamReceiverIsCreatedThe
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineIsInitializedThenDumpHandleIsGenerated) {
|
||||
executionEnvironment.aubCenter.reset(new AubCenter());
|
||||
auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0];
|
||||
OsContext osContext(nullptr, 0, engineInstance, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled);
|
||||
|
||||
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>(**platformDevices, "", true, executionEnvironment);
|
||||
EXPECT_NE(nullptr, aubCsr);
|
||||
@@ -896,7 +896,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
@@ -923,7 +923,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
@@ -951,7 +951,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
@@ -980,7 +980,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
@@ -1010,7 +1010,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
@@ -204,7 +204,7 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
aubCsr.stream = aubStream.get();
|
||||
@@ -224,7 +224,7 @@ HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCalling
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
aubCsr.stream = aubStream.get();
|
||||
@@ -307,7 +307,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
aubCsr.stream = aubStream.get();
|
||||
@@ -336,7 +336,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
aubCsr.stream = aubStream.get();
|
||||
@@ -360,7 +360,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
@@ -376,7 +376,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
@@ -392,7 +392,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
aubCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bo
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(
|
||||
getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo));
|
||||
getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1, PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo));
|
||||
csrWithAubDump->setupContext(*osContext);
|
||||
if (csrWithAubDump->aubCSR) {
|
||||
csrWithAubDump->aubCSR->setupContext(*osContext);
|
||||
@@ -132,7 +132,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump(*platformDevices[0], "aubfile", executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
OsContext osContext(nullptr, 0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
|
||||
csrWithAubDump.setupContext(osContext);
|
||||
EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext());
|
||||
|
||||
@@ -347,7 +347,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockTbxCsr<FamilyType> tbxCsr(**platformDevices, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
tbxCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
@@ -377,7 +377,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockTbxCsr<FamilyType> tbxCsr(**platformDevices, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
tbxCsr.setupContext(osContext);
|
||||
|
||||
auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
@@ -399,7 +399,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockTbxCsr<FamilyType> tbxCsr(**platformDevices, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
tbxCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
@@ -421,7 +421,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockTbxCsr<FamilyType> tbxCsr(**platformDevices, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
tbxCsr.setupContext(osContext);
|
||||
|
||||
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
|
||||
@@ -437,7 +437,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsC
|
||||
|
||||
pDevice->executionEnvironment->aubCenter.reset(mockAubCenter);
|
||||
MockTbxCsr<FamilyType> tbxCsr(**platformDevices, *pDevice->executionEnvironment);
|
||||
OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
tbxCsr.setupContext(osContext);
|
||||
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
|
||||
|
||||
@@ -461,7 +461,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt
|
||||
}
|
||||
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) {
|
||||
OsContext osContext(nullptr, 0, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled);
|
||||
OsContext osContext(nullptr, 0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled);
|
||||
std::string fileName = "";
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_TBX);
|
||||
|
||||
@@ -26,7 +26,7 @@ class MemoryAllocatorFixture : public MemoryManagementFixture {
|
||||
memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
csr = memoryManager->getDefaultCommandStreamReceiver(0);
|
||||
csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])));
|
||||
csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])));
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
|
||||
@@ -21,7 +21,7 @@ void MemoryManagerWithCsrFixture::SetUp() {
|
||||
csr->tagAddress = ¤tGpuTag;
|
||||
executionEnvironment.commandStreamReceivers.resize(1);
|
||||
executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr<CommandStreamReceiver>(csr));
|
||||
csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])));
|
||||
csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])));
|
||||
}
|
||||
|
||||
void MemoryManagerWithCsrFixture::TearDown() {
|
||||
|
||||
@@ -177,7 +177,7 @@ TEST_F(MemoryAllocatorTest, allocateSystemAligned) {
|
||||
TEST_F(MemoryAllocatorTest, allocateGraphics) {
|
||||
unsigned int alignment = 4096;
|
||||
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
ASSERT_NE(nullptr, allocation);
|
||||
@@ -1271,7 +1271,7 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche
|
||||
}
|
||||
|
||||
TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) {
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
auto tagAddress = csr->getTagAddress();
|
||||
@@ -1522,16 +1522,25 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation
|
||||
TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
EXPECT_EQ(1u, memoryManager.getOsContextCount());
|
||||
EXPECT_EQ(1, memoryManager.registeredOsContexts[0]->getRefInternalCount());
|
||||
}
|
||||
|
||||
TEST(ResidencyDataTest, givenNumberOfSupportedDevicesWhenCreatingOsContextThenSetValidValue) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
uint32_t numSupportedDevices = 3;
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0],
|
||||
numSupportedDevices, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
EXPECT_EQ(numSupportedDevices, memoryManager.registeredOsContexts[0]->getNumDevicesSupported());
|
||||
}
|
||||
|
||||
TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegistredFromHigherToLowerThenProperSizeIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
MockMemoryManager memoryManager(false, false, executionEnvironment);
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
EXPECT_EQ(2u, memoryManager.getOsContextCount());
|
||||
EXPECT_EQ(1, memoryManager.registeredOsContexts[0]->getRefInternalCount());
|
||||
EXPECT_EQ(1, memoryManager.registeredOsContexts[1]->getRefInternalCount());
|
||||
@@ -1544,8 +1553,8 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt
|
||||
|
||||
MockResidencyData residency;
|
||||
|
||||
OsContext osContext(nullptr, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
OsContext osContext2(nullptr, 1u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
OsContext osContext(nullptr, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
OsContext osContext2(nullptr, 1u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
|
||||
auto lastFenceValue = 45llu;
|
||||
auto lastFenceValue2 = 23llu;
|
||||
@@ -1603,3 +1612,8 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationWasNotUnlockedThenItIsUn
|
||||
memoryManager.freeGraphicsMemory(allocation);
|
||||
EXPECT_EQ(1u, memoryManager.unlockResourceCalled);
|
||||
}
|
||||
|
||||
TEST(OsContextTest, givenOsContextWithNumberOfSupportedDevicesWhenConstructingThenUsePassedValue) {
|
||||
OsContext osContext(nullptr, 5, 7, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled);
|
||||
EXPECT_EQ(7u, osContext.getNumDevicesSupported());
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves
|
||||
MockCsr<FamilyType> *csr = new MockCsr<FamilyType>(execStamp, executionEnvironment);
|
||||
executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr<CommandStreamReceiver>(csr));
|
||||
executionEnvironment.memoryManager.reset(csr->createMemoryManager(false, false));
|
||||
csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])));
|
||||
csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])));
|
||||
|
||||
Surface *surface = createSurface::Create<TypeParam>(this->data,
|
||||
&this->buffer,
|
||||
|
||||
@@ -168,7 +168,7 @@ std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation
|
||||
executionEnvironment->commandStreamReceivers[0][0]->initializeTagAllocation();
|
||||
}
|
||||
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setupContext(*osContext);
|
||||
|
||||
std::unique_ptr<AubExecutionEnvironment> aubExecutionEnvironment(new AubExecutionEnvironment);
|
||||
|
||||
@@ -101,7 +101,7 @@ std::unique_ptr<TbxExecutionEnvironment> getEnvironment(bool createTagAllocation
|
||||
executionEnvironment->commandStreamReceivers[0][0]->initializeTagAllocation();
|
||||
}
|
||||
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setupContext(*osContext);
|
||||
|
||||
std::unique_ptr<TbxExecutionEnvironment> tbxExecutionEnvironment(new TbxExecutionEnvironment);
|
||||
|
||||
@@ -41,7 +41,7 @@ class DrmCommandStreamFixture {
|
||||
executionEnvironment.osInterface = std::make_unique<OSInterface>();
|
||||
executionEnvironment.osInterface->get()->setDrm(mock.get());
|
||||
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
|
||||
csr = new DrmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*platformDevices[0], executionEnvironment,
|
||||
gemCloseWorkerMode::gemCloseWorkerActive);
|
||||
@@ -253,7 +253,7 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff
|
||||
.WillRepeatedly(::testing::Return(0))
|
||||
.RetiresOnSaturation();
|
||||
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 1,
|
||||
osContext = std::make_unique<OsContext>(executionEnvironment.osInterface.get(), 1, 1,
|
||||
HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
csr->setupContext(*osContext);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ TEST(OsContextTest, givenDrmWhenOsContextIsCreatedThenImplIsAvailable) {
|
||||
OSInterface osInterface;
|
||||
osInterface.get()->setDrm(&drmMock);
|
||||
|
||||
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
EXPECT_NE(nullptr, osContext->get());
|
||||
}
|
||||
} // namespace OCLRT
|
||||
|
||||
@@ -249,7 +249,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
|
||||
std::make_unique<MockWddmCsr<DEFAULT_TEST_FAMILY_NAME>>(hwInfo[0], *executionEnvironment));
|
||||
executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceivers[0][0]->createMemoryManager(false, false));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
|
||||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext);
|
||||
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
@@ -274,7 +274,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
|
||||
*executionEnvironment));
|
||||
executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceivers[0][0]->createMemoryManager(false, false));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
|
||||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
OsContext osContext(executionEnvironment->osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo));
|
||||
executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext);
|
||||
|
||||
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
@@ -325,7 +325,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza
|
||||
FailSignalSyncObjectMock::reset();
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
wddm->init(preemptionMode);
|
||||
OsContext osContext(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
OsContext osContext(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
|
||||
CL_GL_SYNC_INFO syncInfo = {};
|
||||
syncInfo.serverSynchronizationObject = 0x5cU;
|
||||
@@ -384,7 +384,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza
|
||||
FailSignalSyncObjectMock::reset();
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
wddm->init(preemptionMode);
|
||||
OsContext osContext(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
OsContext osContext(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
|
||||
CL_GL_SYNC_INFO syncInfo = {};
|
||||
syncInfo.submissionSynchronizationObject = 0x7cU;
|
||||
|
||||
@@ -29,7 +29,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextBeforeInitWddmThenOsContextIsNot
|
||||
auto wddm = new WddmMock;
|
||||
OSInterface osInterface;
|
||||
osInterface.get()->setWddm(wddm);
|
||||
EXPECT_THROW(auto osContext = std::make_unique<OsContext>(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])), std::exception);
|
||||
EXPECT_THROW(auto osContext = std::make_unique<OsContext>(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])), std::exception);
|
||||
}
|
||||
|
||||
TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedAndTrimCallbackIsRegistered) {
|
||||
@@ -39,7 +39,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
wddm->init(preemptionMode);
|
||||
EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called);
|
||||
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
auto osContext = std::make_unique<OsContext>(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
EXPECT_NE(nullptr, osContext->get());
|
||||
EXPECT_TRUE(osContext->get()->isInitialized());
|
||||
EXPECT_EQ(osContext->get()->getWddm(), wddm);
|
||||
@@ -48,6 +48,6 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit
|
||||
|
||||
TEST(OsContextTest, whenCreateOsContextWithoutOsInterfaceThenOsContextImplIsNotAvailable) {
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
auto osContext = std::make_unique<OsContext>(nullptr, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
auto osContext = std::make_unique<OsContext>(nullptr, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
EXPECT_EQ(nullptr, osContext->get());
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture, publi
|
||||
void init() {
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
EXPECT_TRUE(wddm->init(preemptionMode));
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContextWin = osContext->get();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ struct WddmFixture : public GmmEnvironmentFixture {
|
||||
wddm->gdi.reset(gdi);
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
wddm->init(preemptionMode);
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContextWin = osContext->get();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
}
|
||||
@@ -58,7 +58,7 @@ struct WddmFixtureWithMockGdiDll : public GmmEnvironmentFixture, public GdiDllFi
|
||||
void init() {
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
|
||||
EXPECT_TRUE(wddm->init(preemptionMode));
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContextWin = osContext->get();
|
||||
ASSERT_TRUE(wddm->isInitialized());
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ constexpr EngineInstanceT defaultRcsEngine{ENGINE_RCS, 0};
|
||||
|
||||
TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) {
|
||||
WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false};
|
||||
OsContext osContext(nullptr, 1u, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
OsContext osContext(nullptr, 1u, 1, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u);
|
||||
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u));
|
||||
EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u));
|
||||
@@ -1228,16 +1228,16 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithNoRegisteredOsContextsWh
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) {
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted());
|
||||
}
|
||||
|
||||
TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithExhaustedMemoryBudgetWhenCallingIsMemoryBudgetExhaustedThenReturnTrue) {
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->getRegisteredOsContext(1)->get()->getResidencyController().setMemoryBudgetExhausted();
|
||||
EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted());
|
||||
}
|
||||
@@ -1469,7 +1469,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen
|
||||
executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr<CommandStreamReceiver>(csr));
|
||||
|
||||
executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(false, false, wddm, executionEnvironment);
|
||||
csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(defaultRcsEngine, preemptionMode));
|
||||
csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, preemptionMode));
|
||||
EXPECT_EQ(csr, executionEnvironment.memoryManager->getDefaultCommandStreamReceiver(0));
|
||||
|
||||
auto tagAllocator = csr->getEventPerfCountAllocator();
|
||||
|
||||
@@ -55,7 +55,7 @@ class MockWddmMemoryManagerFixture : public GmmEnvironmentFixture {
|
||||
executionEnvironment.osInterface->get()->setWddm(wddm);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(wddm, executionEnvironment);
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
|
||||
osContext = memoryManager->getRegisteredOsContext(0);
|
||||
osContext->incRefInternal();
|
||||
@@ -91,7 +91,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public GmmEnvironmentFixture {
|
||||
memoryManager = new (std::nothrow) MockWddmMemoryManager(wddm, executionEnvironment);
|
||||
//assert we have memory manager
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode);
|
||||
|
||||
osContext = memoryManager->getRegisteredOsContext(0);
|
||||
osContext->incRefInternal();
|
||||
|
||||
@@ -36,7 +36,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
|
||||
regReader->forceRetValue = forceReturnPreemptionRegKeyValue;
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfoTest);
|
||||
wddm->init(preemptionMode);
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContext = std::make_unique<OsContext>(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
osContextWin = osContext->get();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(wddm, *executionEnvironment);
|
||||
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode);
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode);
|
||||
osContext = memoryManager->getRegisteredOsContext(0);
|
||||
osContext->incRefInternal();
|
||||
residencyController = &osContext->get()->getResidencyController();
|
||||
@@ -122,7 +122,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
|
||||
executionEnvironment->osInterface->get()->setWddm(wddm);
|
||||
|
||||
memoryManager = std::make_unique<MockWddmMemoryManager>(wddm, *executionEnvironment);
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]));
|
||||
|
||||
osContext = memoryManager->getRegisteredOsContext(0);
|
||||
osContext->incRefInternal();
|
||||
|
||||
Reference in New Issue
Block a user