Do not use direct submission in internal and low priority contexts

Change-Id: Ifac52dd36737151ea4d84bec95750e1716cafa9a
Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2020-03-03 23:33:31 +01:00
committed by sys_ocldev
parent 4181102ff1
commit ad4925aef9
51 changed files with 432 additions and 185 deletions

View File

@@ -161,7 +161,19 @@ bool WddmCommandStreamReceiver<GfxFamily>::initDirectSubmission(Device &device,
auto contextEngineType = osContext.getEngineType(); auto contextEngineType = osContext.getEngineType();
const DirectSubmissionProperties &directSubmissionProperty = const DirectSubmissionProperties &directSubmissionProperty =
device.getHardwareInfo().capabilityTable.directSubmissionEngines.data[contextEngineType]; device.getHardwareInfo().capabilityTable.directSubmissionEngines.data[contextEngineType];
if (directSubmissionProperty.engineSupported) {
bool startDirect = true;
if (osContext.isLowPriority()) {
startDirect = directSubmissionProperty.useLowPriority;
}
if (osContext.isInternalEngine()) {
startDirect = directSubmissionProperty.useInternal;
}
if (osContext.isRootDevice()) {
startDirect = directSubmissionProperty.useRootDevice;
}
if (directSubmissionProperty.engineSupported && startDirect) {
if (contextEngineType == ENGINE_TYPE_BCS) { if (contextEngineType == ENGINE_TYPE_BCS) {
directSubmission = std::make_unique<WddmDirectSubmission<GfxFamily>>(device, directSubmission = std::make_unique<WddmDirectSubmission<GfxFamily>>(device,
std::make_unique<BlitterDispatcher<GfxFamily>>(), std::make_unique<BlitterDispatcher<GfxFamily>>(),

View File

@@ -23,7 +23,8 @@ struct BlitAuxTranslationTests : public ::testing::Test {
class BcsMockContext : public MockContext { class BcsMockContext : public MockContext {
public: public:
BcsMockContext(ClDevice *device) : MockContext(device) { BcsMockContext(ClDevice *device) : MockContext(device) {
bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false));
bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex())); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex()));
bcsCsr->setupContext(*bcsOsContext); bcsCsr->setupContext(*bcsOsContext);
bcsCsr->initializeTagAllocation(); bcsCsr->initializeTagAllocation();
@@ -63,7 +64,8 @@ struct BlitAuxTranslationTests : public ::testing::Test {
if (createBcsEngine) { if (createBcsEngine) {
auto &engine = device->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true); auto &engine = device->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true);
bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false));
engine.osContext = bcsOsContext.get(); engine.osContext = bcsOsContext.get();
engine.commandStreamReceiver->setupContext(*bcsOsContext); engine.commandStreamReceiver->setupContext(*bcsOsContext);
} }

View File

@@ -235,7 +235,8 @@ HWTEST_F(CommandQueueWithSubDevicesTest, givenDeviceWithSubDevicesSupportingBlit
auto subDevice = device->getDeviceById(0); auto subDevice = device->getDeviceById(0);
if (createBcsEngine) { if (createBcsEngine) {
auto &engine = subDevice->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true); auto &engine = subDevice->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true);
bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false));
engine.osContext = bcsOsContext.get(); engine.osContext = bcsOsContext.get();
engine.commandStreamReceiver->setupContext(*bcsOsContext); engine.commandStreamReceiver->setupContext(*bcsOsContext);
} }

View File

@@ -173,7 +173,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithAubMana
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateHardwareContext) { HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateHardwareContext) {
uint32_t deviceIndex = 3; uint32_t deviceIndex = 3;
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false);
std::string fileName = "file_name.aub"; std::string fileName = "file_name.aub";
MockAubManager *mockManager = new MockAubManager(); MockAubManager *mockManager = new MockAubManager();
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
@@ -190,7 +190,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH
} }
HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) { HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) {
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false);
std::string fileName = "file_name.aub"; std::string fileName = "file_name.aub";
MockAubManager *mockManager = new MockAubManager(); MockAubManager *mockManager = new MockAubManager();
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
@@ -256,7 +256,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl
auto &hwInfo = pDevice->getHardwareInfo(); auto &hwInfo = pDevice->getHardwareInfo();
auto engineInstance = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; auto engineInstance = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0];
MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false, false, false);
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
@@ -823,7 +823,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
} }
HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenCreateMultipleHardwareContexts) { HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenCreateMultipleHardwareContexts) {
MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
aubCsr->setupContext(osContext); aubCsr->setupContext(osContext);
@@ -1175,7 +1175,8 @@ using HardwareContextContainerTests = ::testing::Test;
TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupportedThenInitialzeHwContextsWithValidIndexes) { TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupportedThenInitialzeHwContextsWithValidIndexes) {
MockAubManager aubManager; MockAubManager aubManager;
MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
HardwareContextController hwContextControler(aubManager, osContext, 0); HardwareContextController hwContextControler(aubManager, osContext, 0);
EXPECT_EQ(2u, hwContextControler.hardwareContexts.size()); EXPECT_EQ(2u, hwContextControler.hardwareContexts.size());
@@ -1188,7 +1189,8 @@ TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupported
TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCalledOnHwContextControllerThenSubmitIsCalled) { TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCalledOnHwContextControllerThenSubmitIsCalled) {
MockAubManager aubManager; MockAubManager aubManager;
MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
HardwareContextController hwContextContainer(aubManager, osContext, 0); HardwareContextController hwContextContainer(aubManager, osContext, 0);
EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size());
@@ -1206,7 +1208,8 @@ TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenSubmitMethodIsCall
TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalledThenWholeMemoryBanksArePassed) { TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalledThenWholeMemoryBanksArePassed) {
MockAubManager aubManager; MockAubManager aubManager;
MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(1, 0b1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
HardwareContextController hwContextContainer(aubManager, osContext, 0); HardwareContextController hwContextContainer(aubManager, osContext, 0);
EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size()); EXPECT_EQ(1u, hwContextContainer.hardwareContexts.size());
@@ -1220,7 +1223,8 @@ TEST_F(HardwareContextContainerTests, givenSingleHwContextWhenWriteMemoryIsCalle
TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) { TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) {
MockAubManager aubManager; MockAubManager aubManager;
MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
HardwareContextController hwContextContainer(aubManager, osContext, 0); HardwareContextController hwContextContainer(aubManager, osContext, 0);
EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size());
@@ -1260,7 +1264,8 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa
TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) { TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) {
MockAubManager aubManager; MockAubManager aubManager;
MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(1, 0b11, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
HardwareContextController hwContextContainer(aubManager, osContext, 0); HardwareContextController hwContextContainer(aubManager, osContext, 0);
EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size());

View File

@@ -460,7 +460,8 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled,
false, false, false);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *executionEnvironment, 0)); std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *executionEnvironment, 0));
aubCsr->setupContext(osContext); aubCsr->setupContext(osContext);
@@ -493,7 +494,9 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh
executionEnvironment->memoryManager.reset(memoryManager); executionEnvironment->memoryManager.reset(memoryManager);
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *executionEnvironment, 0)); std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *executionEnvironment, 0));
auto osContext = memoryManager->createAndRegisterOsContext(aubCsr.get(), getChosenEngineType(**platformDevices), 0, PreemptionMode::Disabled, false); auto osContext = memoryManager->createAndRegisterOsContext(aubCsr.get(), getChosenEngineType(**platformDevices), 0,
PreemptionMode::Disabled,
false, false, false);
aubCsr->setupContext(*osContext); aubCsr->setupContext(*osContext);
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
@@ -707,7 +710,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineI
MockExecutionEnvironment executionEnvironment(platformDevices[0]); MockExecutionEnvironment executionEnvironment(platformDevices[0]);
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engineInstance = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled,
false, false, false);
executionEnvironment.initializeMemoryManager(); executionEnvironment.initializeMemoryManager();
auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, executionEnvironment, 0); auto aubCsr = std::make_unique<MockAubCsrToTestDumpContext<FamilyType>>("", true, executionEnvironment, 0);
@@ -875,7 +879,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
DebugManager.flags.AUBDumpBufferFormat.set("BIN"); DebugManager.flags.AUBDumpBufferFormat.set("BIN");
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -897,7 +902,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenBcsEngineWhenDumpAllocationCalledTh
DebugManager.flags.AUBDumpBufferFormat.set("BIN"); DebugManager.flags.AUBDumpBufferFormat.set("BIN");
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -924,7 +930,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter); pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter);
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -945,7 +952,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
DebugManagerStateRestore dbgRestore; DebugManagerStateRestore dbgRestore;
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -968,7 +976,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu
DebugManager.flags.AUBDumpBufferFormat.set("BIN"); DebugManager.flags.AUBDumpBufferFormat.set("BIN");
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -992,7 +1001,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu
DebugManager.flags.AUBDumpBufferFormat.set("BIN"); DebugManager.flags.AUBDumpBufferFormat.set("BIN");
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -1017,7 +1027,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA
DebugManager.flags.AUBDumpBufferFormat.set("BIN"); DebugManager.flags.AUBDumpBufferFormat.set("BIN");
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -1041,7 +1052,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
DebugManager.flags.AUBDumpBufferFormat.set("BIN"); DebugManager.flags.AUBDumpBufferFormat.set("BIN");
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
aubCsr.latestSentTaskCount = 1; aubCsr.latestSentTaskCount = 1;

View File

