2019-10-24 19:34:25 +08:00
|
|
|
/*
|
2021-01-27 21:31:29 +08:00
|
|
|
* Copyright (C) 2019-2021 Intel Corporation
|
2019-10-24 19:34:25 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2019-10-24 19:34:25 +08:00
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
#include "shared/source/ail/ail_configuration.h"
|
2020-10-16 18:10:52 +08:00
|
|
|
#include "shared/source/aub/aub_center.h"
|
2020-02-27 22:32:57 +08: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 15:56:55 +08:00
|
|
|
#include "shared/source/debugger/debugger.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2020-02-25 01:04:30 +08:00
|
|
|
#include "shared/source/gmm_helper/gmm_helper.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/gmm_helper/page_table_mngr.h"
|
2020-03-04 15:51:02 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2021-01-27 21:31:29 +08:00
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/memory_manager/memory_operations_handler.h"
|
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2021-09-24 18:51:57 +08:00
|
|
|
#include "shared/source/os_interface/os_time.h"
|
2021-01-26 19:22:10 +08:00
|
|
|
#include "shared/source/utilities/software_tags_manager.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2019-10-24 19:34:25 +08:00
|
|
|
namespace NEO {
|
|
|
|
|
2020-03-04 15:51:02 +08:00
|
|
|
RootDeviceEnvironment::RootDeviceEnvironment(ExecutionEnvironment &executionEnvironment) : executionEnvironment(executionEnvironment) {
|
|
|
|
hwInfo = std::make_unique<HardwareInfo>();
|
2021-01-26 19:22:10 +08:00
|
|
|
|
|
|
|
if (DebugManager.flags.EnableSWTags.get()) {
|
|
|
|
tagsManager = std::make_unique<SWTagsManager>();
|
|
|
|
}
|
2020-03-04 15:51:02 +08:00
|
|
|
}
|
|
|
|
|
2019-10-24 19:34:25 +08:00
|
|
|
RootDeviceEnvironment::~RootDeviceEnvironment() = default;
|
2019-11-15 16:59:48 +08:00
|
|
|
|
|
|
|
void RootDeviceEnvironment::initAubCenter(bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
|
|
|
|
if (!aubCenter) {
|
2021-03-05 19:14:21 +08:00
|
|
|
UNRECOVERABLE_IF(!getGmmHelper());
|
|
|
|
aubCenter.reset(new AubCenter(getHardwareInfo(), *gmmHelper, localMemoryEnabled, aubFileName, csrType));
|
2019-11-15 16:59:48 +08:00
|
|
|
}
|
|
|
|
}
|
2020-03-11 15:56:55 +08:00
|
|
|
|
|
|
|
void RootDeviceEnvironment::initDebugger() {
|
|
|
|
debugger = Debugger::create(hwInfo.get());
|
|
|
|
}
|
|
|
|
|
2020-01-30 22:04:19 +08:00
|
|
|
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
|
2020-03-04 15:51:02 +08: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 22:04:19 +08:00
|
|
|
}
|
2020-02-25 01:04:30 +08:00
|
|
|
|
|
|
|
GmmHelper *RootDeviceEnvironment::getGmmHelper() const {
|
2020-02-25 23:38:47 +08:00
|
|
|
return gmmHelper.get();
|
2020-02-25 01:04:30 +08:00
|
|
|
}
|
|
|
|
GmmClientContext *RootDeviceEnvironment::getGmmClientContext() const {
|
2020-02-25 23:38:47 +08:00
|
|
|
return gmmHelper->getClientContext();
|
2020-02-25 01:04:30 +08:00
|
|
|
}
|
2020-02-25 23:38:47 +08:00
|
|
|
|
2021-07-21 16:47:43 +08:00
|
|
|
bool RootDeviceEnvironment::initAilConfiguration() {
|
|
|
|
auto ailConfiguration = AILConfiguration::get(hwInfo->platform.eProductFamily);
|
|
|
|
|
|
|
|
if (ailConfiguration == nullptr) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto result = ailConfiguration->initProcessExecutableName();
|
|
|
|
if (result != true) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
ailConfiguration->apply(hwInfo->capabilityTable);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-02-25 23:38:47 +08:00
|
|
|
void RootDeviceEnvironment::initGmm() {
|
|
|
|
if (!gmmHelper) {
|
|
|
|
gmmHelper.reset(new GmmHelper(osInterface.get(), getHardwareInfo()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-24 18:51:57 +08:00
|
|
|
void RootDeviceEnvironment::initOsTime() {
|
|
|
|
if (!osTime) {
|
|
|
|
osTime = OSTime::create(osInterface.get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-27 21:31:29 +08:00
|
|
|
BindlessHeapsHelper *RootDeviceEnvironment::getBindlessHeapsHelper() const {
|
|
|
|
return bindlessHeapsHelper.get();
|
|
|
|
}
|
|
|
|
|
2021-10-05 18:30:14 +08:00
|
|
|
void RootDeviceEnvironment::createBindlessHeapsHelper(MemoryManager *memoryManager, bool availableDevices, uint32_t rootDeviceIndex, DeviceBitfield deviceBitfield) {
|
|
|
|
bindlessHeapsHelper = std::make_unique<BindlessHeapsHelper>(memoryManager, availableDevices, rootDeviceIndex, deviceBitfield);
|
2021-01-27 21:31:29 +08:00
|
|
|
}
|
|
|
|
|
2020-02-27 22:32:57 +08: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 19:34:25 +08:00
|
|
|
} // namespace NEO
|