From 958d931cd98640464216966e1cb01f2c6dd9a2e7 Mon Sep 17 00:00:00 2001 From: "Dunajski, Bartosz" Date: Tue, 12 Feb 2019 11:31:19 +0100 Subject: [PATCH] Allow to create HardwareContextController for multiple Devices Change-Id: Ib066c937809536196182ca87359c487570cc2e89 Signed-off-by: Dunajski, Bartosz --- ...nd_stream_receiver_simulated_common_hw.inl | 3 +- runtime/device/device.cpp | 2 +- .../helpers/hardware_context_controller.cpp | 13 +++- runtime/helpers/hardware_context_controller.h | 4 +- runtime/memory_manager/memory_manager.cpp | 4 +- runtime/memory_manager/memory_manager.h | 2 +- .../os_interface/linux/os_context_linux.cpp | 4 +- runtime/os_interface/os_context.h | 8 ++- .../os_interface/windows/os_context_win.cpp | 7 ++- .../aub_command_stream_receiver_1_tests.cpp | 62 ++++++++++++++----- .../aub_command_stream_receiver_2_tests.cpp | 12 ++-- .../command_stream/aub_file_stream_tests.cpp | 14 ++--- ...nd_stream_receiver_with_aub_dump_tests.cpp | 4 +- .../tbx_command_stream_tests.cpp | 12 ++-- .../fixtures/memory_allocator_fixture.h | 2 +- .../fixtures/memory_manager_fixture.cpp | 2 +- .../memory_manager/memory_manager_tests.cpp | 28 ++++++--- unit_tests/memory_manager/surface_tests.cpp | 2 +- unit_tests/mocks/mock_aub_csr.h | 2 +- unit_tests/mocks/mock_tbx_csr.h | 2 +- .../linux/drm_command_stream_tests.cpp | 4 +- .../linux/os_interface_linux_tests.cpp | 2 +- .../windows/device_command_stream_tests.cpp | 4 +- .../windows/gl/gl_os_sharing_tests.cpp | 4 +- .../windows/os_interface_win_tests.cpp | 6 +- .../os_interface/windows/wddm23_tests.cpp | 2 +- .../os_interface/windows/wddm_fixture.h | 4 +- .../windows/wddm_memory_manager_tests.cpp | 16 ++--- .../windows/wddm_memory_manager_tests.h | 4 +- .../windows/wddm_preemption_tests.cpp | 2 +- .../wddm_residency_controller_tests.cpp | 4 +- 31 files changed, 151 insertions(+), 90 deletions(-) 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 54b6e53c0a..c61014bc14 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,8 @@ void CommandStreamReceiverSimulatedCommonHw::setupContext(OsContext & auto &engineType = osContext.getEngineType(); if (aubManager && !(engineType.type == lowPriorityGpgpuEngine.type && engineType.id == lowPriorityGpgpuEngine.id)) { - hardwareContextController = std::make_unique(*aubManager, deviceIndex, engineIndex, flags); + hardwareContextController = std::make_unique(*aubManager, osContext, + deviceIndex, engineIndex, flags); } } diff --git a/runtime/device/device.cpp b/runtime/device/device.cpp index b02badac0b..b9c85b93af 100644 --- a/runtime/device/device.cpp +++ b/runtime/device/device.cpp @@ -173,7 +173,7 @@ bool Device::createEngines(const HardwareInfo *pHwInfo) { } executionEnvironment->initializeMemoryManager(getEnabled64kbPages(), enableLocalMemory, getDeviceIndex(), deviceCsrIndex); - auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(gpgpuEngines[deviceCsrIndex], preemptionMode); + auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(gpgpuEngines[deviceCsrIndex], 1, preemptionMode); auto commandStreamReceiver = executionEnvironment->commandStreamReceivers[getDeviceIndex()][deviceCsrIndex].get(); commandStreamReceiver->setupContext(*osContext); if (!commandStreamReceiver->initializeTagAllocation()) { diff --git a/runtime/helpers/hardware_context_controller.cpp b/runtime/helpers/hardware_context_controller.cpp index 34e455a25e..1972a651a0 100644 --- a/runtime/helpers/hardware_context_controller.cpp +++ b/runtime/helpers/hardware_context_controller.cpp @@ -7,13 +7,24 @@ #include "runtime/helpers/hardware_context_controller.h" #include "runtime/memory_manager/memory_constants.h" +#include "runtime/os_interface/os_context.h" using namespace OCLRT; -HardwareContextController::HardwareContextController(aub_stream::AubManager &aubManager, uint32_t deviceIndex, uint32_t engineIndex, uint32_t flags) { +HardwareContextController::HardwareContextController(aub_stream::AubManager &aubManager, OsContext &osContext, + uint32_t deviceIndex, uint32_t engineIndex, uint32_t flags) { + UNRECOVERABLE_IF(osContext.getNumDevicesSupported() > 1); hardwareContexts.emplace_back(aubManager.createHardwareContext(deviceIndex, engineIndex, flags)); } +HardwareContextController::HardwareContextController(aub_stream::AubManager &aubManager, OsContext &osContext, + uint32_t engineIndex, uint32_t flags) { + UNRECOVERABLE_IF(osContext.getNumDevicesSupported() < 2); + for (uint32_t deviceIndex = 0; deviceIndex < osContext.getNumDevicesSupported(); deviceIndex++) { + hardwareContexts.emplace_back(aubManager.createHardwareContext(deviceIndex, engineIndex, flags)); + } +} + void HardwareContextController::initialize() { for (auto &hardwareContext : hardwareContexts) { hardwareContext->initialize(); diff --git a/runtime/helpers/hardware_context_controller.h b/runtime/helpers/hardware_context_controller.h index ca0afd1a22..8d7c53c0d9 100644 --- a/runtime/helpers/hardware_context_controller.h +++ b/runtime/helpers/hardware_context_controller.h @@ -13,11 +13,13 @@ #include namespace OCLRT { +class OsContext; class HardwareContextController { public: HardwareContextController() = delete; - HardwareContextController(aub_stream::AubManager &aubManager, uint32_t deviceIndex, uint32_t engineIndex, uint32_t flags); + HardwareContextController(aub_stream::AubManager &aubManager, OsContext &osContext, uint32_t deviceIndex, uint32_t engineIndex, uint32_t flags); + HardwareContextController(aub_stream::AubManager &aubManager, OsContext &osContext, uint32_t engineIndex, uint32_t flags); void initialize(); void pollForCompletion(); diff --git a/runtime/memory_manager/memory_manager.cpp b/runtime/memory_manager/memory_manager.cpp index 390ef8c0bc..00de104d93 100644 --- a/runtime/memory_manager/memory_manager.cpp +++ b/runtime/memory_manager/memory_manager.cpp @@ -184,12 +184,12 @@ bool MemoryManager::isMemoryBudgetExhausted() const { return false; } -OsContext *MemoryManager::createAndRegisterOsContext(EngineInstanceT engineType, PreemptionMode preemptionMode) { +OsContext *MemoryManager::createAndRegisterOsContext(EngineInstanceT engineType, uint32_t numSupportedDevices, PreemptionMode preemptionMode) { auto contextId = ++latestContextId; if (contextId + 1 > registeredOsContexts.size()) { registeredOsContexts.resize(contextId + 1); } - auto osContext = new OsContext(executionEnvironment.osInterface.get(), contextId, engineType, preemptionMode); + auto osContext = new OsContext(executionEnvironment.osInterface.get(), contextId, numSupportedDevices, engineType, preemptionMode); osContext->incRefInternal(); registeredOsContexts[contextId] = osContext; diff --git a/runtime/memory_manager/memory_manager.h b/runtime/memory_manager/memory_manager.h index 3cc15c7e73..55c28796cc 100644 --- a/runtime/memory_manager/memory_manager.h +++ b/runtime/memory_manager/memory_manager.h @@ -177,7 +177,7 @@ class MemoryManager { ::alignedFree(ptr); } - OsContext *createAndRegisterOsContext(EngineInstanceT engineType, PreemptionMode preemptionMode); + OsContext *createAndRegisterOsContext(EngineInstanceT engineType, uint32_t numSupportedDevices, PreemptionMode preemptionMode); uint32_t getOsContextCount() { return static_cast(registeredOsContexts.size()); } CommandStreamReceiver *getDefaultCommandStreamReceiver(uint32_t deviceId) const; const CsrContainer &getCommandStreamReceivers() const; diff --git a/runtime/os_interface/linux/os_context_linux.cpp b/runtime/os_interface/linux/os_context_linux.cpp index 84bbdbf6bc..10ab38dd6a 100644 --- a/runtime/os_interface/linux/os_context_linux.cpp +++ b/runtime/os_interface/linux/os_context_linux.cpp @@ -13,8 +13,8 @@ namespace OCLRT { -OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType, PreemptionMode preemptionMode) - : contextId(contextId), engineType(engineType) { +OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, uint32_t numDevicesSupported, EngineInstanceT engineType, PreemptionMode preemptionMode) + : contextId(contextId), numDevicesSupported(numDevicesSupported), engineType(engineType) { if (osInterface) { osContextImpl = std::make_unique(*osInterface->get()->getDrm(), engineType); } diff --git a/runtime/os_interface/os_context.h b/runtime/os_interface/os_context.h index 7b168b3b40..c0c994d198 100644 --- a/runtime/os_interface/os_context.h +++ b/runtime/os_interface/os_context.h @@ -17,18 +17,20 @@ class OSInterface; class OsContext : public ReferenceTrackedObject { public: class OsContextImpl; - OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType, PreemptionMode preemptionMode); + OsContext(OSInterface *osInterface, uint32_t contextId, uint32_t numDevicesSupported, EngineInstanceT engineType, PreemptionMode preemptionMode); ~OsContext() override; OsContextImpl *get() const { return osContextImpl.get(); }; uint32_t getContextId() const { return contextId; } + uint32_t getNumDevicesSupported() const { return numDevicesSupported; } EngineInstanceT &getEngineType() { return engineType; } protected: std::unique_ptr osContextImpl; - uint32_t contextId = 0; - EngineInstanceT engineType; + const uint32_t contextId; + const uint32_t numDevicesSupported; + EngineInstanceT engineType = {EngineType::ENGINE_RCS, 0}; }; } // namespace OCLRT diff --git a/runtime/os_interface/windows/os_context_win.cpp b/runtime/os_interface/windows/os_context_win.cpp index f449df6b1c..bb3e8dd57d 100644 --- a/runtime/os_interface/windows/os_context_win.cpp +++ b/runtime/os_interface/windows/os_context_win.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Intel Corporation + * Copyright (C) 2018-2019 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -31,12 +31,13 @@ OsContextWin::~OsContextImpl() { wddm.destroyContext(context); } -OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, EngineInstanceT engineType, PreemptionMode preemptionMode) - : contextId(contextId), engineType(engineType) { +OsContext::OsContext(OSInterface *osInterface, uint32_t contextId, uint32_t numDevicesSupported, EngineInstanceT engineType, PreemptionMode preemptionMode) + : contextId(contextId), numDevicesSupported(numDevicesSupported), engineType(engineType) { if (osInterface) { osContextImpl = std::make_unique(*osInterface->get()->getWddm(), contextId, engineType, preemptionMode); } } + OsContext::~OsContext() = default; } // namespace OCLRT 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 c582edfca9..4df939da97 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 @@ -191,7 +191,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH uint32_t engineIndex = 2; uint32_t deviceIndex = 3; - OsContext osContext(nullptr, 0, allEngineInstances[engineIndex], PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, allEngineInstances[engineIndex], PreemptionMode::Disabled); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -211,7 +211,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH } HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSetThenDontCreateHardwareContext) { - OsContext osContext(nullptr, 0, lowPriorityGpgpuEngine, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, lowPriorityGpgpuEngine, PreemptionMode::Disabled); std::string fileName = "file_name.aub"; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB); @@ -298,7 +298,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl executionEnvironment.aubCenter.reset(new AubCenter()); auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - OsContext osContext(nullptr, 0, engineInstance, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled); auto aubCsr1 = std::make_unique>(**platformDevices, "", true, executionEnvironment); auto aubCsr2 = std::make_unique>(**platformDevices, "", true, executionEnvironment); @@ -688,7 +688,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess auto memoryManager = aubExecutionEnvironment->executionEnvironment->memoryManager.get(); auto gfxDefaultAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; ResidencyContainer allocationsForResidency = {gfxDefaultAllocation}; aubCsr->processResidency(allocationsForResidency); @@ -729,11 +728,11 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess aubCsr->setupContext(*pDevice->getDefaultEngine().osContext); auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; + gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; + gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE); ResidencyContainer allocationsForResidency = {gfxBufferAllocation, gfxImageAllocation}; @@ -754,12 +753,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur aubCsr->setupContext(*pDevice->getDefaultEngine().osContext); auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; + gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); gfxBufferAllocation->setAubWritable(false); auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; + gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE); gfxImageAllocation->setAubWritable(false); @@ -783,12 +782,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess aubCsr->setupContext(*pDevice->getDefaultEngine().osContext); auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; + gfxBufferAllocation->setAllocationType(GraphicsAllocation::AllocationType::BUFFER); gfxBufferAllocation->setAubWritable(false); auto gfxImageAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); - ; + gfxImageAllocation->setAllocationType(GraphicsAllocation::AllocationType::IMAGE); gfxImageAllocation->setAubWritable(false); @@ -804,6 +803,18 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess memoryManager->freeGraphicsMemory(gfxImageAllocation); } +HWTEST_F(AubCommandStreamReceiverTests, givenOsContextWithMultipleDevicesSupportedWhenSetupIsCalledThenAbort) { + MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, "", CommandStreamReceiverType::CSR_AUB); + mockAubCenter->aubManager = std::make_unique(); + pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); + + uint32_t numSupportedDevices = 3; + OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + auto aubCsr = std::make_unique>(*platformDevices[0], "", true, *pDevice->executionEnvironment); + + EXPECT_THROW(aubCsr->setupContext(osContext), std::exception); +} + HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsntNonAubWritableThenWriteMemoryIsAllowed) { std::unique_ptr memoryManager(nullptr); std::unique_ptr> aubCsr(new AUBCommandStreamReceiverHw(*platformDevices[0], "", true, *pDevice->executionEnvironment)); @@ -1102,11 +1113,29 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon using HardwareContextContainerTests = ::testing::Test; +TEST_F(HardwareContextContainerTests, givenDeviceIndexWhenOsContextWithMultipleDevicesSupportedThenAbort) { + MockAubManager aubManager; + uint32_t numSupportedDevices = 2; + uint32_t deviceIndex = 1; + OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + + EXPECT_THROW(HardwareContextController(aubManager, osContext, deviceIndex, 0, 0), std::exception); +} + +TEST_F(HardwareContextContainerTests, givenOsContextWithoutMultipleDevicesSupportedWhenNoDeviceIndexPassedThenAbort) { + MockAubManager aubManager; + uint32_t numSupportedDevices = 1; + OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + + EXPECT_THROW(HardwareContextController(aubManager, osContext, 0, 0), std::exception); +} + TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseAllContexts) { MockAubManager aubManager; - HardwareContextController hwContextContainer(aubManager, 1, 2, 0); - hwContextContainer.hardwareContexts.emplace_back(aubManager.createHardwareContext(2, 3)); - EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); + uint32_t numSupportedDevices = 2; + OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + HardwareContextController hwContextContainer(aubManager, osContext, numSupportedDevices, 0); + EXPECT_EQ(numSupportedDevices, hwContextContainer.hardwareContexts.size()); auto mockHwContext0 = static_cast(hwContextContainer.hardwareContexts[0].get()); auto mockHwContext1 = static_cast(hwContextContainer.hardwareContexts[1].get()); @@ -1137,9 +1166,10 @@ TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCa TEST_F(HardwareContextContainerTests, givenMultipleHwContextWhenSingleMethodIsCalledThenUseFirstContext) { MockAubManager aubManager; - HardwareContextController hwContextContainer(aubManager, 1, 2, 0); - hwContextContainer.hardwareContexts.emplace_back(aubManager.createHardwareContext(2, 3)); - EXPECT_EQ(2u, hwContextContainer.hardwareContexts.size()); + uint32_t numSupportedDevices = 2; + OsContext osContext(nullptr, 1, numSupportedDevices, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + HardwareContextController hwContextContainer(aubManager, osContext, 2, 0); + EXPECT_EQ(numSupportedDevices, hwContextContainer.hardwareContexts.size()); auto mockHwContext0 = static_cast(hwContextContainer.hardwareContexts[0].get()); auto mockHwContext1 = static_cast(hwContextContainer.hardwareContexts[1].get()); 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 9929b51b72..f6ffed75e0 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 @@ -709,7 +709,7 @@ HWTEST_F(AubCommandStreamReceiverTests, whenAubCommandStreamReceiverIsCreatedThe HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenEngineIsInitializedThenDumpHandleIsGenerated) { executionEnvironment.aubCenter.reset(new AubCenter()); auto engineInstance = HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0]; - OsContext osContext(nullptr, 0, engineInstance, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, engineInstance, PreemptionMode::Disabled); auto aubCsr = std::make_unique>(**platformDevices, "", true, executionEnvironment); EXPECT_NE(nullptr, aubCsr); @@ -896,7 +896,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -923,7 +923,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -951,7 +951,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNonWritableWhenDu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -980,7 +980,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationNotDumpableWhenDu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -1010,7 +1010,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationDumpableWhenDumpA pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); diff --git a/unit_tests/command_stream/aub_file_stream_tests.cpp b/unit_tests/command_stream/aub_file_stream_tests.cpp index 62072f953a..b0a1004b7e 100644 --- a/unit_tests/command_stream/aub_file_stream_tests.cpp +++ b/unit_tests/command_stream/aub_file_stream_tests.cpp @@ -204,7 +204,7 @@ HWTEST_F(AubFileStreamTests, givenNewTasksAndHardwareContextPresentWhenCallingPo pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -224,7 +224,7 @@ HWTEST_F(AubFileStreamTests, givenNoNewTasksAndHardwareContextPresentWhenCalling pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto hardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -307,7 +307,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenI pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -336,7 +336,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenFlushIsCalledWithZ pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); aubCsr.stream = aubStream.get(); @@ -360,7 +360,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenMakeResidentIsCall pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -376,7 +376,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryEqualI pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(aubCsr.hardwareContextController->hardwareContexts[0].get()); @@ -392,7 +392,7 @@ HWTEST_F(AubFileStreamTests, givenAubCommandStreamReceiverWhenExpectMemoryNotEqu pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockAubCsr aubCsr(**platformDevices, "", true, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); aubCsr.setupContext(osContext); auto mockHardwareContext = static_cast(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 91d5728750..9da1e188e4 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 @@ -110,7 +110,7 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParamcreateAndRegisterOsContext( - getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo)); + getChosenEngineType(DEFAULT_TEST_PLATFORM::hwInfo), 1, PreemptionHelper::getDefaultPreemptionMode(DEFAULT_TEST_PLATFORM::hwInfo)); csrWithAubDump->setupContext(*osContext); if (csrWithAubDump->aubCSR) { csrWithAubDump->aubCSR->setupContext(*osContext); @@ -132,7 +132,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenCsrWithAubDumpWhenSett ExecutionEnvironment executionEnvironment; CommandStreamReceiverWithAUBDump> csrWithAubDump(*platformDevices[0], "aubfile", executionEnvironment); - OsContext osContext(nullptr, 0, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + OsContext osContext(nullptr, 0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); csrWithAubDump.setupContext(osContext); EXPECT_EQ(&osContext, &csrWithAubDump.getOsContext()); diff --git a/unit_tests/command_stream/tbx_command_stream_tests.cpp b/unit_tests/command_stream/tbx_command_stream_tests.cpp index 9248e8b3c5..b2f6866b3b 100644 --- a/unit_tests/command_stream/tbx_command_stream_tests.cpp +++ b/unit_tests/command_stream/tbx_command_stream_tests.cpp @@ -347,7 +347,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledTh pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -377,7 +377,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverInBatchedModeWhenFl pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); tbxCsr.setupContext(osContext); auto commandBuffer = pDevice->executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -399,7 +399,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledWi pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -421,7 +421,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeResidentIsC pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); tbxCsr.setupContext(osContext); MockGraphicsAllocation allocation(reinterpret_cast(0x1000), 0x1000); @@ -437,7 +437,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenMakeCoherentIsC pDevice->executionEnvironment->aubCenter.reset(mockAubCenter); MockTbxCsr tbxCsr(**platformDevices, *pDevice->executionEnvironment); - OsContext osContext(nullptr, 0, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); tbxCsr.setupContext(osContext); auto mockHardwareContext = static_cast(tbxCsr.hardwareContextController->hardwareContexts[0].get()); @@ -461,7 +461,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt } HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareContext) { - OsContext osContext(nullptr, 0, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled); + OsContext osContext(nullptr, 0, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionMode::Disabled); std::string fileName = ""; MockAubManager *mockManager = new MockAubManager(); MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_TBX); diff --git a/unit_tests/fixtures/memory_allocator_fixture.h b/unit_tests/fixtures/memory_allocator_fixture.h index 6e7efa7611..2e80fecc4b 100644 --- a/unit_tests/fixtures/memory_allocator_fixture.h +++ b/unit_tests/fixtures/memory_allocator_fixture.h @@ -26,7 +26,7 @@ class MemoryAllocatorFixture : public MemoryManagementFixture { memoryManager = new MockMemoryManager(false, false, *executionEnvironment); executionEnvironment->memoryManager.reset(memoryManager); csr = memoryManager->getDefaultCommandStreamReceiver(0); - csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]))); + csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]))); } void TearDown() override { diff --git a/unit_tests/fixtures/memory_manager_fixture.cpp b/unit_tests/fixtures/memory_manager_fixture.cpp index 69d028661f..dd21124bc4 100644 --- a/unit_tests/fixtures/memory_manager_fixture.cpp +++ b/unit_tests/fixtures/memory_manager_fixture.cpp @@ -21,7 +21,7 @@ void MemoryManagerWithCsrFixture::SetUp() { csr->tagAddress = ¤tGpuTag; executionEnvironment.commandStreamReceivers.resize(1); executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); - csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]))); + csr->setupContext(*memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]))); } void MemoryManagerWithCsrFixture::TearDown() { diff --git a/unit_tests/memory_manager/memory_manager_tests.cpp b/unit_tests/memory_manager/memory_manager_tests.cpp index 27098529d8..bd10535894 100644 --- a/unit_tests/memory_manager/memory_manager_tests.cpp +++ b/unit_tests/memory_manager/memory_manager_tests.cpp @@ -177,7 +177,7 @@ TEST_F(MemoryAllocatorTest, allocateSystemAligned) { TEST_F(MemoryAllocatorTest, allocateGraphics) { unsigned int alignment = 4096; - memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); auto allocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); ASSERT_NE(nullptr, allocation); @@ -1271,7 +1271,7 @@ TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsCompletedWhenche } TEST_F(MemoryManagerWithCsrTest, givenAllocationThatWasUsedAndIsNotCompletedWhencheckGpuUsageAndDestroyGraphicsAllocationsIsCalledThenItIsAddedToTemporaryAllocationList) { - memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); auto usedAllocationAndNotGpuCompleted = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); auto tagAddress = csr->getTagAddress(); @@ -1522,16 +1522,25 @@ TEST(GraphicsAllocation, givenSharedHandleBasedConstructorWhenGraphicsAllocation TEST(ResidencyDataTest, givenOsContextWhenItIsRegisteredToMemoryManagerThenRefCountIncreases) { ExecutionEnvironment executionEnvironment; MockMemoryManager memoryManager(false, false, executionEnvironment); - memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); EXPECT_EQ(1u, memoryManager.getOsContextCount()); EXPECT_EQ(1, memoryManager.registeredOsContexts[0]->getRefInternalCount()); } +TEST(ResidencyDataTest, givenNumberOfSupportedDevicesWhenCreatingOsContextThenSetValidValue) { + ExecutionEnvironment executionEnvironment; + MockMemoryManager memoryManager(false, false, executionEnvironment); + uint32_t numSupportedDevices = 3; + memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], + numSupportedDevices, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + EXPECT_EQ(numSupportedDevices, memoryManager.registeredOsContexts[0]->getNumDevicesSupported()); +} + TEST(ResidencyDataTest, givenTwoOsContextsWhenTheyAreRegistredFromHigherToLowerThenProperSizeIsReturned) { ExecutionEnvironment executionEnvironment; MockMemoryManager memoryManager(false, false, executionEnvironment); - memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager.createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); EXPECT_EQ(2u, memoryManager.getOsContextCount()); EXPECT_EQ(1, memoryManager.registeredOsContexts[0]->getRefInternalCount()); EXPECT_EQ(1, memoryManager.registeredOsContexts[1]->getRefInternalCount()); @@ -1544,8 +1553,8 @@ TEST(ResidencyDataTest, givenResidencyDataWhenUpdateCompletionDataIsCalledThenIt MockResidencyData residency; - OsContext osContext(nullptr, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - OsContext osContext2(nullptr, 1u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + OsContext osContext(nullptr, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + OsContext osContext2(nullptr, 1u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[1], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); auto lastFenceValue = 45llu; auto lastFenceValue2 = 23llu; @@ -1603,3 +1612,8 @@ TEST(MemoryManagerTest, givenMemoryManagerWhenAllocationWasNotUnlockedThenItIsUn memoryManager.freeGraphicsMemory(allocation); EXPECT_EQ(1u, memoryManager.unlockResourceCalled); } + +TEST(OsContextTest, givenOsContextWithNumberOfSupportedDevicesWhenConstructingThenUsePassedValue) { + OsContext osContext(nullptr, 5, 7, {EngineType::ENGINE_RCS, 0}, PreemptionMode::Disabled); + EXPECT_EQ(7u, osContext.getNumDevicesSupported()); +} diff --git a/unit_tests/memory_manager/surface_tests.cpp b/unit_tests/memory_manager/surface_tests.cpp index c0a83820fb..13257a46ed 100644 --- a/unit_tests/memory_manager/surface_tests.cpp +++ b/unit_tests/memory_manager/surface_tests.cpp @@ -64,7 +64,7 @@ HWTEST_TYPED_TEST(SurfaceTest, GivenSurfaceWhenInterfaceIsUsedThenSurfaceBehaves MockCsr *csr = new MockCsr(execStamp, executionEnvironment); executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); executionEnvironment.memoryManager.reset(csr->createMemoryManager(false, false)); - csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]))); + csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]))); Surface *surface = createSurface::Create(this->data, &this->buffer, diff --git a/unit_tests/mocks/mock_aub_csr.h b/unit_tests/mocks/mock_aub_csr.h index 8176f65af0..c4cbb80e2f 100644 --- a/unit_tests/mocks/mock_aub_csr.h +++ b/unit_tests/mocks/mock_aub_csr.h @@ -168,7 +168,7 @@ std::unique_ptr getEnvironment(bool createTagAllocation executionEnvironment->commandStreamReceivers[0][0]->initializeTagAllocation(); } - auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); executionEnvironment->commandStreamReceivers[0][0]->setupContext(*osContext); std::unique_ptr aubExecutionEnvironment(new AubExecutionEnvironment); diff --git a/unit_tests/mocks/mock_tbx_csr.h b/unit_tests/mocks/mock_tbx_csr.h index 00e893bd07..c98c724342 100644 --- a/unit_tests/mocks/mock_tbx_csr.h +++ b/unit_tests/mocks/mock_tbx_csr.h @@ -101,7 +101,7 @@ std::unique_ptr getEnvironment(bool createTagAllocation executionEnvironment->commandStreamReceivers[0][0]->initializeTagAllocation(); } - auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + auto osContext = executionEnvironment->memoryManager->createAndRegisterOsContext(getChosenEngineType(*platformDevices[0]), 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); executionEnvironment->commandStreamReceivers[0][0]->setupContext(*osContext); std::unique_ptr tbxExecutionEnvironment(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 0a505ec387..4be473005b 100644 --- a/unit_tests/os_interface/linux/drm_command_stream_tests.cpp +++ b/unit_tests/os_interface/linux/drm_command_stream_tests.cpp @@ -41,7 +41,7 @@ class DrmCommandStreamFixture { executionEnvironment.osInterface = std::make_unique(); executionEnvironment.osInterface->get()->setDrm(mock.get()); - osContext = std::make_unique(executionEnvironment.osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + osContext = std::make_unique(executionEnvironment.osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); csr = new DrmCommandStreamReceiver(*platformDevices[0], executionEnvironment, gemCloseWorkerMode::gemCloseWorkerActive); @@ -253,7 +253,7 @@ TEST_F(DrmCommandStreamTest, givenDrmContextIdWhenFlushingThenSetIdToAllExecBuff .WillRepeatedly(::testing::Return(0)) .RetiresOnSaturation(); - osContext = std::make_unique(executionEnvironment.osInterface.get(), 1, + osContext = std::make_unique(executionEnvironment.osInterface.get(), 1, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); csr->setupContext(*osContext); diff --git a/unit_tests/os_interface/linux/os_interface_linux_tests.cpp b/unit_tests/os_interface/linux/os_interface_linux_tests.cpp index 9124d6cbc1..38b9dac41e 100644 --- a/unit_tests/os_interface/linux/os_interface_linux_tests.cpp +++ b/unit_tests/os_interface/linux/os_interface_linux_tests.cpp @@ -28,7 +28,7 @@ TEST(OsContextTest, givenDrmWhenOsContextIsCreatedThenImplIsAvailable) { OSInterface osInterface; osInterface.get()->setDrm(&drmMock); - auto osContext = std::make_unique(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + auto osContext = std::make_unique(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); EXPECT_NE(nullptr, osContext->get()); } } // namespace OCLRT 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 982baf3c28..208e6a87d0 100644 --- a/unit_tests/os_interface/windows/device_command_stream_tests.cpp +++ b/unit_tests/os_interface/windows/device_command_stream_tests.cpp @@ -249,7 +249,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOf std::make_unique>(hwInfo[0], *executionEnvironment)); executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceivers[0][0]->createMemoryManager(false, false)); executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); - OsContext osContext(executionEnvironment->osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo)); + OsContext osContext(executionEnvironment->osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo)); executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); @@ -274,7 +274,7 @@ TEST(WddmPreemptionHeaderTests, givenWddmCommandStreamReceiverWhenPreemptionIsOn *executionEnvironment)); executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceivers[0][0]->createMemoryManager(false, false)); executionEnvironment->commandStreamReceivers[0][0]->overrideDispatchPolicy(DispatchMode::ImmediateDispatch); - OsContext osContext(executionEnvironment->osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo)); + OsContext osContext(executionEnvironment->osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*hwInfo)); executionEnvironment->commandStreamReceivers[0][0]->setupContext(osContext); auto commandBuffer = executionEnvironment->memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize}); 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 34111f7002..d026e6d62c 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 @@ -325,7 +325,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza FailSignalSyncObjectMock::reset(); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - OsContext osContext(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + OsContext osContext(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.serverSynchronizationObject = 0x5cU; @@ -384,7 +384,7 @@ TEST_F(GlArbSyncEventOsTest, GivenCallToSignalArbSyncObjectWhenSignalSynchroniza FailSignalSyncObjectMock::reset(); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - OsContext osContext(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + OsContext osContext(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); CL_GL_SYNC_INFO syncInfo = {}; syncInfo.submissionSynchronizationObject = 0x7cU; 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 5834bc5773..5d8855f69b 100644 --- a/unit_tests/os_interface/windows/os_interface_win_tests.cpp +++ b/unit_tests/os_interface/windows/os_interface_win_tests.cpp @@ -29,7 +29,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextBeforeInitWddmThenOsContextIsNot auto wddm = new WddmMock; OSInterface osInterface; osInterface.get()->setWddm(wddm); - EXPECT_THROW(auto osContext = std::make_unique(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])), std::exception); + EXPECT_THROW(auto osContext = std::make_unique(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])), std::exception); } TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInitializedAndTrimCallbackIsRegistered) { @@ -39,7 +39,7 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); EXPECT_EQ(0u, wddm->registerTrimCallbackResult.called); - auto osContext = std::make_unique(&osInterface, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + auto osContext = std::make_unique(&osInterface, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); EXPECT_NE(nullptr, osContext->get()); EXPECT_TRUE(osContext->get()->isInitialized()); EXPECT_EQ(osContext->get()->getWddm(), wddm); @@ -48,6 +48,6 @@ TEST(OsContextTest, givenWddmWhenCreateOsContextAfterInitWddmThenOsContextIsInit TEST(OsContextTest, whenCreateOsContextWithoutOsInterfaceThenOsContextImplIsNotAvailable) { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); - auto osContext = std::make_unique(nullptr, 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + auto osContext = std::make_unique(nullptr, 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); EXPECT_EQ(nullptr, osContext->get()); } diff --git a/unit_tests/os_interface/windows/wddm23_tests.cpp b/unit_tests/os_interface/windows/wddm23_tests.cpp index 7c020a5968..6fbc894c87 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, publi void init() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); EXPECT_TRUE(wddm->init(preemptionMode)); - osContext = std::make_unique(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); osContextWin = osContext->get(); } diff --git a/unit_tests/os_interface/windows/wddm_fixture.h b/unit_tests/os_interface/windows/wddm_fixture.h index 5a540188a2..367b8f57bb 100644 --- a/unit_tests/os_interface/windows/wddm_fixture.h +++ b/unit_tests/os_interface/windows/wddm_fixture.h @@ -29,7 +29,7 @@ struct WddmFixture : public GmmEnvironmentFixture { wddm->gdi.reset(gdi); auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); wddm->init(preemptionMode); - osContext = std::make_unique(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); osContextWin = osContext->get(); ASSERT_TRUE(wddm->isInitialized()); } @@ -58,7 +58,7 @@ struct WddmFixtureWithMockGdiDll : public GmmEnvironmentFixture, public GdiDllFi void init() { auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0]); EXPECT_TRUE(wddm->init(preemptionMode)); - osContext = std::make_unique(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); osContextWin = osContext->get(); 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 233168ef8b..34c4a76c6f 100644 --- a/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_memory_manager_tests.cpp @@ -69,7 +69,7 @@ constexpr EngineInstanceT defaultRcsEngine{ENGINE_RCS, 0}; TEST(WddmAllocationTest, givenAllocationIsTrimCandidateInOneOsContextWhenGettingTrimCandidatePositionThenReturnItsPositionAndUnusedPositionInOtherContexts) { WddmAllocation allocation{nullptr, 0, nullptr, MemoryPool::MemoryNull, false}; - OsContext osContext(nullptr, 1u, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + OsContext osContext(nullptr, 1u, 1, defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); allocation.setTrimCandidateListPosition(osContext.getContextId(), 700u); EXPECT_EQ(trimListUnusedPosition, allocation.getTrimCandidateListPosition(0u)); EXPECT_EQ(700u, allocation.getTrimCandidateListPosition(1u)); @@ -1228,16 +1228,16 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithNoRegisteredOsContextsWh } TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) { - memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); EXPECT_FALSE(memoryManager->isMemoryBudgetExhausted()); } TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithExhaustedMemoryBudgetWhenCallingIsMemoryBudgetExhaustedThenReturnTrue) { - memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); - memoryManager->createAndRegisterOsContext(defaultRcsEngine, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); memoryManager->getRegisteredOsContext(1)->get()->getResidencyController().setMemoryBudgetExhausted(); EXPECT_TRUE(memoryManager->isMemoryBudgetExhausted()); } @@ -1469,7 +1469,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen executionEnvironment.commandStreamReceivers[0].push_back(std::unique_ptr(csr)); executionEnvironment.memoryManager = std::make_unique(false, false, wddm, executionEnvironment); - csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(defaultRcsEngine, preemptionMode)); + csr->setupContext(*executionEnvironment.memoryManager->createAndRegisterOsContext(defaultRcsEngine, 1, preemptionMode)); EXPECT_EQ(csr, executionEnvironment.memoryManager->getDefaultCommandStreamReceiver(0)); auto tagAllocator = csr->getEventPerfCountAllocator(); 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 b066786a60..1eddee30c5 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,7 @@ class MockWddmMemoryManagerFixture : public GmmEnvironmentFixture { executionEnvironment.osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(wddm, executionEnvironment); - memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); osContext = memoryManager->getRegisteredOsContext(0); osContext->incRefInternal(); @@ -91,7 +91,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public GmmEnvironmentFixture { memoryManager = new (std::nothrow) MockWddmMemoryManager(wddm, executionEnvironment); //assert we have memory manager ASSERT_NE(nullptr, memoryManager); - memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode); osContext = memoryManager->getRegisteredOsContext(0); osContext->incRefInternal(); diff --git a/unit_tests/os_interface/windows/wddm_preemption_tests.cpp b/unit_tests/os_interface/windows/wddm_preemption_tests.cpp index f24be1abe3..ff1992b956 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(osInterface.get(), 0u, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + osContext = std::make_unique(osInterface.get(), 0u, 1, HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); osContextWin = osContext->get(); } 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 0ae56a9cf2..6cf1dbdf06 100644 --- a/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp +++ b/unit_tests/os_interface/windows/wddm_residency_controller_tests.cpp @@ -91,7 +91,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(wddm, *executionEnvironment); - memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], preemptionMode); + memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode); osContext = memoryManager->getRegisteredOsContext(0); osContext->incRefInternal(); residencyController = &osContext->get()->getResidencyController(); @@ -122,7 +122,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test { executionEnvironment->osInterface->get()->setWddm(wddm); memoryManager = std::make_unique(wddm, *executionEnvironment); - memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); + memoryManager->createAndRegisterOsContext(HwHelper::get(platformDevices[0]->pPlatform->eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, PreemptionHelper::getDefaultPreemptionMode(*platformDevices[0])); osContext = memoryManager->getRegisteredOsContext(0); osContext->incRefInternal();