@@ -299,7 +299,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenCallingAddAubComme
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenCallingAddAubCommentThenCallAddCommentOnAubManager) { HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithAubManagerWhenCallingAddAubCommentThenCallAddCommentOnAubManager) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockAubManager = static_cast<MockAubManager *>(aubCsr.aubManager); auto mockAubManager = static_cast<MockAubManager *>(aubCsr.aubManager);
ASSERT_NE(nullptr, mockAubManager); ASSERT_NE(nullptr, mockAubManager);
@@ -380,7 +381,8 @@ HWTEST_F(AubFileStreamTests, givenNoNewTaskSinceLastPollWhenDeletingAubCsrThenDo
HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenCallPollForCompletion) { HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenCallPollForCompletion) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -394,7 +396,8 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo
HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenDontCallPollForCompletion) { HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCallingPollForCompletionThenDontCallPollForCompletion) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -493,7 +496,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon); auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon);
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -520,7 +524,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWithHardwareContextInS
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon); auto aubSubCaptureManagerMock = new AubSubCaptureManagerMock("", aubSubCaptureCommon);
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto hardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -571,7 +576,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -595,7 +601,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) { HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -615,7 +622,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
@@ -627,7 +635,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());
@@ -639,7 +648,8 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI
HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqualIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(aubCsr.hardwareContextController->hardwareContexts[0].get());

View File

@@ -1635,7 +1635,8 @@ class MockCsrWithFailingFlush : public CommandStreamReceiverHw<GfxFamily> {
HWTEST_F(CommandStreamReceiverFlushTaskTests, givenWaitForCompletionWithTimeoutIsCalledWhenFlushBatchedSubmissionsReturnsFailureThenItIsPropagated) { HWTEST_F(CommandStreamReceiverFlushTaskTests, givenWaitForCompletionWithTimeoutIsCalledWhenFlushBatchedSubmissionsReturnsFailureThenItIsPropagated) {
MockCsrWithFailingFlush<FamilyType> mockCsr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); MockCsrWithFailingFlush<FamilyType> mockCsr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
MockOsContext osContext(0, 8, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 8, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
mockCsr.setupContext(osContext); mockCsr.setupContext(osContext);
mockCsr.latestSentTaskCount = 0; mockCsr.latestSentTaskCount = 0;
auto cmdBuffer = std::make_unique<CommandBuffer>(*pDevice); auto cmdBuffer = std::make_unique<CommandBuffer>(*pDevice);

View File

@@ -273,7 +273,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
mockCsr->requiredScratchSize = 0x200000; mockCsr->requiredScratchSize = 0x200000;
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false);
mockCsr->setupContext(osContext); mockCsr->setupContext(osContext);
mockCsr->programVFEState(commandStream, flags, 10); mockCsr->programVFEState(commandStream, flags, 10);
@@ -294,7 +295,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
mockCsr->requiredScratchSize = 0x200000; mockCsr->requiredScratchSize = 0x200000;
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false);
mockCsr->setupContext(osContext); mockCsr->setupContext(osContext);
mockCsr->programVFEState(commandStream, flags, 10); mockCsr->programVFEState(commandStream, flags, 10);
@@ -313,7 +315,8 @@ HWCMDTEST_F(IGFX_GEN8_CORE, CommandStreamReceiverFlushTaskGmockTests, givenPatch
DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags(); DispatchFlags flags = DispatchFlagsHelper::createDefaultDispatchFlags();
mockCsr->requiredScratchSize = 0x200000; mockCsr->requiredScratchSize = 0x200000;
MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 8, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false);
mockCsr->setupContext(osContext); mockCsr->setupContext(osContext);
mockCsr->programVFEState(commandStream, flags, 10); mockCsr->programVFEState(commandStream, flags, 10);

View File

@@ -312,7 +312,8 @@ struct BcsTests : public CommandStreamReceiverHwTest {
auto contextId = engine->osContext->getContextId(); auto contextId = engine->osContext->getContextId();
delete engine->osContext; delete engine->osContext;
engine->osContext = OsContext::create(nullptr, contextId, 0, aub_stream::EngineType::ENGINE_BCS, PreemptionMode::Disabled, false); engine->osContext = OsContext::create(nullptr, contextId, 0, aub_stream::EngineType::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false);
engine->osContext->incRefInternal(); engine->osContext->incRefInternal();
csr.setupContext(*engine->osContext); csr.setupContext(*engine->osContext);
@@ -637,7 +638,8 @@ HWTEST_F(BcsTests, givenInputAllocationsWhenBlitDispatchedThenMakeAllAllocations
HWTEST_F(BcsTests, givenFenceAllocationIsRequiredWhenBlitDispatchedThenMakeAllAllocationsResident) { HWTEST_F(BcsTests, givenFenceAllocationIsRequiredWhenBlitDispatchedThenMakeAllAllocationsResident) {
RAIIHwHelperFactory<MockHwHelperWithFenceAllocation<FamilyType>> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; RAIIHwHelperFactory<MockHwHelperWithFenceAllocation<FamilyType>> hwHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily};
auto bcsOsContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); auto bcsOsContext = std::unique_ptr<OsContext>(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false));
auto bcsCsr = std::make_unique<UltCommandStreamReceiver<FamilyType>>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex()); auto bcsCsr = std::make_unique<UltCommandStreamReceiver<FamilyType>>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex());
bcsCsr->setupContext(*bcsOsContext); bcsCsr->setupContext(*bcsOsContext);
bcsCsr->initializeTagAllocation(); bcsCsr->initializeTagAllocation();

View File

@@ -716,7 +716,9 @@ HWTEST_F(SimulatedCommandStreamReceiverTest, givenCsrWithOsContextWhenGetDeviceI
executionEnvironment.prepareRootDeviceEnvironments(1); executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager(); executionEnvironment.initializeMemoryManager();
MockSimulatedCsrHw<FamilyType> csr(executionEnvironment, 0); MockSimulatedCsrHw<FamilyType> csr(executionEnvironment, 0);
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b11, PreemptionMode::Disabled, false); auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS,
0b11, PreemptionMode::Disabled,
false, false, false);
csr.setupContext(*osContext); csr.setupContext(*osContext);
EXPECT_EQ(1u, csr.getDeviceIndex()); EXPECT_EQ(1u, csr.getDeviceIndex());
@@ -727,7 +729,9 @@ HWTEST_F(SimulatedCommandStreamReceiverTest, givenOsContextWithNoDeviceBitfieldW
executionEnvironment.prepareRootDeviceEnvironments(1); executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager(); executionEnvironment.initializeMemoryManager();
MockSimulatedCsrHw<FamilyType> csr(executionEnvironment, 0); MockSimulatedCsrHw<FamilyType> csr(executionEnvironment, 0);
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b00, PreemptionMode::Disabled, false); auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS,
0b00, PreemptionMode::Disabled,
false, false, false);
csr.setupContext(*osContext); csr.setupContext(*osContext);
EXPECT_EQ(0u, csr.getDeviceIndex()); EXPECT_EQ(0u, csr.getDeviceIndex());

View File

@@ -124,7 +124,8 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bo
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csrWithAubDump, auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csrWithAubDump,
getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1, getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1,
PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo), false); PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo),
false, false, false);
csrWithAubDump->setupContext(*osContext); csrWithAubDump->setupContext(*osContext);
} }
@@ -149,7 +150,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], MockOsContext osContext(0, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false);
csrWithAubDump.setupContext(osContext); csrWithAubDump.setupContext(osContext);
EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext()); EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext());

View File

