Make MemoryOperationsHandler adapter specific

Change-Id: I978ecaf0fbe3cfc3b645b84d978b7d9234b28bd1
Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
Jobczyk, Lukasz
2019-11-28 13:02:11 +01:00
committed by sys_ocldev
parent ec22a08785
commit 44a9ec5c1a
22 changed files with 107 additions and 56 deletions

View File

@@ -7,6 +7,7 @@
#include "core/execution_environment/root_device_environment.h"
#include "core/memory_manager/memory_operations_handler.h"
#include "runtime/aub/aub_center.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/gmm_helper/page_table_mngr.h"

View File

@@ -17,6 +17,7 @@ namespace NEO {
class AubCenter;
class ExecutionEnvironment;
class GmmPageTableMngr;
class MemoryOperationsHandler;
struct RootDeviceEnvironment {
RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment);
@@ -26,6 +27,7 @@ struct RootDeviceEnvironment {
MOCKABLE_VIRTUAL void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType);
std::unique_ptr<GmmPageTableMngr> pageTableManager;
std::unique_ptr<MemoryOperationsHandler> memoryOperationsInterface;
std::unique_ptr<AubCenter> aubCenter;
ExecutionEnvironment &executionEnvironment;
};

View File

@@ -6,6 +6,7 @@
*/
#include "core/command_stream/preemption.h"
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/hw_helper.h"
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
#include "test.h"
@@ -32,7 +33,7 @@ class WddmPreemptionTests : public Test<WddmFixtureWithMockGdiDll> {
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
osInterface = executionEnvironment->osInterface.get();
auto regReader = new RegistryReaderMock();
wddm->registryReader.reset(regReader);

View File

@@ -11,7 +11,6 @@
#include "core/execution_environment/root_device_environment.h"
#include "core/gmm_helper/gmm_helper.h"
#include "core/helpers/hw_helper.h"
#include "core/memory_manager/memory_operations_handler.h"
#include "runtime/built_ins/built_ins.h"
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
#include "runtime/compiler_interface/default_cl_cache_config.h"

View File

@@ -17,7 +17,6 @@ class BuiltIns;
class CompilerInterface;
class GmmHelper;
class MemoryManager;
class MemoryOperationsHandler;
class OSInterface;
class SourceLevelDebugger;
struct RootDeviceEnvironment;
@@ -51,7 +50,6 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
BuiltIns *getBuiltIns();
std::unique_ptr<OSInterface> osInterface;
std::unique_ptr<MemoryOperationsHandler> memoryOperationsInterface;
std::unique_ptr<MemoryManager> memoryManager;
std::vector<std::unique_ptr<RootDeviceEnvironment>> rootDeviceEnvironments;
std::unique_ptr<BuiltIns> builtins;

View File

@@ -55,9 +55,9 @@ bool DeviceFactory::getDevicesForProductFamilyOverride(size_t &numDevices, Execu
auto localMemoryEnabled = hwHelper.getEnableLocalMemory(*hardwareInfo);
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csrType));
auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get();
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<AubMemoryOperationsHandler>(aubCenter->getAubManager());
}
auto aubCenter = executionEnvironment.rootDeviceEnvironments[0]->aubCenter.get();
executionEnvironment.memoryOperationsInterface = std::make_unique<AubMemoryOperationsHandler>(aubCenter->getAubManager());
}
return true;
}

View File

@@ -5,6 +5,7 @@
*
*/
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/hw_info.h"
#include "runtime/device/device.h"
#include "runtime/os_interface/device_factory.h"
@@ -33,7 +34,9 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
return false;
}
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
}
executionEnvironment.osInterface.reset(new OSInterface());
executionEnvironment.osInterface->get()->setDrm(drm);

View File

@@ -8,6 +8,7 @@
#ifdef _WIN32
#include "core/debug_settings/debug_settings_manager.h"
#include "core/execution_environment/root_device_environment.h"
#include "runtime/device/device.h"
#include "runtime/os_interface/device_factory.h"
#include "runtime/os_interface/windows/os_interface.h"
@@ -37,7 +38,9 @@ bool DeviceFactory::getDevices(size_t &numDevices, ExecutionEnvironment &executi
}
executionEnvironment.calculateMaxOsContextCount();
executionEnvironment.memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm.get());
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm.get());
}
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setWddm(wddm.release());

