mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
Initialize root command stream receiver
Change-Id: I90c4ee9c0e24b1f9182f100213bf6a1ec70df3a8 Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
79630bb5ac
commit
39cb48024a
@@ -18,7 +18,6 @@ set(RUNTIME_SRCS_DEVICE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/driver_info.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/root_device.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/root_device.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}${BRANCH_DIR_SUFFIX}/root_device_initialize.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/sub_device.h
|
||||
)
|
||||
|
||||
@@ -7,11 +7,16 @@
|
||||
|
||||
#include "runtime/device/root_device.h"
|
||||
|
||||
#include "core/command_stream/preemption.h"
|
||||
#include "core/debug_settings/debug_settings_manager.h"
|
||||
#include "core/helpers/hw_helper.h"
|
||||
#include "runtime/command_stream/command_stream_receiver.h"
|
||||
#include "runtime/device/sub_device.h"
|
||||
#include "runtime/memory_manager/memory_manager.h"
|
||||
|
||||
namespace NEO {
|
||||
extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
||||
|
||||
RootDevice::RootDevice(ExecutionEnvironment *executionEnvironment, uint32_t rootDeviceIndex) : Device(executionEnvironment), rootDeviceIndex(rootDeviceIndex) {}
|
||||
|
||||
RootDevice::~RootDevice() {
|
||||
@@ -80,9 +85,28 @@ DeviceBitfield RootDevice::getDeviceBitfield() const {
|
||||
}
|
||||
|
||||
bool RootDevice::createEngines() {
|
||||
if (!initializeRootCommandStreamReceiver()) {
|
||||
if (getNumSubDevices() < 2) {
|
||||
return Device::createEngines();
|
||||
} else {
|
||||
initializeRootCommandStreamReceiver();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void RootDevice::initializeRootCommandStreamReceiver() {
|
||||
std::unique_ptr<CommandStreamReceiver> rootCommandStreamReceiver(createCommandStream(*executionEnvironment, rootDeviceIndex));
|
||||
|
||||
auto &hwInfo = getHardwareInfo();
|
||||
auto defaultEngineType = getChosenEngineType(hwInfo);
|
||||
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(hwInfo);
|
||||
|
||||
auto osContext = getMemoryManager()->createAndRegisterOsContext(rootCommandStreamReceiver.get(), defaultEngineType,
|
||||
getDeviceBitfield(), preemptionMode, false);
|
||||
|
||||
rootCommandStreamReceiver->setupContext(*osContext);
|
||||
rootCommandStreamReceiver->initializeTagAllocation();
|
||||
commandStreamReceivers.push_back(std::move(rootCommandStreamReceiver));
|
||||
engines.emplace_back(commandStreamReceivers.back().get(), osContext);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -28,7 +28,7 @@ class RootDevice : public Device {
|
||||
DeviceBitfield getDeviceBitfield() const override;
|
||||
bool createEngines() override;
|
||||
|
||||
MOCKABLE_VIRTUAL bool initializeRootCommandStreamReceiver();
|
||||
void initializeRootCommandStreamReceiver();
|
||||
MOCKABLE_VIRTUAL SubDevice *createSubDevice(uint32_t subDeviceIndex);
|
||||
|
||||
std::vector<SubDevice *> subdevices;
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "runtime/device/root_device.h"
|
||||
|
||||
namespace NEO {
|
||||
bool RootDevice::initializeRootCommandStreamReceiver() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
@@ -77,9 +77,10 @@ void ExecutionEnvironment::calculateMaxOsContextCount() {
|
||||
auto &hwHelper = HwHelper::get(this->hwInfo->platform.eRenderCoreFamily);
|
||||
auto osContextCount = hwHelper.getGpgpuEngineInstances().size();
|
||||
auto subDevicesCount = HwHelper::getSubDevicesCount(this->getHardwareInfo());
|
||||
auto rootDevicesCount = this->rootDeviceEnvironments.size();
|
||||
bool hasRootCsr = subDevicesCount > 1;
|
||||
|
||||
MemoryManager::maxOsContextCount = static_cast<uint32_t>(osContextCount * subDevicesCount * this->rootDeviceEnvironments.size() + hasRootCsr);
|
||||
MemoryManager::maxOsContextCount = static_cast<uint32_t>(rootDevicesCount * (osContextCount * subDevicesCount + hasRootCsr));
|
||||
}
|
||||
|
||||
GmmHelper *ExecutionEnvironment::getGmmHelper() const {
|
||||
|
||||
Reference in New Issue
Block a user