@@ -372,7 +372,7 @@ HWTEST_F(TbxCommandStreamTests, givenDbgDeviceIdFlagIsSetWhenTbxCsrIsCreatedThen
HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingMakeSurfacePackNonResidentThenOnlyResidentAllocationsAddedAllocationsForDownload) { HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingMakeSurfacePackNonResidentThenOnlyResidentAllocationsAddedAllocationsForDownload) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
EXPECT_EQ(0u, tbxCsr.allocationsForDownload.size()); EXPECT_EQ(0u, tbxCsr.allocationsForDownload.size());
@@ -403,7 +403,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingWaitForTaskCountWithKm
}; };
MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()}; MockTbxCsr tbxCsr{*pDevice->executionEnvironment, pDevice->getRootDeviceIndex()};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
uint32_t tag = 0u; uint32_t tag = 0u;
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
tbxCsr.setTagAllocation(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{false, sizeof(tag)}, &tag)); tbxCsr.setTagAllocation(pDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties(MockAllocationProperties{false, sizeof(tag)}, &tag));
@@ -455,7 +455,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenItIsCreatedWith
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment); MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment);
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
@@ -482,7 +482,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl
DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::BatchedDispatch)); DebugManager.flags.CsrDispatchMode.set(static_cast<uint32_t>(DispatchMode::BatchedDispatch));
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment); MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment);
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
@@ -500,7 +500,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) { HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWithZeroSizedBufferThenSubmitIsNotCalledOnHwContext) {
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment); MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment);
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
@@ -518,7 +518,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment); MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment);
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000); MockGraphicsAllocation allocation(reinterpret_cast<void *>(0x1000), 0x1000);
@@ -530,7 +530,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenDownloadAllocationIsCalledThenItShouldCallTheExpectedHwContextFunctions) { HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenDownloadAllocationIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment); MockTbxCsr<FamilyType> tbxCsr(*pDevice->executionEnvironment);
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get()); auto mockHardwareContext = static_cast<MockHardwareContext *>(tbxCsr.hardwareContextController->hardwareContexts[0].get());
@@ -555,7 +555,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) {
auto hwInfo = pDevice->getHardwareInfo(); auto hwInfo = pDevice->getHardwareInfo();
MockOsContext osContext(0, 1, HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0], MockOsContext osContext(0, 1, HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0],
PreemptionMode::Disabled, false); PreemptionMode::Disabled, false, false, false);
std::string fileName = ""; std::string fileName = "";
MockAubManager *mockManager = new MockAubManager(); MockAubManager *mockManager = new MockAubManager();
MockAubCenter *mockAubCenter = new MockAubCenter(&hwInfo, false, fileName, CommandStreamReceiverType::CSR_TBX); MockAubCenter *mockAubCenter = new MockAubCenter(&hwInfo, false, fileName, CommandStreamReceiverType::CSR_TBX);
@@ -657,7 +657,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThe
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsDisabledThenPauseShouldBeTurnedOn) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsDisabledThenPauseShouldBeTurnedOn) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -680,7 +680,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenPauseShouldBeTurnedOff) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenPauseShouldBeTurnedOff) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -704,7 +704,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenCallPollForCompletionAndDisableSubCapture) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureIsEnabledThenCallPollForCompletionAndDisableSubCapture) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -728,7 +728,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureGetsActivatedThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureGetsActivatedThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -753,7 +753,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureRemainsActiveThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndSubCaptureRemainsActiveThenCallSubmitBatchBufferWithOverrideRingBufferSetToTrue) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -819,7 +819,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenProcessResidencyIsCalledWithoutDu
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureIsInactiveThenDontForceDumpingAllocationsTbxNonWritable) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureIsInactiveThenDontForceDumpingAllocationsTbxNonWritable) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -842,7 +842,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureGetsActivatedThenForceDumpingAllocationsTbxNonWritable) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureGetsActivatedThenForceDumpingAllocationsTbxNonWritable) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -867,7 +867,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureRemainsActivatedThenDontForceDumpingAllocationsTbxNonWritable) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledAndSubCaptureRemainsActivatedThenDontForceDumpingAllocationsTbxNonWritable) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
AubSubCaptureCommon aubSubCaptureCommon; AubSubCaptureCommon aubSubCaptureCommon;
@@ -892,7 +892,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenCheckAndActivateA
HWTEST_F(TbxCommandStreamTests, givenTbxCsrInNonSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledThenReturnStatusInactive) { HWTEST_F(TbxCommandStreamTests, givenTbxCsrInNonSubCaptureModeWhenCheckAndActivateAubSubCaptureIsCalledThenReturnStatusInactive) {
MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr{*pDevice->executionEnvironment};
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr.setupContext(osContext); tbxCsr.setupContext(osContext);
MultiDispatchInfo dispatchInfo; MultiDispatchInfo dispatchInfo;
@@ -913,11 +913,11 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenDispatchBlitEnqueueThenProcessCor
MockTbxCsr<FamilyType> tbxCsr1{*pDevice->executionEnvironment}; MockTbxCsr<FamilyType> tbxCsr1{*pDevice->executionEnvironment};
tbxCsr1.initializeTagAllocation(); tbxCsr1.initializeTagAllocation();
MockOsContext osContext0(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext0(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
tbxCsr0.setupContext(osContext0); tbxCsr0.setupContext(osContext0);
EngineControl engineControl0{&tbxCsr0, &osContext0}; EngineControl engineControl0{&tbxCsr0, &osContext0};
MockOsContext osContext1(1, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false); MockOsContext osContext1(1, 1, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false, false, false);
tbxCsr1.setupContext(osContext0); tbxCsr1.setupContext(osContext0);
EngineControl engineControl1{&tbxCsr1, &osContext1}; EngineControl engineControl1{&tbxCsr1, &osContext1};

View File

@@ -31,7 +31,9 @@ class MemoryAllocatorFixture : public MemoryManagementFixture {
csr = &device->getGpgpuCommandStreamReceiver(); csr = &device->getGpgpuCommandStreamReceiver();
auto &hwInfo = device->getHardwareInfo(); auto &hwInfo = device->getHardwareInfo();
auto engineType = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; auto engineType = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0];
auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
csr->setupContext(*osContext); csr->setupContext(*osContext);
} }

View File

@@ -25,7 +25,9 @@ void MemoryManagerWithCsrFixture::SetUp() {
csr->tagAddress = &currentGpuTag; csr->tagAddress = &currentGpuTag;
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
auto engine = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engine = HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), engine, 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), engine, 1,
PreemptionHelper::getDefaultPreemptionMode(*hwInfo),
false, false, false);
csr->setupContext(*osContext); csr->setupContext(*osContext);
} }

View File

@@ -23,8 +23,8 @@ using Gen12LPAubCommandStreamReceiverTests = Test<DeviceFixture>;
GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetGUCWorkQueueItemHeaderIsCalledThenAppropriateValueDependingOnEngineTypeIsReturned) { GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetGUCWorkQueueItemHeaderIsCalledThenAppropriateValueDependingOnEngineTypeIsReturned) {
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())); std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()));
MockOsContext rcsOsContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext rcsOsContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
MockOsContext ccsOsContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false); MockOsContext ccsOsContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false, false, false);
aubCsr->setupContext(ccsOsContext); aubCsr->setupContext(ccsOsContext);
uint32_t headerCCS = aubCsr->getGUCWorkQueueItemHeader(); uint32_t headerCCS = aubCsr->getGUCWorkQueueItemHeader();
@@ -45,7 +45,7 @@ GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenGraphicsAlloctionWhenGe
} }
GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenCCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) { GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenCCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) {
MockOsContext osContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_CCS, PreemptionMode::Disabled, false, false, false);
AUBCommandStreamReceiverHw<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); AUBCommandStreamReceiverHw<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);
@@ -58,7 +58,7 @@ GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenCCSEnabledWhenEngineMmi
} }
GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenRCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) { GEN12LPTEST_F(Gen12LPAubCommandStreamReceiverTests, givenRCSEnabledWhenEngineMmiosAreInitializedThenExpectL3ConfigMmioIsWritten) {
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
AUBCommandStreamReceiverHw<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex()); AUBCommandStreamReceiverHw<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
aubCsr.setupContext(osContext); aubCsr.setupContext(osContext);

View File

@@ -655,7 +655,8 @@ struct BcsBufferTests : public ::testing::Test {
class BcsMockContext : public MockContext { class BcsMockContext : public MockContext {
public: public:
BcsMockContext(ClDevice *device) : MockContext(device) { BcsMockContext(ClDevice *device) : MockContext(device) {
bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsOsContext.reset(OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false));
bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex())); bcsCsr.reset(createCommandStream(*device->getExecutionEnvironment(), device->getRootDeviceIndex()));
bcsCsr->setupContext(*bcsOsContext); bcsCsr->setupContext(*bcsOsContext);
bcsCsr->initializeTagAllocation(); bcsCsr->initializeTagAllocation();
@@ -717,7 +718,8 @@ struct BcsBufferTests : public ::testing::Test {
if (createBcsEngine) { if (createBcsEngine) {
auto &engine = device->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true); auto &engine = device->getEngine(HwHelperHw<FamilyType>::lowPriorityEngineType, true);
bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled, false)); bcsOsContext.reset(OsContext::create(nullptr, 1, 0, aub_stream::ENGINE_BCS, PreemptionMode::Disabled,
false, false, false));
engine.osContext = bcsOsContext.get(); engine.osContext = bcsOsContext.get();
engine.commandStreamReceiver->setupContext(*bcsOsContext); engine.commandStreamReceiver->setupContext(*bcsOsContext);
} }

View File

@@ -331,7 +331,10 @@ HWTEST_F(UsmDestructionTests, givenSharedUsmAllocationWhenBlockingFreeIsCalledTh
} }
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*mockDevice.executionEnvironment); auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*mockDevice.executionEnvironment);
auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, aub_stream::ENGINE_RCS, {}, PreemptionMode::Disabled, false); auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver,
aub_stream::ENGINE_RCS, {},
PreemptionMode::Disabled,
false, false, false);
mockDevice.engines[0].osContext = osContext; mockDevice.engines[0].osContext = osContext;
mockDevice.resetCommandStreamReceiver(mockCsr); mockDevice.resetCommandStreamReceiver(mockCsr);
@@ -367,7 +370,10 @@ HWTEST_F(UsmDestructionTests, givenUsmAllocationWhenBlockingFreeIsCalledThenWait
} }
auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*mockDevice.executionEnvironment); auto mockCsr = new ::testing::NiceMock<MyCsr<FamilyType>>(*mockDevice.executionEnvironment);
auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver, aub_stream::ENGINE_RCS, {}, PreemptionMode::Disabled, false); auto osContext = mockDevice.executionEnvironment->memoryManager->createAndRegisterOsContext(mockDevice.engines[0].commandStreamReceiver,
aub_stream::ENGINE_RCS, {},
PreemptionMode::Disabled,
false, false, false);
mockDevice.engines[0].osContext = osContext; mockDevice.engines[0].osContext = osContext;
mockDevice.resetCommandStreamReceiver(mockCsr); mockDevice.resetCommandStreamReceiver(mockCsr);

View File

@@ -867,7 +867,8 @@ HWTEST_F(HostPtrAllocationTest, givenOverlappingFragmentsWhenCheckIsCalledThenWa
uint32_t csr1GpuTag = taskCountNotReady; uint32_t csr1GpuTag = taskCountNotReady;
csr0->tagAddress = &csr0GpuTag; csr0->tagAddress = &csr0GpuTag;
csr1->tagAddress = &csr1GpuTag; csr1->tagAddress = &csr1GpuTag;
auto osContext = memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::EngineType::ENGINE_RCS, 0, PreemptionMode::Disabled, true); auto osContext = memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::EngineType::ENGINE_RCS, 0, PreemptionMode::Disabled,
true, false, false);
csr1->setupContext(*osContext); csr1->setupContext(*osContext);
void *cpuPtr = reinterpret_cast<void *>(0x100004); void *cpuPtr = reinterpret_cast<void *>(0x100004);

