2019-10-24 13:34:25 +02:00
|
|
|
/*
|
2019-12-30 14:40:24 +01:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-10-24 13:34:25 +02:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2019-10-24 13:34:25 +02:00
|
|
|
|
2020-02-27 15:32:57 +01:00
|
|
|
#include "shared/source/built_ins/built_ins.h"
|
|
|
|
|
#include "shared/source/compiler_interface/compiler_interface.h"
|
|
|
|
|
#include "shared/source/compiler_interface/default_cache_config.h"
|
2020-03-11 08:56:55 +01:00
|
|
|
#include "shared/source/debugger/debugger.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2020-02-24 18:04:30 +01:00
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/gmm_helper/page_table_mngr.h"
|
2020-03-04 08:51:02 +01:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/memory_manager/memory_operations_handler.h"
|
|
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2020-02-22 22:50:57 +01:00
|
|
|
#include "opencl/source/aub/aub_center.h"
|
2019-10-24 13:34:25 +02:00
|
|
|
|
|
|
|
|
namespace NEO {
|
|
|
|
|
|
2020-03-04 08:51:02 +01:00
|
|
|
RootDeviceEnvironment::RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment) {
|
|
|
|
|
hwInfo = std::make_unique<HardwareInfo>();
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-24 13:34:25 +02:00
|
|
|
RootDeviceEnvironment::~RootDeviceEnvironment() = default;
|
2019-11-15 09:59:48 +01:00
|
|
|
|
|
|
|
|
void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
|
|
|
|
if (!aubCenter) {
|
2020-02-12 11:27:28 +01:00
|
|
|
aubCenter.reset(new AubCenter(getHardwareInfo(), localMemoryEnabled, aubFileName, csrType));
|
2019-11-15 09:59:48 +01:00
|
|
|
}
|
|
|
|
|
}
|
2020-03-11 08:56:55 +01:00
|
|
|
|
|
|
|
|
void RootDeviceEnvironment::initDebugger() {
|
|
|
|
|
debugger = Debugger::create(hwInfo.get());
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-30 15:04:19 +01:00
|
|
|
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
|
2020-03-04 08:51:02 +01:00
|
|
|
return hwInfo.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HardwareInfo *RootDeviceEnvironment::getMutableHardwareInfo() const {
|
|
|
|
|
return hwInfo.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RootDeviceEnvironment::setHwInfo(const HardwareInfo *hwInfo) {
|
|
|
|
|
*this->hwInfo = *hwInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool RootDeviceEnvironment::isFullRangeSvm() const {
|
|
|
|
|
return hwInfo->capabilityTable.gpuAddressSpace >= maxNBitValue(47);
|
2020-01-30 15:04:19 +01:00
|
|
|
}
|
2020-02-24 18:04:30 +01:00
|
|
|
|
|
|
|
|
GmmHelper *RootDeviceEnvironment::getGmmHelper() const {
|
2020-02-25 16:38:47 +01:00
|
|
|
return gmmHelper.get();
|
2020-02-24 18:04:30 +01:00
|
|
|
}
|
|
|
|
|
GmmClientContext *RootDeviceEnvironment::getGmmClientContext() const {
|
2020-02-25 16:38:47 +01:00
|
|
|
return gmmHelper->getClientContext();
|
2020-02-24 18:04:30 +01:00
|
|
|
}
|
2020-02-25 16:38:47 +01:00
|
|
|
|
|
|
|
|
void RootDeviceEnvironment::initGmm() {
|
|
|
|
|
if (!gmmHelper) {
|
|
|
|
|
gmmHelper.reset(new GmmHelper(osInterface.get(), getHardwareInfo()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-27 15:32:57 +01:00
|
|
|
CompilerInterface *RootDeviceEnvironment::getCompilerInterface() {
|
|
|
|
|
if (this->compilerInterface.get() == nullptr) {
|
|
|
|
|
std::lock_guard<std::mutex> autolock(this->mtx);
|
|
|
|
|
if (this->compilerInterface.get() == nullptr) {
|
|
|
|
|
auto cache = std::make_unique<CompilerCache>(getDefaultCompilerCacheConfig());
|
|
|
|
|
this->compilerInterface.reset(CompilerInterface::createInstance(std::move(cache), true));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this->compilerInterface.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BuiltIns *RootDeviceEnvironment::getBuiltIns() {
|
|
|
|
|
if (this->builtins.get() == nullptr) {
|
|
|
|
|
std::lock_guard<std::mutex> autolock(this->mtx);
|
|
|
|
|
if (this->builtins.get() == nullptr) {
|
|
|
|
|
this->builtins = std::make_unique<BuiltIns>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return this->builtins.get();
|
|
|
|
|
}
|
2019-10-24 13:34:25 +02:00
|
|
|
} // namespace NEO
|