2018-11-11 05:25:48 +08:00
|
|
|
/*
|
2020-01-30 16:36:05 +08:00
|
|
|
* Copyright (C) 2018-2020 Intel Corporation
|
2018-11-11 05:25:48 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
|
|
|
#include "shared/source/helpers/hw_helper.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2020-02-23 22:20:22 +08:00
|
|
|
#include "opencl/test/unit_test/fixtures/mock_aub_center_fixture.h"
|
2019-02-08 22:08:35 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-11-15 16:59:48 +08:00
|
|
|
|
|
|
|
struct MockRootDeviceEnvironment : public RootDeviceEnvironment {
|
|
|
|
using RootDeviceEnvironment::RootDeviceEnvironment;
|
|
|
|
|
|
|
|
~MockRootDeviceEnvironment() override = default;
|
|
|
|
|
2019-01-23 18:59:54 +08:00
|
|
|
void initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) override {
|
2019-02-21 04:48:06 +08:00
|
|
|
if (!initAubCenterCalled) {
|
|
|
|
initAubCenterCalled = true;
|
|
|
|
localMemoryEnabledReceived = localMemoryEnabled;
|
|
|
|
aubFileNameReceived = aubFileName;
|
|
|
|
}
|
2019-03-19 18:57:45 +08:00
|
|
|
if (useMockAubCenter) {
|
2019-11-15 16:59:48 +08:00
|
|
|
MockAubCenterFixture::setMockAubCenter(*this);
|
2019-03-19 18:57:45 +08:00
|
|
|
}
|
2019-11-15 16:59:48 +08:00
|
|
|
RootDeviceEnvironment::initAubCenter(localMemoryEnabled, aubFileName, csrType);
|
2018-11-11 05:25:48 +08:00
|
|
|
}
|
|
|
|
bool initAubCenterCalled = false;
|
2018-11-26 06:58:12 +08:00
|
|
|
bool localMemoryEnabledReceived = false;
|
|
|
|
std::string aubFileNameReceived = "";
|
2019-03-19 18:57:45 +08:00
|
|
|
bool useMockAubCenter = true;
|
2019-07-24 20:07:14 +08:00
|
|
|
};
|
2019-11-15 16:59:48 +08:00
|
|
|
|
|
|
|
struct MockExecutionEnvironment : ExecutionEnvironment {
|
|
|
|
~MockExecutionEnvironment() override = default;
|
2020-03-23 17:23:43 +08:00
|
|
|
MockExecutionEnvironment() : MockExecutionEnvironment(defaultHwInfo.get()) {}
|
2019-11-15 16:59:48 +08:00
|
|
|
MockExecutionEnvironment(const HardwareInfo *hwInfo) : MockExecutionEnvironment(hwInfo, true, 1u) {
|
|
|
|
}
|
|
|
|
MockExecutionEnvironment(const HardwareInfo *hwInfo, bool useMockAubCenter, uint32_t numRootDevices) {
|
|
|
|
prepareRootDeviceEnvironments(numRootDevices);
|
|
|
|
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
|
|
|
auto rootDeviceEnvironment = new MockRootDeviceEnvironment(*this);
|
|
|
|
rootDeviceEnvironment->useMockAubCenter = useMockAubCenter;
|
|
|
|
rootDeviceEnvironments[rootDeviceIndex].reset(rootDeviceEnvironment);
|
|
|
|
|
2020-03-04 15:51:02 +08:00
|
|
|
if (hwInfo) {
|
|
|
|
rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(hwInfo);
|
|
|
|
} else {
|
2020-03-23 17:23:43 +08:00
|
|
|
rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
|
2020-03-04 15:51:02 +08:00
|
|
|
}
|
2019-11-15 16:59:48 +08:00
|
|
|
}
|
2020-03-04 15:51:02 +08:00
|
|
|
|
2019-12-24 16:59:49 +08:00
|
|
|
calculateMaxOsContextCount();
|
2019-11-15 16:59:48 +08:00
|
|
|
}
|
2020-02-25 23:38:47 +08:00
|
|
|
void initGmm() {
|
|
|
|
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
|
|
|
|
rootDeviceEnvironment->initGmm();
|
|
|
|
}
|
|
|
|
}
|
2019-11-15 16:59:48 +08:00
|
|
|
};
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|