View File

@@ -200,7 +200,8 @@ TEST_F(MemoryAllocatorTest, allocateGraphics) {
memoryManager->createAndRegisterOsContext(csr, memoryManager->createAndRegisterOsContext(csr,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
ASSERT_NE(nullptr, allocation); ASSERT_NE(nullptr, allocation);
@@ -1410,7 +1411,8 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche
TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) { TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) {
memoryManager->createAndRegisterOsContext(csr.get(), memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
auto tagAddress = csr->getTagAddress(); auto tagAddress = csr->getTagAddress();
@@ -1661,7 +1663,8 @@ TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCo
std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(executionEnvironment, 0u)); std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(executionEnvironment, 0u));
memoryManager->createAndRegisterOsContext(csr.get(), memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
EXPECT_EQ(1u, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(1u, memoryManager->getRegisteredEnginesCount());
EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount()); EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount());
} }
@@ -1689,7 +1692,8 @@ TEST(ResidencyDataTest, givenDeviceBitfieldWhenCreatingOsContextThenSetValidValu
PreemptionMode preemptionMode = PreemptionMode::MidThread; PreemptionMode preemptionMode = PreemptionMode::MidThread;
memoryManager->createAndRegisterOsContext(csr.get(), memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
deviceBitfield, preemptionMode, false); deviceBitfield, preemptionMode,
false, false, false);
EXPECT_EQ(2u, memoryManager->registeredEngines[0].osContext->getNumSupportedDevices()); EXPECT_EQ(2u, memoryManager->registeredEngines[0].osContext->getNumSupportedDevices());
EXPECT_EQ(deviceBitfield, memoryManager->registeredEngines[0].osContext->getDeviceBitfield()); EXPECT_EQ(deviceBitfield, memoryManager->registeredEngines[0].osContext->getDeviceBitfield());
EXPECT_EQ(preemptionMode, memoryManager->registeredEngines[0].osContext->getPreemptionMode()); EXPECT_EQ(preemptionMode, memoryManager->registeredEngines[0].osContext->getPreemptionMode());
@@ -1703,10 +1707,12 @@ TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegisteredFromHigherToLower
std::unique_ptr<CommandStreamReceiver> csr1(createCommandStream(executionEnvironment, 1u)); std::unique_ptr<CommandStreamReceiver> csr1(createCommandStream(executionEnvironment, 1u));
memoryManager->createAndRegisterOsContext(csr.get(), memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
memoryManager->createAndRegisterOsContext(csr1.get(), memoryManager->createAndRegisterOsContext(csr1.get(),
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[1], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[1],
1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
EXPECT_EQ(2u, memoryManager->getRegisteredEnginesCount()); EXPECT_EQ(2u, memoryManager->getRegisteredEnginesCount());
EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount()); EXPECT_EQ(1, memoryManager->registeredEngines[0].osContext->getRefInternalCount());
EXPECT_EQ(1, memoryManager->registeredEngines[1].osContext->getRefInternalCount()); EXPECT_EQ(1, memoryManager->registeredEngines[1].osContext->getRefInternalCount());
@@ -1726,10 +1732,10 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt
MockOsContext osContext(0u, 1, MockOsContext osContext(0u, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
MockOsContext osContext2(1u, 1, MockOsContext osContext2(1u, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[1], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[1],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
auto lastFenceValue = 45llu; auto lastFenceValue = 45llu;
auto lastFenceValue2 = 23llu; auto lastFenceValue2 = 23llu;

View File

@@ -66,7 +66,9 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves
auto csr = std::make_unique<MockCsr<FamilyType>>(execStamp, *executionEnvironment, 0); auto csr = std::make_unique<MockCsr<FamilyType>>(execStamp, *executionEnvironment, 0);
auto hwInfo = *platformDevices[0]; auto hwInfo = *platformDevices[0];
auto engine = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0]; auto engine = HwHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo)[0];
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr.get(), engine, 1, PreemptionHelper::getDefaultPreemptionMode(hwInfo), false); auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(csr.get(), engine, 1,
PreemptionHelper::getDefaultPreemptionMode(hwInfo),
false, false, false);
csr->setupContext(*osContext); csr->setupContext(*osContext);
Surface *surface = createSurface::Create<TypeParam>(this->data, Surface *surface = createSurface::Create<TypeParam>(this->data,

View File

@@ -193,7 +193,8 @@ std::unique_ptr<AubExecutionEnvironment> getEnvironment(bool createTagAllocation
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(),
getChosenEngineType(*platformDevices[0]), 1, getChosenEngineType(*platformDevices[0]), 1,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
commandStreamReceiver->setupContext(*osContext); commandStreamReceiver->setupContext(*osContext);
std::unique_ptr<AubExecutionEnvironment> aubExecutionEnvironment(new AubExecutionEnvironment); std::unique_ptr<AubExecutionEnvironment> aubExecutionEnvironment(new AubExecutionEnvironment);

View File

@@ -12,7 +12,9 @@ namespace NEO {
class MockOsContext : public OsContext { class MockOsContext : public OsContext {
public: public:
MockOsContext(uint32_t contextId, DeviceBitfield deviceBitfield, MockOsContext(uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) aub_stream::EngineType engineType, PreemptionMode preemptionMode,
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority) {} bool lowPriority, bool internalEngine, bool rootDevice)
: OsContext(contextId, deviceBitfield, engineType, preemptionMode,
lowPriority, internalEngine, rootDevice) {}
}; };
} // namespace NEO } // namespace NEO

View File

@@ -37,7 +37,8 @@ class DrmCommandStreamTest : public ::testing::Test {
auto hwInfo = executionEnvironment.getHardwareInfo(); auto hwInfo = executionEnvironment.getHardwareInfo();
osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], osContext = std::make_unique<OsContextLinux>(*mock, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); PreemptionHelper::getDefaultPreemptionMode(*hwInfo),
false, false, false);
csr = new DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, 0, gemCloseWorkerMode::gemCloseWorkerActive); csr = new DrmCommandStreamReceiver<GfxFamily>(executionEnvironment, 0, gemCloseWorkerMode::gemCloseWorkerActive);
ASSERT_NE(nullptr, csr); ASSERT_NE(nullptr, csr);

View File

@@ -213,7 +213,8 @@ HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdT
osContext = std::make_unique<OsContextLinux>(*mock, 1, 1, osContext = std::make_unique<OsContextLinux>(*mock, 1, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
csr->setupContext(*osContext); csr->setupContext(*osContext);
auto &cs = csr->getCS(); auto &cs = csr->getCS();

View File

@@ -178,7 +178,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
{ {
drmMock.StoredCtxId = drmContextId1; drmMock.StoredCtxId = drmContextId1;
OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
EXPECT_EQ(1u, osContext1.getDrmContextIds().size()); EXPECT_EQ(1u, osContext1.getDrmContextIds().size());
EXPECT_EQ(drmContextId1, osContext1.getDrmContextIds()[0]); EXPECT_EQ(drmContextId1, osContext1.getDrmContextIds()[0]);
@@ -186,7 +186,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
{ {
drmMock.StoredCtxId = drmContextId2; drmMock.StoredCtxId = drmContextId2;
OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
EXPECT_EQ(1u, osContext2.getDrmContextIds().size()); EXPECT_EQ(1u, osContext2.getDrmContextIds().size());
EXPECT_EQ(drmContextId2, osContext2.getDrmContextIds()[0]); EXPECT_EQ(drmContextId2, osContext2.getDrmContextIds()[0]);
EXPECT_EQ(0u, drmMock.receivedDestroyContextId); EXPECT_EQ(0u, drmMock.receivedDestroyContextId);
@@ -209,14 +209,14 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI
drmMock.StoredRetValForPersistant = -1; drmMock.StoredRetValForPersistant = -1;
drmMock.checkNonPersistentContextsSupport(); drmMock.checkNonPersistentContextsSupport();
++expectedCount; ++expectedCount;
OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount); EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount);
} }
{ {
drmMock.StoredRetValForPersistant = 0; drmMock.StoredRetValForPersistant = 0;
drmMock.checkNonPersistentContextsSupport(); drmMock.checkNonPersistentContextsSupport();
++expectedCount; ++expectedCount;
OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContextLinux osContext(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
++expectedCount; ++expectedCount;
EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount); EXPECT_EQ(expectedCount, drmMock.receivedContextParamRequestCount);
} }
@@ -227,17 +227,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext
drmMock.StoredCtxId = 123; drmMock.StoredCtxId = 123;
drmMock.preemptionSupported = false; drmMock.preemptionSupported = false;
OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContextLinux osContext1(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true); OsContextLinux osContext2(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false);
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
drmMock.preemptionSupported = true; drmMock.preemptionSupported = true;
OsContextLinux osContext3(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContextLinux osContext3(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount);
OsContextLinux osContext4(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true); OsContextLinux osContext4(drmMock, 0u, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, false, false);
EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount);
EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id); EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id);
EXPECT_EQ(static_cast<uint64_t>(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param); EXPECT_EQ(static_cast<uint64_t>(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param);

View File

@@ -12,7 +12,18 @@
using namespace NEO; using namespace NEO;
TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) { TEST(OSContext, whenCreatingDefaultOsContextThenExpectInitializedAlways) {
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false, false, false);
EXPECT_TRUE(osContext->isInitialized()); EXPECT_TRUE(osContext->isInitialized());
EXPECT_FALSE(osContext->isLowPriority());
EXPECT_FALSE(osContext->isInternalEngine());
EXPECT_FALSE(osContext->isRootDevice());
delete osContext;
}
TEST(OSContext, givenLowPriorityRootDeviceInternalAreTrueWhenCreatingDefaultOsContextThenExpectGettersTrue) {
OsContext *osContext = OsContext::create(nullptr, 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, true, true, true);
EXPECT_TRUE(osContext->isLowPriority());
EXPECT_TRUE(osContext->isInternalEngine());
EXPECT_TRUE(osContext->isRootDevice());
delete osContext; delete osContext;
} }

View File

@@ -67,7 +67,8 @@ class WddmCommandStreamFixture {
executionEnvironment->memoryManager.reset(memoryManager); executionEnvironment->memoryManager.reset(memoryManager);
wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->getWddm()); wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->getWddm());
osContext.reset(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(), osContext.reset(OsContext::create(executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false)); 0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, false));
csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*executionEnvironment, 0); csr = new WddmCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME>(*executionEnvironment, 0);
device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u)); device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u));
@@ -249,7 +250,8 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment)); executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); PreemptionHelper::getDefaultPreemptionMode(*hwInfo),
false, false, false);
csr->setupContext(osContext); csr->setupContext(osContext);
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
@@ -274,7 +276,8 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn
executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment)); executionEnvironment->memoryManager.reset(new MemoryManagerCreate<WddmMemoryManager>(false, false, *executionEnvironment));
csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); csr->overrideDispatchPolicy(DispatchMode::ImmediateDispatch);
OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); PreemptionHelper::getDefaultPreemptionMode(*hwInfo),
false, false, false);
csr->setupContext(osContext); csr->setupContext(osContext);
auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
@@ -964,7 +967,8 @@ TEST_F(WddmCommandStreamTest, whenDirectSubmissionEnabledOnBcsThenExpectFeatureA
DebugManager.flags.EnableDirectSubmission.set(1); DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, false)); 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup,
false, false, false));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = true; hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = true;
@@ -978,7 +982,8 @@ TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupport
DebugManager.flags.EnableDirectSubmission.set(1); DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(), osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup, false)); 0, 0, aub_stream::ENGINE_BCS, PreemptionMode::ThreadGroup,
false, false, false));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo(); auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = false; hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_BCS].engineSupported = false;
@@ -987,3 +992,98 @@ TEST_F(WddmCommandStreamTest, givenDirectSubmissionEnabledWhenPlatformNotSupport
EXPECT_TRUE(ret); EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled()); EXPECT_FALSE(csr->isDirectSubmissionEnabled());
} }
TEST_F(WddmCommandStreamTest, givenLowPriorityContextWhenDirectSubmissionDisabledOnLowPriorityThenExpectFeatureNotAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
true, false, false));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useLowPriority = false;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenLowPriorityContextWhenDirectSubmissionEnabledOnLowPriorityThenExpectFeatureAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
true, false, false));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useLowPriority = true;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenInternalContextWhenDirectSubmissionDisabledOnInternalThenExpectFeatureNotAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, true, false));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useInternal = false;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenInternalContextWhenDirectSubmissionEnabledOnInternalThenExpectFeatureAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, true, false));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useInternal = true;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenRootDeviceContextWhenDirectSubmissionDisabledOnRootDeviceThenExpectFeatureNotAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, true));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useRootDevice = false;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_FALSE(csr->isDirectSubmissionEnabled());
}
TEST_F(WddmCommandStreamTest, givenRootDeviceContextWhenDirectSubmissionEnabledOnRootDeviceThenExpectFeatureAvailable) {
DebugManager.flags.EnableDirectSubmission.set(1);
osContext.reset(OsContext::create(device->getExecutionEnvironment()->rootDeviceEnvironments[0]->osInterface.get(),
0, 0, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, true));
auto hwInfo = device->getExecutionEnvironment()->getMutableHardwareInfo();
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].engineSupported = true;
hwInfo->capabilityTable.directSubmissionEngines.data[aub_stream::ENGINE_RCS].useRootDevice = true;
bool ret = csr->initDirectSubmission(*device.get(), *osContext.get());
EXPECT_TRUE(ret);
EXPECT_TRUE(csr->isDirectSubmissionEnabled());
}

