2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2023-01-03 10:27:35 +00:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2021-12-31 13:56:03 +00:00
|
|
|
#include "shared/test/common/fixtures/memory_manager_fixture.h"
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/command_stream/preemption.h"
|
2023-02-01 16:23:01 +00:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/os_interface/os_context.h"
|
2023-01-13 15:18:40 +00:00
|
|
|
#include "shared/test/common/helpers/default_hw_info.h"
|
2021-08-11 17:36:00 +00:00
|
|
|
#include "shared/test/common/helpers/engine_descriptor_helper.h"
|
2021-10-12 16:42:24 +00:00
|
|
|
#include "shared/test/common/mocks/mock_csr.h"
|
2021-10-05 12:54:33 +00:00
|
|
|
#include "shared/test/common/mocks/mock_memory_manager.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
using namespace NEO;
|
2017-12-21 00:45:38 +01:00
|
|
|
|
2022-08-16 12:19:30 +00:00
|
|
|
void MemoryManagerWithCsrFixture::setUp() {
|
2019-11-15 09:59:48 +01:00
|
|
|
executionEnvironment.prepareRootDeviceEnvironments(1);
|
2023-01-03 10:27:35 +00:00
|
|
|
executionEnvironment.rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get());
|
2022-06-08 08:23:02 +00:00
|
|
|
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
|
2020-10-28 16:08:37 +01:00
|
|
|
csr = std::make_unique<MockCommandStreamReceiver>(this->executionEnvironment, 0, 1);
|
2018-10-26 11:05:31 +00:00
|
|
|
memoryManager = new MockMemoryManager(executionEnvironment);
|
2018-10-09 11:50:58 +02:00
|
|
|
executionEnvironment.memoryManager.reset(memoryManager);
|
2018-08-08 13:49:09 +02:00
|
|
|
csr->tagAddress = ¤tGpuTag;
|
2020-03-03 09:21:18 +01:00
|
|
|
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
|
2022-12-27 15:26:22 +00:00
|
|
|
auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[0]->getHelper<GfxCoreHelper>();
|
2023-01-25 16:13:28 +00:00
|
|
|
auto engine = gfxCoreHelper.getGpgpuEngineInstances(*executionEnvironment.rootDeviceEnvironments[0])[0];
|
2021-08-11 17:36:00 +00:00
|
|
|
auto osContext = memoryManager->createAndRegisterOsContext(csr.get(), EngineDescriptorHelper::getDefaultDescriptor({engine.first, EngineUsage::Regular},
|
|
|
|
|
PreemptionHelper::getDefaultPreemptionMode(*hwInfo)));
|
2019-02-18 13:59:16 +01:00
|
|
|
csr->setupContext(*osContext);
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|
|
|
|
|
|
2022-08-16 12:19:30 +00:00
|
|
|
void MemoryManagerWithCsrFixture::tearDown() {
|
2017-12-21 00:45:38 +01:00
|
|
|
}
|