From 429487fad0b815a06d56d384e7173086ad33156e Mon Sep 17 00:00:00 2001 From: Piotr Fusik Date: Mon, 18 Mar 2019 13:57:59 +0100 Subject: [PATCH] Add constructor parameter to select low priority context. Change-Id: Ieb3fa008a2f1b54052e393516038c88f00944fa0 Signed-off-by: Piotr Fusik --- Jenkinsfile | 2 +- ...nd_stream_receiver_simulated_common_hw.inl | 2 +- runtime/device/device.cpp | 3 ++- runtime/memory_manager/memory_manager.cpp | 4 ++-- runtime/memory_manager/memory_manager.h | 2 +- .../os_interface/linux/os_context_linux.cpp | 14 +++++------ runtime/os_interface/linux/os_context_linux.h | 2 +- runtime/os_interface/os_context.h | 10 +++++--- .../os_interface/windows/os_context_win.cpp | 10 ++++---- runtime/os_interface/windows/os_context_win.h | 2 +- .../aub_command_stream_receiver_1_tests.cpp | 16 ++++++------- .../aub_command_stream_receiver_2_tests.cpp | 16 ++++++------- .../command_stream/aub_file_stream_tests.cpp | 14 +++++------ ...nd_stream_receiver_with_aub_dump_tests.cpp | 7 +++--- .../tbx_command_stream_tests.cpp | 12 +++++----- .../execution_environment_tests.cpp | 5 ++-- .../fixtures/memory_allocator_fixture.h | 2 +- .../fixtures/memory_manager_fixture.cpp | 2 +- .../memory_manager/memory_manager_tests.cpp | 23 +++++++++++-------- unit_tests/memory_manager/surface_tests.cpp | 2 +- unit_tests/mocks/mock_aub_csr.h | 2 +- unit_tests/mocks/mock_os_context.h | 6 ++--- unit_tests/mocks/mock_tbx_csr.h | 3 ++- .../linux/drm_command_stream_tests.cpp | 6 +++-- unit_tests/os_interface/linux/drm_tests.cpp | 12 +++++----- .../windows/device_command_stream_tests.cpp | 6 +++-- .../windows/gl/gl_os_sharing_tests.cpp | 4 ++-- .../windows/os_interface_win_tests.cpp | 6 +++-- .../os_interface/windows/wddm23_tests.cpp | 6 ++--- .../os_interface/windows/wddm_fixture.h | 4 ++-- .../windows/wddm_memory_manager_tests.cpp | 22 ++++++++++-------- .../windows/wddm_memory_manager_tests.h | 5 ++-- .../windows/wddm_preemption_tests.cpp | 2 +- .../wddm_residency_controller_tests.cpp | 5 ++-- 34 files changed, 129 insertions(+), 110 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8bfc1f2aa2..94efd19acf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,5 @@ #!groovy dependenciesRevision='ec7183fc6b8fde18df4a38ab2aa6d6f364b507f1-1216' strategy='EQUAL' -allowedCD=275 +allowedCD=274 allowedF=4 diff --git a/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl b/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl index e97ae8636c..526853763c 100644 --- a/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl +++ b/runtime/command_stream/command_stream_receiver_simulated_common_hw.inl @@ -95,7 +95,7 @@ void CommandStreamReceiverSimulatedCommonHw::setupContext(OsContext & uint32_t flags = 0; getCsTraits(engineType).setContextSaveRestoreFlags(flags); - if (aubManager && !(engineType.type == lowPriorityGpgpuEngine.type && engineType.id == lowPriorityGpgpuEngine.id)) { + if (aubManager && !osContext.isLowPriority()) { hardwareContextController = std::make_unique(*aubManager, osContext, engineIndex, flags); } } diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index 2617e8d858..ed456b619e 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -175,8 +175,9 @@ bool Device::createEngines(const HardwareInfo *pHwInfo) { DeviceBitfield deviceBitfield; deviceBitfield.set(getDeviceIndex()); + bool lowPriority = deviceCsrIndex == EngineInstanceConstants::lowPriorityGpgpuEngineIndex; auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(commandStreamReceiver, gpgpuEngines[deviceCsrIndex], - deviceBitfield, preemptionMode); + deviceBitfield, preemptionMode, lowPriority); commandStreamReceiver->setupContext(*osContext); if (!commandStreamReceiver->initializeTagAllocation()) { diff --git a/runtime/memory_manager/memory_manager.cpp b/runtime/memory_manager/memory_manager.cpp index 651ecfbb46..c53ef54f15 100644 --- a/runtime/memory_manager/memory_manager.cpp +++ b/runtime/memory_manager/memory_manager.cpp @@ -188,9 +188,9 @@ bool MemoryManager::isMemoryBudgetExhausted() const { } OsContext *MemoryManager::createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, EngineInstanceT engineType, - DeviceBitfield deviceBitfield, PreemptionMode preemptionMode) { + DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority) { auto contextId = ++latestContextId; - auto osContext = OsContext::create(executionEnvironment.osInterface.get(), contextId, deviceBitfield, engineType, preemptionMode); + auto osContext = OsContext::create(executionEnvironment.osInterface.get(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); osContext->incRefInternal(); registeredEngines.emplace_back(commandStreamReceiver, osContext); diff --git a/runtime/memory_manager/memory_manager.h b/runtime/memory_manager/memory_manager.h index c77004f349..bbd907badf 100644 --- a/runtime/memory_manager/memory_manager.h +++ b/runtime/memory_manager/memory_manager.h @@ -175,7 +175,7 @@ class MemoryManager { } OsContext *createAndRegisterOsContext(CommandStreamReceiver *commandStreamReceiver, EngineInstanceT engineType, - DeviceBitfield deviceBitfield, PreemptionMode preemptionMode); + DeviceBitfield deviceBitfield, PreemptionMode preemptionMode, bool lowPriority); uint32_t getRegisteredEnginesCount() const { return static_cast(registeredEngines.size()); } CommandStreamReceiver *getDefaultCommandStreamReceiver(uint32_t deviceId) const; EngineControlContainer &getRegisteredEngines(); diff --git a/runtime/os_interface/linux/os_context_linux.cpp b/runtime/os_interface/linux/os_context_linux.cpp index 24dcdb3520..19b48598ff 100644 --- a/runtime/os_interface/linux/os_context_linux.cpp +++ b/runtime/os_interface/linux/os_context_linux.cpp @@ -15,22 +15,20 @@ namespace OCLRT { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode) { + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) { if (osInterface) { - return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode); + return new OsContextLinux(*osInterface->get()->getDrm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); } - return new OsContext(contextId, deviceBitfield, engineType, preemptionMode); + return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority); } OsContextLinux::OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode), drm(drm) { + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), drm(drm) { engineFlag = DrmEngineMapper::engineNodeMap(engineType.type); this->drmContextId = drm.createDrmContext(); - if (drm.isPreemptionSupported() && - engineType.type == lowPriorityGpgpuEngine.type && - engineType.id == lowPriorityGpgpuEngine.id) { + if (drm.isPreemptionSupported() && lowPriority) { drm.setLowPriorityContextParam(this->drmContextId); } } diff --git a/runtime/os_interface/linux/os_context_linux.h b/runtime/os_interface/linux/os_context_linux.h index b624e1fc27..501d3be233 100644 --- a/runtime/os_interface/linux/os_context_linux.h +++ b/runtime/os_interface/linux/os_context_linux.h @@ -15,7 +15,7 @@ class OsContextLinux : public OsContext { OsContextLinux() = delete; ~OsContextLinux() override; OsContextLinux(Drm &drm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode); + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority); unsigned int getEngineFlag() const { return engineFlag; } uint32_t getDrmContextId() const { return drmContextId; } diff --git a/runtime/os_interface/os_context.h b/runtime/os_interface/os_context.h index 8190cb77da..e416162a44 100644 --- a/runtime/os_interface/os_context.h +++ b/runtime/os_interface/os_context.h @@ -21,25 +21,29 @@ class OsContext : public ReferenceTrackedObject { public: OsContext() = delete; - static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, EngineInstanceT engineType, PreemptionMode preemptionMode); + static OsContext *create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority); uint32_t getContextId() const { return contextId; } uint32_t getNumSupportedDevices() const { return numSupportedDevices; } DeviceBitfield getDeviceBitfield() const { return deviceBitfield; } PreemptionMode getPreemptionMode() const { return preemptionMode; } EngineInstanceT &getEngineType() { return engineType; } + bool isLowPriority() const { return lowPriority; } protected: - OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, EngineInstanceT engineType, PreemptionMode preemptionMode) + OsContext(uint32_t contextId, DeviceBitfield deviceBitfield, EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) : contextId(contextId), deviceBitfield(deviceBitfield), preemptionMode(preemptionMode), numSupportedDevices(static_cast(deviceBitfield.count())), - engineType(engineType) {} + engineType(engineType), + lowPriority(lowPriority) {} const uint32_t contextId; const DeviceBitfield deviceBitfield; const PreemptionMode preemptionMode; const uint32_t numSupportedDevices; EngineInstanceT engineType = {EngineType::ENGINE_RCS, 0}; + const bool lowPriority; }; } // namespace OCLRT diff --git a/runtime/os_interface/windows/os_context_win.cpp b/runtime/os_interface/windows/os_context_win.cpp index e5baddde97..45dd713c4c 100644 --- a/runtime/os_interface/windows/os_context_win.cpp +++ b/runtime/os_interface/windows/os_context_win.cpp @@ -14,16 +14,16 @@ namespace OCLRT { OsContext *OsContext::create(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode) { + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) { if (osInterface) { - return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode); + return new OsContextWin(*osInterface->get()->getWddm(), contextId, deviceBitfield, engineType, preemptionMode, lowPriority); } - return new OsContext(contextId, deviceBitfield, engineType, preemptionMode); + return new OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority); } OsContextWin::OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode), wddm(wddm), residencyController(wddm, contextId) { + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority), wddm(wddm), residencyController(wddm, contextId) { UNRECOVERABLE_IF(!wddm.isInitialized()); diff --git a/runtime/os_interface/windows/os_context_win.h b/runtime/os_interface/windows/os_context_win.h index cc5eb17ada..4eb3423ef9 100644 --- a/runtime/os_interface/windows/os_context_win.h +++ b/runtime/os_interface/windows/os_context_win.h @@ -18,7 +18,7 @@ class OsContextWin : public OsContext { ~OsContextWin() override; OsContextWin(Wddm &wddm, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode); + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority); D3DKMT_HANDLE getWddmContextHandle() const { return wddmContextHandle; } void setWddmContextHandle(D3DKMT_HANDLE wddmContextHandle) { this->wddmContextHandle = wddmContextHandle; } diff --git a/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp index 2a46641528..486fa99d6b 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_1_tests.cpp @@ -198,7 +198,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH uint32_t engineIndex = 2; uint32_t deviceIndex = 3; - MockOsContext osContext(nullptr, 0, 8, allEngineInstances[engineIndex], PreemptionMode::Disabled); + MockOsContext osContext(0, 8, allEngineInstances[engineIndex], PreemptionMode::Disabled, false); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -218,7 +218,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH } HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) { - MockOsContext osContext(nullptr, 0, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -226,7 +226,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSet ExecutionEnvironment executionEnvironment; executionEnvironment.aubCenter = std::unique_ptr(mockAubCenter); - std::unique_ptr> aubCsr(reinterpret_cast *>(AUBCommandStreamReceiver::create(*platformDevices[0], fileName, true, executionEnvironment))); + std::unique_ptr> aubCsr(static_cast *>(AUBCommandStreamReceiver::create(*platformDevices[0], fileName, true, executionEnvironment))); EXPECT_EQ(nullptr, aubCsr->hardwareContextController.get()); aubCsr->setupContext(osContext); @@ -284,7 +284,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl executionEnvironment.aubCenter.reset(new AubCenter()); auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - MockOsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); auto aubCsr1 = std::make_unique>(**platformDevices, "", true, executionEnvironment); auto aubCsr2 = std::make_unique>(**platformDevices, "", true, executionEnvironment); @@ -787,7 +787,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupport DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(nullptr, 1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); auto aubCsr = std::make_unique>(*platformDevices[0], "", true, *pDevice->executionEnvironment); aubCsr->setupContext(osContext); @@ -1100,7 +1100,7 @@ TEST_F(HardwareContextContainerTests, givenOsContextWithMultipleDevicesSupported DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(nullptr, 1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); HardwareContextController hwContextControler(aubManager, osContext, 0, 0); EXPECT_EQ(2u, hwContextControler.hardwareContexts.size()); @@ -1116,7 +1116,7 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(nullptr, 1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 3, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); @@ -1157,7 +1157,7 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa DeviceBitfield deviceBitfield; deviceBitfield.set(0); deviceBitfield.set(1); - MockOsContext osContext(nullptr, 1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(1, deviceBitfield, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); HardwareContextController hwContextContainer(aubManager, osContext, 2, 0); EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); diff --git a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp index da73db532f..016f1ce409 100644 --- a/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp +++ b/unit_tests/command_stream/aub_command_stream_receiver_2_tests.cpp @@ -474,7 +474,7 @@ HWTEST_F(AubCommandStreamReceiverNoHostPtrTests, givenAubCommandStreamReceiverWh executionEnvironment->memoryManager.reset(memoryManager); auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - MockOsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw(*platformDevices[0], "", true, *executionEnvironment)); aubCsr->setupContext(osContext); @@ -721,7 +721,7 @@ HWTEST_F(AubCommandStreamReceiverTests, whenAubCommandStreamReceiverIsCreatedThe HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineIsInitializedThenDumpHandleIsGenerated) { pDevice->executionEnvironment->aubCenter.reset(new AubCenter()); auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - MockOsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false); auto aubCsr = std::make_unique>(**platformDevices, "", true, *pDevice->executionEnvironment); EXPECT_NE(nullptr, aubCsr); @@ -894,7 +894,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -919,7 +919,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -946,7 +946,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -974,7 +974,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1003,7 +1003,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1031,7 +1031,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); aubCsr.latestSentTaskCount = 1; diff --git a/unit_tests/command_stream/aub_file_stream_tests.cpp b/unit_tests/command_stream/aub_file_stream_tests.cpp index 2b601e28b1..e185a5a200 100644 --- a/unit_tests/command_stream/aub_file_stream_tests.cpp +++ b/unit_tests/command_stream/aub_file_stream_tests.cpp @@ -262,7 +262,7 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -282,7 +282,7 @@ HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCalling pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -365,7 +365,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -394,7 +394,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -418,7 +418,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -434,7 +434,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -450,7 +450,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); diff --git a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp index 8fcd60b4b4..41514f7f59 100644 --- a/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp +++ b/unit_tests/command_stream/command_stream_receiver_with_aub_dump_tests.cpp @@ -112,8 +112,8 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParammemoryManager->createAndRegisterOsContext(csrWithAubDump, - getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), - 1, PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo)); + getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1, + PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo), false); csrWithAubDump->setupContext(*osContext); } @@ -132,7 +132,8 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment(); CommandStreamReceiverWithAUBDump> csrWithAubDump(*platformDevices[0], "aubfile", *executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + MockOsContext osContext(0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csrWithAubDump.setupContext(osContext); EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext()); diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index e4dcf9e12c..2bc013a96c 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -352,7 +352,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -382,7 +382,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -404,7 +404,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -426,7 +426,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -442,7 +442,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsC pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - MockOsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + MockOsContext osContext(0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled, false); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -466,7 +466,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt } HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) { - MockOsContext osContext(nullptr, 0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled); + MockOsContext osContext(0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled, false); std::string fileName = ""; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_TBX); diff --git a/unit_tests/execution_environment/execution_environment_tests.cpp b/unit_tests/execution_environment/execution_environment_tests.cpp index 13db659b14..f2d17951fe 100644 --- a/unit_tests/execution_environment/execution_environment_tests.cpp +++ b/unit_tests/execution_environment/execution_environment_tests.cpp @@ -301,9 +301,8 @@ TEST(ExecutionEnvironment, whenSpecialCsrExistsThenReturnSpecialEngineControl) { executionEnvironment->specialCommandStreamReceiver.reset(createCommandStream(platformDevices[0], *executionEnvironment)); auto engineType = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(executionEnvironment->specialCommandStreamReceiver.get(), - engineType, - 1, - PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + engineType, 1, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); executionEnvironment->specialCommandStreamReceiver->setupContext(*osContext); auto engineControl = executionEnvironment->getEngineControlForSpecialCsr(); diff --git a/unit_tests/fixtures/memory_allocator_fixture.h b/unit_tests/fixtures/memory_allocator_fixture.h index 3919854fae..d7c68ad350 100644 --- a/unit_tests/fixtures/memory_allocator_fixture.h +++ b/unit_tests/fixtures/memory_allocator_fixture.h @@ -28,7 +28,7 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { executionEnvironment->memoryManager.reset(memoryManager); csr = memoryManager->getDefaultCommandStreamReceiver(0); auto engineType = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + auto osContext = memoryManager->createAndRegisterOsContext(csr, engineType, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); } diff --git a/unit_tests/fixtures/memory_manager_fixture.cpp b/unit_tests/fixtures/memory_manager_fixture.cpp index c0b5d5b14c..1506f08e51 100644 --- a/unit_tests/fixtures/memory_manager_fixture.cpp +++ b/unit_tests/fixtures/memory_manager_fixture.cpp @@ -23,7 +23,7 @@ void MemoryManagerWithCsrFixture::SetUp() { executionEnvironment.commandStreamReceivers.resize(1); executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); auto engine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - auto osContext = memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + auto osContext = memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); } diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 6dda816d5f..6262a7ce1b 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -180,7 +180,8 @@ TEST_F(MemoryAllocatorTest, allocateSystemAligned) { TEST_F(MemoryAllocatorTest, allocateGraphics) { unsigned int alignment = 4096; - memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); ASSERT_NE(nullptr, allocation); @@ -1306,7 +1307,8 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche } TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) { - memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(csr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto tagAddress = csr->getTagAddress(); @@ -1552,7 +1554,8 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) { ExecutionEnvironment executionEnvironment; MockMemoryManager memoryManager(false, false, executionEnvironment); - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); EXPECT_EQ(1u, memoryManager.getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager.registeredEngines[0].osContext->getRefInternalCount()); } @@ -1565,17 +1568,19 @@ TEST(ResidencyDataTest, givenDeviceBitfieldWhenCreatingOsContextThenSetValidValu deviceBitfield.set(1); PreemptionMode preemptionMode = PreemptionMode::MidThread; memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], - deviceBitfield, preemptionMode); + deviceBitfield, preemptionMode, false); EXPECT_EQ(2u, memoryManager.registeredEngines[0].osContext->getNumSupportedDevices()); EXPECT_EQ(deviceBitfield, memoryManager.registeredEngines[0].osContext->getDeviceBitfield()); EXPECT_EQ(preemptionMode, memoryManager.registeredEngines[0].osContext->getPreemptionMode()); } -TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegistredFromHigherToLowerThenProperSizeIsReturned) { +TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegisteredFromHigherToLowerThenProperSizeIsReturned) { ExecutionEnvironment executionEnvironment; MockMemoryManager memoryManager(false, false, executionEnvironment); - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager.createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); EXPECT_EQ(2u, memoryManager.getRegisteredEnginesCount()); EXPECT_EQ(1, memoryManager.registeredEngines[0].osContext->getRefInternalCount()); EXPECT_EQ(1, memoryManager.registeredEngines[1].osContext->getRefInternalCount()); @@ -1588,8 +1593,8 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt MockResidencyData residency; - MockOsContext osContext(nullptr, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - MockOsContext osContext2(nullptr, 1u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + MockOsContext osContext(0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + MockOsContext osContext2(1u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto lastFenceValue = 45llu; auto lastFenceValue2 = 23llu; diff --git a/unit_tests/memory_manager/surface_tests.cpp b/unit_tests/memory_manager/surface_tests.cpp index 81e34b15be..9a819cf7d0 100644 --- a/unit_tests/memory_manager/surface_tests.cpp +++ b/unit_tests/memory_manager/surface_tests.cpp @@ -66,7 +66,7 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); executionEnvironment.initializeMemoryManager(false, false); auto engine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr, engine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); Surface *surface = createSurface::Create(this->data, diff --git a/unit_tests/mocks/mock_aub_csr.h b/unit_tests/mocks/mock_aub_csr.h index c0cae42300..cdd776ddd7 100644 --- a/unit_tests/mocks/mock_aub_csr.h +++ b/unit_tests/mocks/mock_aub_csr.h @@ -173,7 +173,7 @@ std::unique_ptr getEnvironment(bool createTagAllocation auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(executionEnvironment->commandStreamReceivers[0][0].get(), getChosenEngineType(*platformDevices[0]), 1, - PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); executionEnvironment->commandStreamReceivers[0][0]->setupContext(*osContext); std::unique_ptr aubExecutionEnvironment(new AubExecutionEnvironment); diff --git a/unit_tests/mocks/mock_os_context.h b/unit_tests/mocks/mock_os_context.h index 15a6991635..e84e7ec1bf 100644 --- a/unit_tests/mocks/mock_os_context.h +++ b/unit_tests/mocks/mock_os_context.h @@ -11,8 +11,8 @@ namespace OCLRT { class MockOsContext : public OsContext { public: - MockOsContext(OSInterface *osInterface, uint32_t contextId, DeviceBitfield deviceBitfield, - EngineInstanceT engineType, PreemptionMode preemptionMode) - : OsContext(contextId, deviceBitfield, engineType, preemptionMode) {} + MockOsContext(uint32_t contextId, DeviceBitfield deviceBitfield, + EngineInstanceT engineType, PreemptionMode preemptionMode, bool lowPriority) + : OsContext(contextId, deviceBitfield, engineType, preemptionMode, lowPriority) {} }; } // namespace OCLRT diff --git a/unit_tests/mocks/mock_tbx_csr.h b/unit_tests/mocks/mock_tbx_csr.h index d190350563..9e68a85dbd 100644 --- a/unit_tests/mocks/mock_tbx_csr.h +++ b/unit_tests/mocks/mock_tbx_csr.h @@ -104,7 +104,8 @@ std::unique_ptr getEnvironment(bool createTagAllocation } auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(executionEnvironment->commandStreamReceivers[0][0].get(), - getChosenEngineType(*platformDevices[0]), 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + getChosenEngineType(*platformDevices[0]), 1, + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); executionEnvironment->commandStreamReceivers[0][0]->setupContext(*osContext); std::unique_ptr tbxExecutionEnvironment(new TbxExecutionEnvironment); diff --git a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp index 8762b1aa87..b3ec031235 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -43,7 +43,8 @@ class DrmCommandStreamFixture { executionEnvironment.osInterface = std::make_unique(); executionEnvironment.osInterface->get()->setDrm(mock.get()); - osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + osContext = std::make_unique(*mock, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr = new DrmCommandStreamReceiver(*platformDevices[0], executionEnvironment, gemCloseWorkerMode::gemCloseWorkerActive); @@ -261,7 +262,8 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff .RetiresOnSaturation(); osContext = std::make_unique(*mock, 1, 1, - HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); csr->setupContext(*osContext); auto &cs = csr->getCS(); diff --git a/unit_tests/os_interface/linux/drm_tests.cpp b/unit_tests/os_interface/linux/drm_tests.cpp index ed68dab388..da7b34babc 100644 --- a/unit_tests/os_interface/linux/drm_tests.cpp +++ b/unit_tests/os_interface/linux/drm_tests.cpp @@ -157,14 +157,14 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext) { drmMock.StoredCtxId = drmContextId1; - OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled); + OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); EXPECT_EQ(drmContextId1, osContext1.getDrmContextId()); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); { drmMock.StoredCtxId = drmContextId2; - OsContextLinux osContext2(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled); + OsContextLinux osContext2(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); EXPECT_EQ(drmContextId2, osContext2.getDrmContextId()); EXPECT_EQ(0u, drmMock.receivedDestroyContextId); } @@ -180,17 +180,17 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext drmMock.StoredCtxId = 123; drmMock.preemptionSupported = false; - OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled); - OsContextLinux osContext2(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled); + OsContextLinux osContext1(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); + OsContextLinux osContext2(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); drmMock.preemptionSupported = true; - OsContextLinux osContext3(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled); + OsContextLinux osContext3(drmMock, 0u, 1, defaultEngine, PreemptionMode::Disabled, false); EXPECT_EQ(0u, drmMock.receivedContextParamRequestCount); - OsContextLinux osContext4(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled); + OsContextLinux osContext4(drmMock, 0u, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled, true); EXPECT_EQ(1u, drmMock.receivedContextParamRequestCount); EXPECT_EQ(drmMock.StoredCtxId, drmMock.receivedContextParamRequest.ctx_id); EXPECT_EQ(static_cast(I915_CONTEXT_PARAM_PRIORITY), drmMock.receivedContextParamRequest.param); diff --git a/unit_tests/os_interface/windows/device_command_stream_tests.cpp b/unit_tests/os_interface/windows/device_command_stream_tests.cpp index 1a69ea7dd8..765a941e8a 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -248,7 +248,8 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf std::make_unique>(hwInfo[0], *executionEnvironment)); executionEnvironment->memoryManager.reset(new WddmMemoryManager(false, false, wddm, *executionEnvironment)); executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); - OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo)); + OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -273,7 +274,8 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn *executionEnvironment)); executionEnvironment->memoryManager.reset(new WddmMemoryManager(false, false, wddm, *executionEnvironment)); executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); - OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo)); + OsContextWin osContext(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + PreemptionHelper::getDefaultPreemptionMode(*hwInfo), false); executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); diff --git a/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp b/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp index 79676611d5..11fc2da0b3 100644 --- a/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp +++ b/unit_tests/os_interface/windows/gl/gl_os_sharing_tests.cpp @@ -326,7 +326,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza FailSignalSyncObjectMock::reset(); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.serverSynchronizationObject = 0x5cU; @@ -385,7 +385,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza FailSignalSyncObjectMock::reset(); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + OsContextWin osContext(*osInterface.get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.submissionSynchronizationObject = 0x7cU; diff --git a/unit_tests/os_interface/windows/os_interface_win_tests.cpp b/unit_tests/os_interface/windows/os_interface_win_tests.cpp index e7b20958f7..2b051f1d8e 100644 --- a/unit_tests/os_interface/windows/os_interface_win_tests.cpp +++ b/unit_tests/os_interface/windows/os_interface_win_tests.cpp @@ -30,7 +30,9 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextBeforeInitWddmThenOsContextIsNot auto wddm = new WddmMock; OSInterface osInterface; osInterface.get()->setWddm(wddm); - EXPECT_THROW(auto osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])), std::exception); + EXPECT_THROW(OsContextWin(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false), + std::exception); } TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedAndTrimCallbackIsRegistered) { @@ -40,7 +42,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called); - auto osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + auto osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); EXPECT_TRUE(osContext->isInitialized()); EXPECT_EQ(osContext->getWddm(), wddm); EXPECT_EQ(1u, wddm->registerTrimCallbackResult.called); diff --git a/unit_tests/os_interface/windows/wddm23_tests.cpp b/unit_tests/os_interface/windows/wddm23_tests.cpp index 0a562d6f7d..390d11d859 100644 --- a/unit_tests/os_interface/windows/wddm23_tests.cpp +++ b/unit_tests/os_interface/windows/wddm23_tests.cpp @@ -38,7 +38,7 @@ struct Wddm23TestsWithoutWddmInit : public ::testing::Test, GdiDllFixture { void init() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); EXPECT_TRUE(wddm->init(preemptionMode)); - osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); } void TearDown() override { @@ -67,8 +67,8 @@ TEST_F(Wddm23Tests, whenCreateContextIsCalledThenEnableHwQueues) { TEST_F(Wddm23Tests, givenPreemptionModeWhenCreateHwQueueCalledThenSetGpuTimeoutIfEnabled) { auto defaultEngine = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled); - OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch); + OsContextWin osContextWithoutPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::Disabled, false); + OsContextWin osContextWithPreemption(*osInterface->get()->getWddm(), 0u, 1, defaultEngine, PreemptionMode::MidBatch, false); wddm->wddmInterface->createHwQueue(osContextWithoutPreemption); EXPECT_EQ(0u, getCreateHwQueueDataFcn()->Flags.DisableGpuTimeout); diff --git a/unit_tests/os_interface/windows/wddm_fixture.h b/unit_tests/os_interface/windows/wddm_fixture.h index df0fbbe5d9..2501027a68 100644 --- a/unit_tests/os_interface/windows/wddm_fixture.h +++ b/unit_tests/os_interface/windows/wddm_fixture.h @@ -31,7 +31,7 @@ struct WddmFixture : ::testing::Test { wddm->gdi.reset(gdi); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); ASSERT_TRUE(wddm->isInitialized()); } @@ -55,7 +55,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture { void init() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); EXPECT_TRUE(wddm->init(preemptionMode)); - osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(*osInterface->get()->getWddm(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); ASSERT_TRUE(wddm->isInitialized()); } diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp index 32e6adc72f..5b9348ffd0 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -70,7 +70,7 @@ constexpr EngineInstanceT defaultRcsEngine{ENGINE_RCS, 0}; TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { WddmAllocation allocation{GraphicsAllocation::AllocationType::UNDECIDED, nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; - MockOsContext osContext(nullptr, 1u, 1, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + MockOsContext osContext(1u, 1, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); @@ -277,7 +277,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSingleEngineRegister } TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForEachEngine) { - memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], + 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); auto allocation = static_cast(memoryManager->allocateGraphicsMemoryWithProperties({32, GraphicsAllocation::AllocationType::BUFFER})); @@ -294,7 +295,8 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi } TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForTheseEngines) { - memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], + 2, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); ASSERT_EQ(2u, memoryManager->getRegisteredEnginesCount()); auto allocation = static_cast(memoryManager->allocateGraphicsMemoryWithProperties({32, GraphicsAllocation::AllocationType::BUFFER})); @@ -1320,16 +1322,16 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithNoRegisteredOsContextsWh } TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) { - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); } TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithExhaustedMemoryBudgetWhenCallingIsMemoryBudgetExhaustedThenReturnTrue) { - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); + memoryManager->createAndRegisterOsContext(nullptr, defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); auto osContext = static_cast(memoryManager->getRegisteredEngines()[1].osContext); osContext->getResidencyController().setMemoryBudgetExhausted(); EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted()); @@ -1565,7 +1567,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); executionEnvironment.memoryManager = std::make_unique(false, false, wddm, executionEnvironment); - auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr, defaultRcsEngine, 1, preemptionMode); + auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr, defaultRcsEngine, 1, preemptionMode, false); csr->setupContext(*osContext); EXPECT_EQ(csr, executionEnvironment.memoryManager->getDefaultCommandStreamReceiver(0)); diff --git a/unit_tests/os_interface/windows/wddm_memory_manager_tests.h b/unit_tests/os_interface/windows/wddm_memory_manager_tests.h index c14c084722..dbf181c590 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.h +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.h @@ -55,7 +55,8 @@ class MockWddmMemoryManagerFixture { executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(wddm, *executionEnvironment); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); osContext->incRefInternal(); } @@ -98,7 +99,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture memoryManager = new (std::nothrow) MockWddmMemoryManager(wddm, *executionEnvironment); //assert we have memory manager ASSERT_NE(nullptr, memoryManager); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode); + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false); osContext->incRefInternal(); diff --git a/unit_tests/os_interface/windows/wddm_preemption_tests.cpp b/unit_tests/os_interface/windows/wddm_preemption_tests.cpp index d162ba8ba8..f3efc923f3 100644 --- a/unit_tests/os_interface/windows/wddm_preemption_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_preemption_tests.cpp @@ -36,7 +36,7 @@ class WddmPreemptionTests : public Test { regReader->forceRetValue = forceReturnPreemptionRegKeyValue; auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfoTest); wddm->init(preemptionMode); - osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(*wddm, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode, false); } DebugManagerStateRestore *dbgRestorer = nullptr; diff --git a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp index 52b0be6856..2579408b30 100644 --- a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp @@ -92,7 +92,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(wddm, *executionEnvironment); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode); + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false); osContext->incRefInternal(); residencyController = &static_cast(osContext)->getResidencyController(); @@ -123,7 +123,8 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(wddm, *executionEnvironment); - osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]), false); osContext->incRefInternal();