View File

@@ -333,7 +333,8 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(); wddm->init();
OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
preemptionMode, false, false, false);
CL_GL_SYNC_INFO syncInfo = {}; CL_GL_SYNC_INFO syncInfo = {};
syncInfo.serverSynchronizationObject = 0x5cU; syncInfo.serverSynchronizationObject = 0x5cU;
@@ -393,7 +394,8 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(); wddm->init();
OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
preemptionMode, false, false, false);
CL_GL_SYNC_INFO syncInfo = {}; CL_GL_SYNC_INFO syncInfo = {};
syncInfo.submissionSynchronizationObject = 0x7cU; syncInfo.submissionSynchronizationObject = 0x7cU;

View File

@@ -26,28 +26,28 @@ struct OsContextWinTest : public WddmTestWithMockGdiDll {
}; };
TEST_F(OsContextWinTest, givenWddm20WhenCreatingOsContextThenOsContextIsInitialized) { TEST_F(OsContextWinTest, givenWddm20WhenCreatingOsContextThenOsContextIsInitialized) {
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false);
EXPECT_TRUE(osContext->isInitialized()); EXPECT_TRUE(osContext->isInitialized());
} }
TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmContextFailThenOsContextIsNotInitialized) { TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmContextFailThenOsContextIsNotInitialized) {
wddm->device = INVALID_HANDLE; wddm->device = INVALID_HANDLE;
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false);
EXPECT_FALSE(osContext->isInitialized()); EXPECT_FALSE(osContext->isInitialized());
} }
TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmMonitorFenceFailThenOsContextIsNotInitialized) { TEST_F(OsContextWinTest, givenWddm20WhenCreatingWddmMonitorFenceFailThenOsContextIsNotInitialized) {
*getCreateSynchronizationObject2FailCallFcn() = true; *getCreateSynchronizationObject2FailCallFcn() = true;
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false);
EXPECT_FALSE(osContext->isInitialized()); EXPECT_FALSE(osContext->isInitialized());
} }
TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackFailThenOsContextIsNotInitialized) { TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackFailThenOsContextIsNotInitialized) {
*getRegisterTrimNotificationFailCallFcn() = true; *getRegisterTrimNotificationFailCallFcn() = true;
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false);
EXPECT_FALSE(osContext->isInitialized()); EXPECT_FALSE(osContext->isInitialized());
} }
@@ -56,6 +56,6 @@ TEST_F(OsContextWinTest, givenWddm20WhenRegisterTrimCallbackIsDisabledThenOsCont
DebugManager.flags.DoNotRegisterTrimCallback.set(true); DebugManager.flags.DoNotRegisterTrimCallback.set(true);
*getRegisterTrimNotificationFailCallFcn() = true; *getRegisterTrimNotificationFailCallFcn() = true;
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engineType, preemptionMode, false, false, false);
EXPECT_TRUE(osContext->isInitialized()); EXPECT_TRUE(osContext->isInitialized());
} }

View File

@@ -33,7 +33,9 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]);
wddm->init(); wddm->init();
EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called); EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called);
auto osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); auto osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
preemptionMode, false, false, false);
EXPECT_TRUE(osContext->isInitialized()); EXPECT_TRUE(osContext->isInitialized());
EXPECT_EQ(osContext->getWddm(), wddm); EXPECT_EQ(osContext->getWddm(), wddm);
EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called); EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called);

View File

@@ -42,7 +42,9 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture {
wddmMockInterface = static_cast<WddmMockInterface23 *>(wddm->wddmInterface.release()); wddmMockInterface = static_cast<WddmMockInterface23 *>(wddm->wddmInterface.release());
wddm->init(); wddm->init();
wddm->wddmInterface.reset(wddmMockInterface); wddm->wddmInterface.reset(wddmMockInterface);
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0], preemptionMode, false); osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1,
HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0],
preemptionMode, false, false, false);
} }
void TearDown() override { void TearDown() override {
@@ -75,8 +77,10 @@ TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) {
TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) { TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) {
auto defaultEngine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0]; auto defaultEngine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*platformDevices[0])[0];
OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled, false); OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled,
OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch, false); false, false, false);
OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch,
false, false, false);
wddm->wddmInterface->createHwQueue(osContextWithoutPreemption); wddm->wddmInterface->createHwQueue(osContextWithoutPreemption);
EXPECT_EQ(0u, getCreateHwQueueDataFcn()->Flags.DisableGpuTimeout); EXPECT_EQ(0u, getCreateHwQueueDataFcn()->Flags.DisableGpuTimeout);

View File

