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