View File

@@ -16,7 +16,6 @@
#include "core/memory_manager/memory_operations_handler.h"
#include "runtime/command_stream/command_stream_receiver_hw.h"
#include "runtime/device/device.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/gmm_helper/gmm.h"
#include "runtime/gmm_helper/page_table_mngr.h"
#include "runtime/gmm_helper/resource_info.h"
@@ -331,7 +330,7 @@ void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation
residencyController.removeFromTrimCandidateListIfUsed(input, true);
}
executionEnvironment.memoryOperationsInterface->evict(*input);
executionEnvironment.rootDeviceEnvironments[gfxAllocation->getRootDeviceIndex()]->memoryOperationsInterface->evict(*input);
auto defaultGmm = gfxAllocation->getDefaultGmm();
if (defaultGmm) {

View File

@@ -149,7 +149,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWhenInitializeMemoryManagerI
static_assert(sizeof(ExecutionEnvironment) == sizeof(std::mutex) +
sizeof(std::unique_ptr<HardwareInfo>) +
sizeof(std::vector<RootDeviceEnvironment>) +
(is64bit ? 80 : 44),
(is64bit ? 72 : 40),
"New members detected in ExecutionEnvironment, please ensure that destruction sequence of objects is correct");
TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDestroyedThenDeleteSequenceIsSpecified) {
@@ -164,12 +164,12 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
struct OsInterfaceMock : public DestructorCounted<OSInterface, 6> {
OsInterfaceMock(uint32_t &destructorId) : DestructorCounted(destructorId) {}
};
struct MemoryOperationsHandlerMock : public DestructorCounted<MockMemoryOperationsHandler, 5> {
MemoryOperationsHandlerMock(uint32_t &destructorId) : DestructorCounted(destructorId) {}
};
struct MemoryMangerMock : public DestructorCounted<MockMemoryManager, 4> {
struct MemoryMangerMock : public DestructorCounted<MockMemoryManager, 5> {
MemoryMangerMock(uint32_t &destructorId, ExecutionEnvironment &executionEnvironment) : DestructorCounted(destructorId, executionEnvironment) {}
};
struct MemoryOperationsHandlerMock : public DestructorCounted<MockMemoryOperationsHandler, 4> {
MemoryOperationsHandlerMock(uint32_t &destructorId) : DestructorCounted(destructorId) {}
};
struct AubCenterMock : public DestructorCounted<AubCenter, 3> {
AubCenterMock(uint32_t &destructorId) : DestructorCounted(destructorId, platformDevices[0], false, "", CommandStreamReceiverType::CSR_AUB) {}
};
@@ -188,7 +188,7 @@ TEST(ExecutionEnvironment, givenExecutionEnvironmentWithVariousMembersWhenItIsDe
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->gmmHelper = std::make_unique<GmmHelperMock>(destructorId, platformDevices[0]);
executionEnvironment->osInterface = std::make_unique<OsInterfaceMock>(destructorId);
executionEnvironment->memoryOperationsInterface = std::make_unique<MemoryOperationsHandlerMock>(destructorId);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<MemoryOperationsHandlerMock>(destructorId);
executionEnvironment->memoryManager = std::make_unique<MemoryMangerMock>(destructorId, *executionEnvironment);
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::make_unique<AubCenterMock>(destructorId);
executionEnvironment->builtins = std::make_unique<BuiltinsMock>(destructorId);

View File

@@ -7,33 +7,37 @@
#pragma once
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/memory_manager/os_agnostic_memory_manager.h"
#include "unit_tests/fixtures/memory_management_fixture.h"
#include "unit_tests/helpers/variable_backup.h"
#include "unit_tests/libult/create_command_stream.h"
#include "unit_tests/mocks/mock_memory_manager.h"
using namespace NEO;
template <uint32_t numRootDevices>
class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture {
class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public ::testing::TestWithParam<bool> {
public:
void SetUp() override {
MemoryManagementFixture::SetUp();
executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->setHwInfo(*platformDevices);
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
executionEnvironment->memoryManager.reset(memoryManager);
}
void TearDown() override {
executionEnvironment.reset();
MemoryManagementFixture::TearDown();
isOsAgnosticMemoryManager = GetParam();
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
VariableBackup<bool> overrideDeviceWithDefaultHardwareInfoBackup(&overrideDeviceWithDefaultHardwareInfo, false);
VariableBackup<bool> overrideMemoryManagerCreationBackup(&overrideMemoryManagerCreation, isOsAgnosticMemoryManager);
platform()->initialize();
executionEnvironment = platform()->peekExecutionEnvironment();
memoryManager = executionEnvironment->memoryManager.get();
}
uint32_t getNumRootDevices() { return numRootDevices; }
protected:
std::unique_ptr<ExecutionEnvironment> executionEnvironment;
MockMemoryManager *memoryManager = nullptr;
ExecutionEnvironment *executionEnvironment = nullptr;
MemoryManager *memoryManager = nullptr;
DebugManagerStateRestore restorer;
bool isOsAgnosticMemoryManager;
};

View File

@@ -7,6 +7,7 @@
#include "unit_tests/helpers/execution_environment_helper.h"
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
#include "runtime/os_interface/device_factory.h"
#include "runtime/platform/platform.h"
@@ -15,6 +16,8 @@ namespace NEO {
ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_t rootDeviceEnvironments) {
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
executionEnvironment->prepareRootDeviceEnvironments(rootDeviceEnvironments);
DebugManagerStateRestore restorer;
DebugManager.flags.CreateMultipleRootDevices.set(rootDeviceEnvironments);
size_t numDevicesReturned = 0;
hwInfo = nullptr;
DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);

View File

@@ -23,9 +23,9 @@
using namespace NEO;
using MemoryManagerMultiDeviceTest = Test<MemoryAllocatorMultiDeviceFixture<10>>;
using MemoryManagerMultiDeviceTest = MemoryAllocatorMultiDeviceFixture<10>;
TEST_F(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGraphicsMemoryIsCalledThenGraphicsAllocationHasTheSameRootDeviceIndex) {
TEST_P(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGraphicsMemoryIsCalledThenGraphicsAllocationHasTheSameRootDeviceIndex) {
std::vector<GraphicsAllocation::AllocationType> allocationTypes{GraphicsAllocation::AllocationType::BUFFER,
GraphicsAllocation::AllocationType::KERNEL_ISA};
for (auto allocationType : allocationTypes) {
@@ -52,15 +52,19 @@ TEST_F(MemoryManagerMultiDeviceTest, givenRootDeviceIndexSpecifiedWhenAllocateGr
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)1u, properties, false);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
if (isOsAgnosticMemoryManager) {
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)1u, properties, false);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)1u, properties, true);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
gfxAllocation = memoryManager->createGraphicsAllocationFromSharedHandle((osHandle)1u, properties, true);
ASSERT_NE(gfxAllocation, nullptr);
EXPECT_EQ(rootDeviceIndex, gfxAllocation->getRootDeviceIndex());
memoryManager->freeGraphicsMemory(gfxAllocation);
}
}
}
}
INSTANTIATE_TEST_CASE_P(MemoryManagerType, MemoryManagerMultiDeviceTest, ::testing::Bool());