@@ -43,7 +43,8 @@ struct WddmFixture : ::testing::Test {
wddm->init(); wddm->init();
auto hwInfo = rootDeviceEnvironemnt->getHardwareInfo(); auto hwInfo = rootDeviceEnvironemnt->getHardwareInfo();
auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1u, engine, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1u, engine, preemptionMode,
false, false, false);
mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(wddm->temporaryResources.get()); mockTemporaryResources = static_cast<MockWddmResidentAllocationsContainer *>(wddm->temporaryResources.get());
} }
@@ -79,7 +80,8 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engine, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*osInterface->get()->getWddm(), 0u, 1, engine, preemptionMode,
false, false, false);
} }
void TearDown() override { void TearDown() override {

View File

@@ -75,7 +75,9 @@ TEST(WddmMemoryManager, NonAssignable) {
TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) {
MockWddmAllocation allocation; MockWddmAllocation allocation;
MockOsContext osContext(1u, 1, aub_stream::ENGINE_RCS, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); MockOsContext osContext(1u, 1, aub_stream::ENGINE_RCS,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]),
false, false, false);
allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u);
EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u));
EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u));
@@ -354,7 +356,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1], memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1],
2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); 2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false);
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER})); auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER}));
@@ -384,7 +386,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEngine
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1], memoryManager->createAndRegisterOsContext(csr.get(), HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[1],
2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); 2, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false);
ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount());
auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER})); auto allocation = static_cast<WddmAllocation *>(memoryManager->allocateGraphicsMemoryWithProperties({0, 32, GraphicsAllocation::AllocationType::BUFFER}));
@@ -1446,9 +1448,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenC
std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(*executionEnvironment, 0u)); std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(*executionEnvironment, 0u));
std::unique_ptr<CommandStreamReceiver> csr1(createCommandStream(*executionEnvironment, 1u)); std::unique_ptr<CommandStreamReceiver> csr1(createCommandStream(*executionEnvironment, 1u));
std::unique_ptr<CommandStreamReceiver> csr2(createCommandStream(*executionEnvironment, 2u)); std::unique_ptr<CommandStreamReceiver> csr2(createCommandStream(*executionEnvironment, 2u));
memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1,
memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted());
} }
@@ -1465,9 +1470,12 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithE
std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(*executionEnvironment, 0u)); std::unique_ptr<CommandStreamReceiver> csr(createCommandStream(*executionEnvironment, 0u));
std::unique_ptr<CommandStreamReceiver> csr1(createCommandStream(*executionEnvironment, 1u)); std::unique_ptr<CommandStreamReceiver> csr1(createCommandStream(*executionEnvironment, 1u));
std::unique_ptr<CommandStreamReceiver> csr2(createCommandStream(*executionEnvironment, 2u)); std::unique_ptr<CommandStreamReceiver> csr2(createCommandStream(*executionEnvironment, 2u));
memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1,
memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); memoryManager->createAndRegisterOsContext(csr1.get(), aub_stream::ENGINE_RCS, 2,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
memoryManager->createAndRegisterOsContext(csr2.get(), aub_stream::ENGINE_RCS, 3,
PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false, false, false);
auto osContext = static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[1].osContext); auto osContext = static_cast<OsContextWin *>(memoryManager->getRegisteredEngines()[1].osContext);
osContext->getResidencyController().setMemoryBudgetExhausted(); osContext->getResidencyController().setMemoryBudgetExhausted();
EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted()); EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted());
@@ -1715,7 +1723,8 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen
executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setWddm(wddm); executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setWddm(wddm);
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm); executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(executionEnvironment); executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(executionEnvironment);
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, preemptionMode, false); auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, preemptionMode,
false, false, false);
csr->setupContext(*osContext); csr->setupContext(*osContext);
auto tagAllocator = csr->getEventPerfCountAllocator(100); auto tagAllocator = csr->getEventPerfCountAllocator(100);

View File

@@ -67,7 +67,7 @@ class MockWddmMemoryManagerFixture {
auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
osContext = memoryManager->createAndRegisterOsContext(csr.get(), osContext = memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false, false, false);
osContext->incRefInternal(); osContext->incRefInternal();
mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(wddm->getTemporaryResourcesContainer()); mockTemporaryResources = reinterpret_cast<MockWddmResidentAllocationsContainer *>(wddm->getTemporaryResourcesContainer());
@@ -120,7 +120,8 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture
csr.reset(createCommandStream(*executionEnvironment, 0u)); csr.reset(createCommandStream(*executionEnvironment, 0u));
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
osContext = memoryManager->createAndRegisterOsContext(csr.get(), osContext = memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode, false); HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
1, preemptionMode, false, false, false);
osContext->incRefInternal(); osContext->incRefInternal();

View File

@@ -56,8 +56,10 @@ class MockWddmResidencyController : public WddmResidencyController {
class MockOsContextWin : public OsContextWin { class MockOsContextWin : public OsContextWin {
public: public:
MockOsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, MockOsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) aub_stream::EngineType engineType, PreemptionMode preemptionMode,
: OsContextWin(wddm, contextId, deviceBitfield, engineType, preemptionMode, lowPriority), bool lowPriority, bool internalEngine, bool rootDevice)
: OsContextWin(wddm, contextId, deviceBitfield, engineType, preemptionMode,
lowPriority, internalEngine, rootDevice),
mockResidencyController(wddm, contextId) {} mockResidencyController(wddm, contextId) {}
WddmResidencyController &getResidencyController() override { return mockResidencyController; }; WddmResidencyController &getResidencyController() override { return mockResidencyController; };
@@ -73,7 +75,8 @@ struct WddmResidencyControllerTest : ::testing::Test {
rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment); rootDeviceEnvironment = std::make_unique<RootDeviceEnvironment>(*executionEnvironment);
wddm = std::unique_ptr<WddmMock>(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment))); wddm = std::unique_ptr<WddmMock>(static_cast<WddmMock *>(Wddm::createWddm(nullptr, *rootDeviceEnvironment)));
wddm->init(); wddm->init();
mockOsContextWin = std::make_unique<MockOsContextWin>(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); mockOsContextWin = std::make_unique<MockOsContextWin>(*wddm, osContextId, 0, aub_stream::ENGINE_RCS,
PreemptionMode::Disabled, false, false, false);
wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin); wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin);
residencyController = &mockOsContextWin->mockResidencyController; residencyController = &mockOsContextWin->mockResidencyController;
} }
@@ -96,7 +99,8 @@ struct WddmResidencyControllerWithGdiTest : ::testing::Test {
wddm->resetGdi(gdi); wddm->resetGdi(gdi);
wddm->init(); wddm->init();
mockOsContextWin = std::make_unique<MockOsContextWin>(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false); mockOsContextWin = std::make_unique<MockOsContextWin>(*wddm, osContextId, 0, aub_stream::ENGINE_RCS, PreemptionMode::Disabled,
false, false, false);
wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin); wddm->getWddmInterface()->createMonitoredFence(*mockOsContextWin);
residencyController = &mockOsContextWin->mockResidencyController; residencyController = &mockOsContextWin->mockResidencyController;
residencyController->registerCallback(); residencyController->registerCallback();
@@ -129,7 +133,8 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
csr.reset(createCommandStream(*executionEnvironment, 0u)); csr.reset(createCommandStream(*executionEnvironment, 0u));
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
osContext = memoryManager->createAndRegisterOsContext(csr.get(), osContext = memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode, false); HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], 1, preemptionMode,
false, false, false);
osContext->incRefInternal(); osContext->incRefInternal();
residencyController = &static_cast<OsContextWin *>(osContext)->getResidencyController(); residencyController = &static_cast<OsContextWin *>(osContext)->getResidencyController();
@@ -167,7 +172,8 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
osContext = memoryManager->createAndRegisterOsContext(csr.get(), osContext = memoryManager->createAndRegisterOsContext(csr.get(),
HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0], HwHelper::get(hwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0],
1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); 1, PreemptionHelper::getDefaultPreemptionMode(*hwInfo),
false, false, false);
osContext->incRefInternal(); osContext->incRefInternal();

View File

