Calculate a maxOsContextCount variable

Change-Id: I7b2f7733be74abf4ae299396d616b249b67de58e
Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
Jobczyk, Lukasz
2019-12-17 08:11:16 +01:00
committed by sys_ocldev
parent 1021d8c6d2
commit eac48002ab
30 changed files with 110 additions and 64 deletions

View File

@@ -15,6 +15,7 @@
#include "runtime/built_ins/built_ins.h"
#include "runtime/command_stream/tbx_command_stream_receiver_hw.h"
#include "runtime/compiler_interface/default_cl_cache_config.h"
#include "runtime/helpers/device_helpers.h"
#include "runtime/memory_manager/memory_manager.h"
#include "runtime/os_interface/os_interface.h"
#include "runtime/source_level_debugger/source_level_debugger.h"
@@ -36,9 +37,11 @@ void ExecutionEnvironment::initGmm() {
gmmHelper.reset(new GmmHelper(osInterface.get(), hwInfo.get()));
}
}
void ExecutionEnvironment::setHwInfo(const HardwareInfo *hwInfo) {
*this->hwInfo = *hwInfo;
}
void ExecutionEnvironment::initializeMemoryManager() {
if (this->memoryManager) {
return;
@@ -65,6 +68,7 @@ void ExecutionEnvironment::initializeMemoryManager() {
}
DEBUG_BREAK_IF(!this->memoryManager);
}
void ExecutionEnvironment::initSourceLevelDebugger() {
if (hwInfo->capabilityTable.sourceLevelDebuggerSupported) {
sourceLevelDebugger.reset(SourceLevelDebugger::create());
@@ -74,9 +78,20 @@ void ExecutionEnvironment::initSourceLevelDebugger() {
sourceLevelDebugger->initialize(localMemorySipAvailable);
}
}
void ExecutionEnvironment::calculateMaxOsContextCount() {
auto &hwHelper = HwHelper::get(this->hwInfo->platform.eRenderCoreFamily);
auto osContextCount = hwHelper.getGpgpuEngineInstances().size();
auto subDevicesCount = DeviceHelper::getSubDevicesCount(this->getHardwareInfo());
bool hasRootCsr = subDevicesCount > 1;
MemoryManager::maxOsContextCount = static_cast<uint32_t>(osContextCount * subDevicesCount * this->rootDeviceEnvironments.size() + hasRootCsr);
}
GmmHelper *ExecutionEnvironment::getGmmHelper() const {
return gmmHelper.get();
}
CompilerInterface *ExecutionEnvironment::getCompilerInterface() {
if (this->compilerInterface.get() == nullptr) {
std::lock_guard<std::mutex> autolock(this->mtx);
@@ -87,6 +102,7 @@ CompilerInterface *ExecutionEnvironment::getCompilerInterface() {
}
return this->compilerInterface.get();
}
BuiltIns *ExecutionEnvironment::getBuiltIns() {
if (this->builtins.get() == nullptr) {
std::lock_guard<std::mutex> autolock(this->mtx);
@@ -110,5 +126,6 @@ void ExecutionEnvironment::prepareRootDeviceEnvironments(uint32_t numRootDevices
rootDeviceEnvironments[rootDeviceIndex] = std::make_unique<RootDeviceEnvironment>(*this);
}
}
calculateMaxOsContextCount();
}
} // namespace NEO

View File

@@ -39,6 +39,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
void initGmm();
void initializeMemoryManager();
void initSourceLevelDebugger();
void calculateMaxOsContextCount();
void setHwInfo(const HardwareInfo *hwInfo);
const HardwareInfo *getHardwareInfo() const { return hwInfo.get(); }
HardwareInfo *getMutableHardwareInfo() const { return hwInfo.get(); }