View File

@@ -18,6 +18,8 @@
#include "gtest/gtest.h"
#include <set>
using namespace NEO;
OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSystemInfo, uint64_t gpuAddressSpace);
@@ -183,7 +185,7 @@ TEST_F(DeviceFactoryTest, givenSetCommandStreamReceiverInAubModeForTgllpProductF
EXPECT_FALSE(rootDeviceEnvironment->localMemoryEnabledReceived);
}
TEST_F(DeviceFactoryTest, givenSetCommandStreamReceiverInAubModeWhenGetDevicesForProductFamilyOverrideIsCalledThenAllAubCentersAreInitializedCorrectly) {
TEST_F(DeviceFactoryTest, givenSetCommandStreamReceiverInAubModeWhenGetDevicesForProductFamilyOverrideIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
DeviceFactoryCleaner cleaner;
DebugManagerStateRestore stateRestore;
auto requiredDeviceCount = 2u;
@@ -198,10 +200,40 @@ TEST_F(DeviceFactoryTest, givenSetCommandStreamReceiverInAubModeWhenGetDevicesFo
ASSERT_TRUE(success);
EXPECT_EQ(requiredDeviceCount, numDevices);
std::set<MemoryOperationsHandler *> memoryOperationHandlers;
for (auto rootDeviceIndex = 0u; rootDeviceIndex < requiredDeviceCount; rootDeviceIndex++) {
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get());
EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled);
EXPECT_FALSE(rootDeviceEnvironment->localMemoryEnabledReceived);
auto memoryOperationInterface = rootDeviceEnvironment->memoryOperationsInterface.get();
EXPECT_NE(nullptr, memoryOperationInterface);
EXPECT_EQ(memoryOperationHandlers.end(), memoryOperationHandlers.find(memoryOperationInterface));
memoryOperationHandlers.insert(memoryOperationInterface);
}
}
TEST_F(DeviceFactoryTest, whenGetDevicesIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
DeviceFactoryCleaner cleaner;
DebugManagerStateRestore stateRestore;
auto requiredDeviceCount = 2u;
DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount);
MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount);
size_t numDevices = 0;
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
ASSERT_TRUE(success);
EXPECT_EQ(requiredDeviceCount, numDevices);
std::set<MemoryOperationsHandler *> memoryOperationHandlers;
for (auto rootDeviceIndex = 0u; rootDeviceIndex < requiredDeviceCount; rootDeviceIndex++) {
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get());
auto memoryOperationInterface = rootDeviceEnvironment->memoryOperationsInterface.get();
EXPECT_NE(nullptr, memoryOperationInterface);
EXPECT_EQ(memoryOperationHandlers.end(), memoryOperationHandlers.find(memoryOperationInterface));
memoryOperationHandlers.insert(memoryOperationInterface);
}
}
@@ -224,4 +256,4 @@ TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAlloca
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
EXPECT_TRUE(success);
EXPECT_NE(nullptr, executionEnvironment->osInterface);
}
}