@@ -124,7 +124,8 @@ bool Device::createEngine(uint32_t deviceCsrIndex, aub_stream::EngineType engine
bool lowPriority = (deviceCsrIndex == HwHelper::lowPriorityGpgpuEngineIndex); bool lowPriority = (deviceCsrIndex == HwHelper::lowPriorityGpgpuEngineIndex);
auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), engineType, auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver.get(), engineType,
getDeviceBitfield(), preemptionMode, lowPriority); getDeviceBitfield(), preemptionMode,
lowPriority, internalUsage, false);
commandStreamReceiver->setupContext(*osContext); commandStreamReceiver->setupContext(*osContext);
if (!commandStreamReceiver->initializeTagAllocation()) { if (!commandStreamReceiver->initializeTagAllocation()) {

View File

@@ -98,7 +98,7 @@ void RootDevice::initializeRootCommandStreamReceiver() {
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo);
auto osContext = getMemoryManager()->createAndRegisterOsContext(rootCommandStreamReceiver.get(), defaultEngineType, auto osContext = getMemoryManager()->createAndRegisterOsContext(rootCommandStreamReceiver.get(), defaultEngineType,
getDeviceBitfield(), preemptionMode, false); getDeviceBitfield(), preemptionMode, false, false, true);
rootCommandStreamReceiver->setupContext(*osContext); rootCommandStreamReceiver->setupContext(*osContext);
rootCommandStreamReceiver->initializeTagAllocation(); rootCommandStreamReceiver->initializeTagAllocation();

View File

@@ -89,7 +89,7 @@ bool DirectSubmissionHw<GfxFamily>::allocateResources() {
} }
template <typename GfxFamily> template <typename GfxFamily>
void DirectSubmissionHw<GfxFamily>::cpuCachelineFlush(void *ptr, size_t size) { inline void DirectSubmissionHw<GfxFamily>::cpuCachelineFlush(void *ptr, size_t size) {
if (disableCpuCacheFlush) { if (disableCpuCacheFlush) {
return; return;
} }
@@ -156,7 +156,7 @@ bool DirectSubmissionHw<GfxFamily>::stopRingBuffer() {
} }
template <typename GfxFamily> template <typename GfxFamily>
void *DirectSubmissionHw<GfxFamily>::dispatchSemaphoreSection(uint32_t value) { inline void *DirectSubmissionHw<GfxFamily>::dispatchSemaphoreSection(uint32_t value) {
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT; using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION; using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
@@ -172,13 +172,13 @@ void *DirectSubmissionHw<GfxFamily>::dispatchSemaphoreSection(uint32_t value) {
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeSemaphoreSection() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeSemaphoreSection() {
size_t semaphoreSize = EncodeSempahore<GfxFamily>::getSizeMiSemaphoreWait(); size_t semaphoreSize = EncodeSempahore<GfxFamily>::getSizeMiSemaphoreWait();
return (semaphoreSize + prefetchSize); return (semaphoreSize + prefetchSize);
} }
template <typename GfxFamily> template <typename GfxFamily>
void DirectSubmissionHw<GfxFamily>::dispatchStartSection(uint64_t gpuStartAddress) { inline void DirectSubmissionHw<GfxFamily>::dispatchStartSection(uint64_t gpuStartAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
auto bbufferStart = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_START>(); auto bbufferStart = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
*bbufferStart = GfxFamily::cmdInitBatchBufferStart; *bbufferStart = GfxFamily::cmdInitBatchBufferStart;
@@ -188,14 +188,14 @@ void DirectSubmissionHw<GfxFamily>::dispatchStartSection(uint64_t gpuStartAddres
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeStartSection() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeStartSection() {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
size_t size = sizeof(MI_BATCH_BUFFER_START); size_t size = sizeof(MI_BATCH_BUFFER_START);
return size; return size;
} }
template <typename GfxFamily> template <typename GfxFamily>
void DirectSubmissionHw<GfxFamily>::dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress) { inline void DirectSubmissionHw<GfxFamily>::dispatchSwitchRingBufferSection(uint64_t nextBufferGpuAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
auto bbufferStart = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_START>(); auto bbufferStart = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_START>();
@@ -206,38 +206,38 @@ void DirectSubmissionHw<GfxFamily>::dispatchSwitchRingBufferSection(uint64_t nex
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeSwitchRingBufferSection() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeSwitchRingBufferSection() {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
return sizeof(MI_BATCH_BUFFER_START); return sizeof(MI_BATCH_BUFFER_START);
} }
template <typename GfxFamily> template <typename GfxFamily>
void *DirectSubmissionHw<GfxFamily>::dispatchFlushSection() { inline void *DirectSubmissionHw<GfxFamily>::dispatchFlushSection() {
void *currentPosition = ringCommandStream.getSpace(0); void *currentPosition = ringCommandStream.getSpace(0);
cmdDispatcher->dispatchCacheFlush(ringCommandStream, *hwInfo); cmdDispatcher->dispatchCacheFlush(ringCommandStream, *hwInfo);
return currentPosition; return currentPosition;
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeFlushSection() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeFlushSection() {
return cmdDispatcher->getSizeCacheFlush(*hwInfo); return cmdDispatcher->getSizeCacheFlush(*hwInfo);
} }
template <typename GfxFamily> template <typename GfxFamily>
void *DirectSubmissionHw<GfxFamily>::dispatchTagUpdateSection(uint64_t address, uint64_t value) { inline void *DirectSubmissionHw<GfxFamily>::dispatchTagUpdateSection(uint64_t address, uint64_t value) {
void *currentPosition = ringCommandStream.getSpace(0); void *currentPosition = ringCommandStream.getSpace(0);
cmdDispatcher->dispatchMonitorFence(ringCommandStream, address, value, *hwInfo); cmdDispatcher->dispatchMonitorFence(ringCommandStream, address, value, *hwInfo);
return currentPosition; return currentPosition;
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeTagUpdateSection() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeTagUpdateSection() {
size_t size = cmdDispatcher->getSizeMonitorFence(*hwInfo); size_t size = cmdDispatcher->getSizeMonitorFence(*hwInfo);
return size; return size;
} }
template <typename GfxFamily> template <typename GfxFamily>
void DirectSubmissionHw<GfxFamily>::dispatchEndingSection() { inline void DirectSubmissionHw<GfxFamily>::dispatchEndingSection() {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END; using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
auto bbufferEnd = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_END>(); auto bbufferEnd = ringCommandStream.getSpaceForCmd<MI_BATCH_BUFFER_END>();
@@ -245,13 +245,13 @@ void DirectSubmissionHw<GfxFamily>::dispatchEndingSection() {
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeEndingSection() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeEndingSection() {
using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END; using MI_BATCH_BUFFER_END = typename GfxFamily::MI_BATCH_BUFFER_END;
return sizeof(MI_BATCH_BUFFER_END); return sizeof(MI_BATCH_BUFFER_END);
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeDispatch() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeDispatch() {
return getSizeStartSection() + return getSizeStartSection() +
getSizeFlushSection() + getSizeFlushSection() +
getSizeTagUpdateSection() + getSizeTagUpdateSection() +
@@ -259,13 +259,13 @@ size_t DirectSubmissionHw<GfxFamily>::getSizeDispatch() {
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t DirectSubmissionHw<GfxFamily>::getSizeEnd() { inline size_t DirectSubmissionHw<GfxFamily>::getSizeEnd() {
return getSizeEndingSection() + return getSizeEndingSection() +
getSizeFlushSection(); getSizeFlushSection();
} }
template <typename GfxFamily> template <typename GfxFamily>
uint64_t DirectSubmissionHw<GfxFamily>::getCommandBufferPositionGpuAddress(void *position) { inline uint64_t DirectSubmissionHw<GfxFamily>::getCommandBufferPositionGpuAddress(void *position) {
void *currentBase = ringCommandStream.getCpuBase(); void *currentBase = ringCommandStream.getCpuBase();
size_t offset = ptrDiff(position, currentBase); size_t offset = ptrDiff(position, currentBase);
@@ -325,7 +325,7 @@ bool DirectSubmissionHw<GfxFamily>::dispatchCommandBuffer(BatchBuffer &batchBuff
} }
template <typename GfxFamily> template <typename GfxFamily>
void DirectSubmissionHw<GfxFamily>::setReturnAddress(void *returnCmd, uint64_t returnAddress) { inline void DirectSubmissionHw<GfxFamily>::setReturnAddress(void *returnCmd, uint64_t returnAddress) {
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START; using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
MI_BATCH_BUFFER_START *returnBBStart = static_cast<MI_BATCH_BUFFER_START *>(returnCmd); MI_BATCH_BUFFER_START *returnBBStart = static_cast<MI_BATCH_BUFFER_START *>(returnCmd);
@@ -333,7 +333,7 @@ void DirectSubmissionHw<GfxFamily>::setReturnAddress(void *returnCmd, uint64_t r
} }
template <typename GfxFamily> template <typename GfxFamily>
GraphicsAllocation *DirectSubmissionHw<GfxFamily>::switchRingBuffersAllocations() { inline GraphicsAllocation *DirectSubmissionHw<GfxFamily>::switchRingBuffersAllocations() {
GraphicsAllocation *nextAllocation = nullptr; GraphicsAllocation *nextAllocation = nullptr;
if (currentRingBuffer == RingBufferUse::FirstBuffer) { if (currentRingBuffer == RingBufferUse::FirstBuffer) {
nextAllocation = ringBuffer2; nextAllocation = ringBuffer2;

View File

@@ -15,6 +15,9 @@ namespace NEO {
struct DirectSubmissionProperties { struct DirectSubmissionProperties {
bool engineSupported = false; bool engineSupported = false;
bool submitOnInit = false; bool submitOnInit = false;
bool useInternal = false;
bool useLowPriority = false;
bool useRootDevice = false;
}; };
using EngineDirectSubmissionInitVec = std::vector<std::pair<aub_stream::EngineType, DirectSubmissionProperties>>; using EngineDirectSubmissionInitVec = std::vector<std::pair<aub_stream::EngineType, DirectSubmissionProperties>>;

View File

@@ -13,21 +13,21 @@
namespace NEO { namespace NEO {
template <typename GfxFamily> template <typename GfxFamily>
void RenderDispatcher<GfxFamily>::dispatchPreemption(LinearStream &cmdBuffer) { inline void RenderDispatcher<GfxFamily>::dispatchPreemption(LinearStream &cmdBuffer) {
PreemptionHelper::programCmdStream<GfxFamily>(cmdBuffer, PreemptionMode::MidBatch, PreemptionMode::Disabled, nullptr); PreemptionHelper::programCmdStream<GfxFamily>(cmdBuffer, PreemptionMode::MidBatch, PreemptionMode::Disabled, nullptr);
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t RenderDispatcher<GfxFamily>::getSizePreemption() { inline size_t RenderDispatcher<GfxFamily>::getSizePreemption() {
size_t size = PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode::MidBatch, PreemptionMode::Disabled); size_t size = PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode::MidBatch, PreemptionMode::Disabled);
return size; return size;
} }
template <typename GfxFamily> template <typename GfxFamily>
void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdBuffer, inline void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdBuffer,
uint64_t gpuAddress, uint64_t gpuAddress,
uint64_t immediateData, uint64_t immediateData,
const HardwareInfo &hwInfo) { const HardwareInfo &hwInfo) {
using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION; using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION;
MemorySynchronizationCommands<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation( MemorySynchronizationCommands<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(
cmdBuffer, cmdBuffer,
@@ -39,18 +39,18 @@ void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdBuffer,
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t RenderDispatcher<GfxFamily>::getSizeMonitorFence(const HardwareInfo &hwInfo) { inline size_t RenderDispatcher<GfxFamily>::getSizeMonitorFence(const HardwareInfo &hwInfo) {
size_t size = MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo); size_t size = MemorySynchronizationCommands<GfxFamily>::getSizeForPipeControlWithPostSyncOperation(hwInfo);
return size; return size;
} }
template <typename GfxFamily> template <typename GfxFamily>
void RenderDispatcher<GfxFamily>::dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) { inline void RenderDispatcher<GfxFamily>::dispatchCacheFlush(LinearStream &cmdBuffer, const HardwareInfo &hwInfo) {
MemorySynchronizationCommands<GfxFamily>::addFullCacheFlush(cmdBuffer); MemorySynchronizationCommands<GfxFamily>::addFullCacheFlush(cmdBuffer);
} }
template <typename GfxFamily> template <typename GfxFamily>
size_t RenderDispatcher<GfxFamily>::getSizeCacheFlush(const HardwareInfo &hwInfo) { inline size_t RenderDispatcher<GfxFamily>::getSizeCacheFlush(const HardwareInfo &hwInfo) {
size_t size = MemorySynchronizationCommands<GfxFamily>::getSizeForFullCacheFlush(); size_t size = MemorySynchronizationCommands<GfxFamily>::getSizeForFullCacheFlush();
return size; return size;
} }

View File

@@ -200,9 +200,12 @@ bool MemoryManager::isMemoryBudgetExhausted() const {
} }
OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType, OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType,
DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority) { DeviceBitfield deviceBitfield, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice) {
auto contextId = ++latestContextId; auto contextId = ++latestContextId;
auto osContext = OsContext::create(peekExecutionEnvironment().rootDeviceEnvironments[commandStreamReceiver->getRootDeviceIndex()]->osInterface.get(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); auto osContext = OsContext::create(peekExecutionEnvironment().rootDeviceEnvironments[commandStreamReceiver->getRootDeviceIndex()]->osInterface.get(),
contextId, deviceBitfield, engineType, preemptionMode,
lowPriority, internalEngine, rootDevice);
UNRECOVERABLE_IF(!osContext->isInitialized()); UNRECOVERABLE_IF(!osContext->isInitialized());
osContext->incRefInternal(); osContext->incRefInternal();

View File

@@ -147,7 +147,8 @@ class MemoryManager {
const ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; } const ExecutionEnvironment &peekExecutionEnvironment() const { return executionEnvironment; }
OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType, OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, aub_stream::EngineType engineType,
DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority); DeviceBitfield deviceBitfield, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice);
uint32_t getRegisteredEnginesCount() const { return static_cast<uint32_t>(registeredEngines.size()); } uint32_t getRegisteredEnginesCount() const { return static_cast<uint32_t>(registeredEngines.size()); }
EngineControlContainer &getRegisteredEngines(); EngineControlContainer &getRegisteredEngines();
EngineControl *getRegisteredEngineForCsr(CommandStreamReceiver *commandStreamReceiver); EngineControl *getRegisteredEngineForCsr(CommandStreamReceiver *commandStreamReceiver);

View File

@@ -14,16 +14,21 @@
namespace NEO { namespace NEO {
OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) { aub_stream::EngineType engineType, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice) {
if (osInterface) { if (osInterface) {
return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode,
lowPriority, internalEngine, rootDevice);
} }
return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority); return new OsContext(contextId, deviceBitfield, engineType, preemptionMode,
lowPriority, internalEngine, rootDevice);
} }
OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) aub_stream::EngineType engineType, PreemptionMode preemptionMode,
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), drm(drm) { bool lowPriority, bool internalEngine, bool rootDevice)
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice),
drm(drm) {
for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) { for (auto deviceIndex = 0u; deviceIndex < deviceBitfield.size(); deviceIndex++) {
if (deviceBitfield.test(deviceIndex)) { if (deviceBitfield.test(deviceIndex)) {
auto drmContextId = drm.createDrmContext(); auto drmContextId = drm.createDrmContext();

View File

@@ -19,7 +19,8 @@ class OsContextLinux : public OsContext {
OsContextLinux() = delete; OsContextLinux() = delete;
~OsContextLinux() override; ~OsContextLinux() override;
OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); aub_stream::EngineType engineType, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice);
unsigned int getEngineFlag() const { return engineFlag; } unsigned int getEngineFlag() const { return engineFlag; }
const std::vector<uint32_t> &getDrmContextIds() const { return drmContextIds; } const std::vector<uint32_t> &getDrmContextIds() const { return drmContextIds; }

View File

@@ -22,29 +22,37 @@ class OsContext : public ReferenceTrackedObject<OsContext> {
OsContext() = delete; OsContext() = delete;
static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); aub_stream::EngineType engineType, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice);
uint32_t getContextId() const { return contextId; } uint32_t getContextId() const { return contextId; }
uint32_t getNumSupportedDevices() const { return numSupportedDevices; } uint32_t getNumSupportedDevices() const { return numSupportedDevices; }
DeviceBitfield getDeviceBitfield() const { return deviceBitfield; } DeviceBitfield getDeviceBitfield() const { return deviceBitfield; }
PreemptionMode getPreemptionMode() const { return preemptionMode; } PreemptionMode getPreemptionMode() const { return preemptionMode; }
aub_stream::EngineType &getEngineType() { return engineType; } aub_stream::EngineType &getEngineType() { return engineType; }
bool isLowPriority() const { return lowPriority; } bool isLowPriority() const { return lowPriority; }
bool isInternalEngine() const { return internalEngine; }
bool isRootDevice() const { return rootDevice; }
virtual bool isInitialized() const { return true; } virtual bool isInitialized() const { return true; }
protected: protected:
OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, aub_stream::EngineType engineType, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice)
: contextId(contextId), : contextId(contextId),
deviceBitfield(deviceBitfield), deviceBitfield(deviceBitfield),
preemptionMode(preemptionMode), preemptionMode(preemptionMode),
numSupportedDevices(static_cast<uint32_t>(deviceBitfield.count())), numSupportedDevices(static_cast<uint32_t>(deviceBitfield.count())),
engineType(engineType), engineType(engineType),
lowPriority(lowPriority) {} lowPriority(lowPriority),
internalEngine(internalEngine),
rootDevice(rootDevice) {}
const uint32_t contextId; const uint32_t contextId;
const DeviceBitfield deviceBitfield; const DeviceBitfield deviceBitfield;
const PreemptionMode preemptionMode; const PreemptionMode preemptionMode;
const uint32_t numSupportedDevices; const uint32_t numSupportedDevices;
aub_stream::EngineType engineType = aub_stream::ENGINE_RCS; aub_stream::EngineType engineType = aub_stream::ENGINE_RCS;
const bool lowPriority; const bool lowPriority = false;
const bool internalEngine = false;
const bool rootDevice = false;
}; };
} // namespace NEO } // namespace NEO

View File

@@ -14,16 +14,21 @@
namespace NEO { namespace NEO {
OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) { aub_stream::EngineType engineType, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice) {
if (osInterface) { if (osInterface) {
return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode,
lowPriority, internalEngine, rootDevice);
} }
return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority); return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice);
} }
OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority) aub_stream::EngineType engineType, PreemptionMode preemptionMode,
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), wddm(wddm), residencyController(wddm, contextId) { bool lowPriority, bool internalEngine, bool rootDevice)
: OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority, internalEngine, rootDevice),
wddm(wddm),
residencyController(wddm, contextId) {
auto wddmInterface = wddm.getWddmInterface(); auto wddmInterface = wddm.getWddmInterface();
if (!wddm.createContext(*this)) { if (!wddm.createContext(*this)) {

View File

@@ -26,7 +26,8 @@ class OsContextWin : public OsContext {
~OsContextWin() override; ~OsContextWin() override;
OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield,
aub_stream::EngineType engineType, PreemptionMode preemptionMode, bool lowPriority); aub_stream::EngineType engineType, PreemptionMode preemptionMode,
bool lowPriority, bool internalEngine, bool rootDevice);
D3DKMT_HANDLE getWddmContextHandle() const { return wddmContextHandle; } D3DKMT_HANDLE getWddmContextHandle() const { return wddmContextHandle; }
void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; } void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; }

View File

@@ -31,7 +31,8 @@ struct DirectSubmissionFixture : public DeviceFixture {
void SetUp() { void SetUp() {
DeviceFixture::SetUp(); DeviceFixture::SetUp();
osContext.reset(OsContext::create(nullptr, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false)); osContext.reset(OsContext::create(nullptr, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, false));
} }
std::unique_ptr<OsContext> osContext; std::unique_ptr<OsContext> osContext;

View File

@@ -19,7 +19,8 @@ struct DrmDirectSubmissionFixture : public DeviceFixture {
void SetUp() { void SetUp() {
DeviceFixture::SetUp(); DeviceFixture::SetUp();
osContext = std::make_unique<OsContextLinux>(drmMock, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false); osContext = std::make_unique<OsContextLinux>(drmMock, 0u, 0u, aub_stream::ENGINE_RCS,
PreemptionMode::ThreadGroup, false, false, false);
} }
void TearDown() { void TearDown() {

View File

@@ -21,7 +21,8 @@ struct WddmDirectSubmissionFixture : public WddmFixture {
wddm->wddmInterface.reset(new WddmMockInterface20(*wddm)); wddm->wddmInterface.reset(new WddmMockInterface20(*wddm));
wddmMockInterface = static_cast<WddmMockInterface20 *>(wddm->wddmInterface.get()); wddmMockInterface = static_cast<WddmMockInterface20 *>(wddm->wddmInterface.get());
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup, false); osContext = std::make_unique<OsContextWin>(*wddm, 0u, 0u, aub_stream::ENGINE_RCS, PreemptionMode::ThreadGroup,
false, false, false);
device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u)); device.reset(MockDevice::create<MockDevice>(executionEnvironment, 0u));
device->setPreemptionMode(PreemptionMode::ThreadGroup); device->setPreemptionMode(PreemptionMode::ThreadGroup);
} }

View File

@@ -43,7 +43,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
wddm->init(); wddm->init();
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo(); auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0]; auto engine = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances(*hwInfo)[0];
osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, engine, preemptionMode, false); osContext = std::make_unique<OsContextWin>(*wddm, 0u, 1, engine, preemptionMode, false, false, false);
} }
DebugManagerStateRestore *dbgRestorer = nullptr; DebugManagerStateRestore *dbgRestorer = nullptr;