View File

@@ -5,8 +5,8 @@
*
*/
#include "core/execution_environment/root_device_environment.h"
#include "core/unit_tests/helpers/debug_manager_state_restore.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/os_interface/linux/drm_command_stream.h"
#include "runtime/os_interface/linux/drm_memory_manager.h"
#include "runtime/os_interface/linux/drm_memory_operations_handler.h"
@@ -30,7 +30,8 @@ HWTEST_F(DrmCommandStreamMMTest, MMwithPinBB) {
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(&mock);
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
executionEnvironment.prepareRootDeviceEnvironments(1u);
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
DrmCommandStreamReceiver<FamilyType> csr(executionEnvironment, 0, gemCloseWorkerMode::gemCloseWorkerInactive);

View File

@@ -71,7 +71,7 @@ class DrmGemCloseWorkerFixture {
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(drmMock);
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
this->mm = new DrmMemoryManager(gemCloseWorkerMode::gemCloseWorkerInactive,
false,

View File

@@ -26,7 +26,7 @@ class DrmMemoryManagerBasic : public ::testing::Test {
void SetUp() override {
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setDrm(Drm::get(0));
executionEnvironment.memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<DrmMemoryOperationsHandler>();
}
MockExecutionEnvironment executionEnvironment;

View File

@@ -822,7 +822,7 @@ HWTEST_F(WddmSimpleTest, givenDefaultWddmCsrWhenItIsCreatedThenBatchingIsTurnedO
auto wddm = Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get());
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
std::unique_ptr<MockWddmCsr<FamilyType>> mockCsr(new MockWddmCsr<FamilyType>(*executionEnvironment, 0));
EXPECT_EQ(DispatchMode::BatchedDispatch, mockCsr->dispatchMode);
}
@@ -831,7 +831,7 @@ HWTEST_F(WddmDefaultTest, givenFtrWddmHwQueuesFlagWhenCreatingCsrThenPickWddmVer
auto wddm = Wddm::createWddm(*pDevice->executionEnvironment->rootDeviceEnvironments[0].get());
pDevice->executionEnvironment->osInterface = std::make_unique<OSInterface>();
pDevice->executionEnvironment->osInterface->get()->setWddm(wddm);
pDevice->executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
pDevice->executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
WddmCommandStreamReceiver<FamilyType> wddmCsr(*pDevice->executionEnvironment, 0);
auto wddmFromCsr = wddmCsr.peekWddm();

View File

@@ -8,6 +8,7 @@
#pragma once
#include "core/command_stream/preemption.h"
#include "core/execution_environment/root_device_environment.h"
#include "core/helpers/hw_helper.h"
#include "runtime/execution_environment/execution_environment.h"
#include "runtime/os_interface/windows/gdi_interface.h"
@@ -31,7 +32,7 @@ struct WddmFixture : ::testing::Test {
wddm = static_cast<WddmMock *>(Wddm::createWddm(*executionEnvironment->rootDeviceEnvironments[0].get()));
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
osInterface = executionEnvironment->osInterface.get();
gdi = new MockGdi();
wddm->gdi.reset(gdi);
@@ -60,7 +61,7 @@ struct WddmFixtureWithMockGdiDll : public GdiDllFixture {
wddm->wddmInterface.reset(wddmMockInterface);
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
osInterface = executionEnvironment->osInterface.get();
}

View File

@@ -49,7 +49,7 @@ void WddmMemoryManagerFixture::SetUp() {
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
}
@@ -1305,7 +1305,7 @@ TEST(WddmMemoryManagerDefaults, givenDefaultWddmMemoryManagerWhenItIsQueriedForI
auto executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 1);
auto wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[0].get());
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
auto hwInfoMock = *platformDevices[0];
wddm->init(hwInfoMock);
MockWddmMemoryManager memoryManager(*executionEnvironment);
@@ -1657,7 +1657,7 @@ TEST(WddmMemoryManagerCleanupTest, givenUsedTagAllocationInWddmMemoryManagerWhen
executionEnvironment.osInterface = std::make_unique<OSInterface>();
executionEnvironment.osInterface->get()->setWddm(wddm);
executionEnvironment.memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment.rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment.memoryManager = std::make_unique<WddmMemoryManager>(executionEnvironment);
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csr.get(), aub_stream::ENGINE_RCS, 1, preemptionMode, false);
csr->setupContext(*osContext);

View File

@@ -57,7 +57,7 @@ class MockWddmMemoryManagerFixture {
executionEnvironment->osInterface.reset(new OSInterface());
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0],
@@ -104,7 +104,7 @@ class WddmMemoryManagerFixtureWithGmockWddm : public ExecutionEnvironmentFixture
auto hwInfo = *platformDevices[0];
wddm->init(hwInfo);
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
osInterface = executionEnvironment->osInterface.get();
memoryManager = new (std::nothrow) MockWddmMemoryManager(*executionEnvironment);
//assert we have memory manager
@@ -166,7 +166,7 @@ class MockWddmMemoryManagerTest : public ::testing::Test {
executionEnvironment = getExecutionEnvironmentImpl(hwInfo, 2);
wddm = new WddmMock(*executionEnvironment->rootDeviceEnvironments[1].get());
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
}
HardwareInfo *hwInfo;

View File

@@ -121,7 +121,7 @@ struct WddmResidencyControllerWithMockWddmTest : public WddmResidencyControllerT
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0], 1, preemptionMode, false);
@@ -154,7 +154,7 @@ struct WddmResidencyControllerWithGdiAndMemoryManagerTest : ::testing::Test {
executionEnvironment->osInterface = std::make_unique<OSInterface>();
executionEnvironment->osInterface->get()->setWddm(wddm);
executionEnvironment->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
executionEnvironment->rootDeviceEnvironments[0]->memoryOperationsInterface = std::make_unique<WddmMemoryOperationsHandler>(wddm);
memoryManager = std::make_unique<MockWddmMemoryManager>(*executionEnvironment);
osContext = memoryManager->createAndRegisterOsContext(nullptr, HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0],