2018-06-22 18:54:33 +08:00
|
|
|
/*
|
2023-01-10 01:14:18 +08:00
|
|
|
* Copyright (C) 2018-2023 Intel Corporation
|
2018-09-20 11:54:29 +08:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
2018-06-27 17:35:37 +08:00
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/execution_environment.h"
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2020-12-02 18:22:27 +08:00
|
|
|
#include "shared/source/built_ins/built_ins.h"
|
2021-04-16 20:52:30 +08:00
|
|
|
#include "shared/source/built_ins/sip.h"
|
2022-12-16 00:01:37 +08:00
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
2021-07-30 17:56:58 +08:00
|
|
|
#include "shared/source/direct_submission/direct_submission_controller.h"
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/execution_environment/root_device_environment.h"
|
2021-05-05 16:07:53 +08:00
|
|
|
#include "shared/source/helpers/affinity_mask.h"
|
2023-01-10 01:14:18 +08:00
|
|
|
#include "shared/source/helpers/driver_model_type.h"
|
2023-02-02 00:23:01 +08:00
|
|
|
#include "shared/source/helpers/gfx_core_helper.h"
|
2022-12-06 19:19:36 +08:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2021-05-06 00:00:12 +08:00
|
|
|
#include "shared/source/helpers/string_helpers.h"
|
2020-03-19 21:26:08 +08:00
|
|
|
#include "shared/source/memory_manager/memory_manager.h"
|
2020-11-02 22:54:01 +08:00
|
|
|
#include "shared/source/memory_manager/os_agnostic_memory_manager.h"
|
2023-06-13 23:19:02 +08:00
|
|
|
#include "shared/source/os_interface/driver_info.h"
|
2020-03-17 14:26:46 +08:00
|
|
|
#include "shared/source/os_interface/os_environment.h"
|
2021-05-21 07:17:57 +08:00
|
|
|
#include "shared/source/os_interface/os_interface.h"
|
2023-03-10 20:28:11 +08:00
|
|
|
#include "shared/source/os_interface/product_helper.h"
|
2021-03-31 02:11:00 +08:00
|
|
|
#include "shared/source/utilities/wait_util.h"
|
2020-02-24 17:22:30 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2021-03-31 02:11:00 +08:00
|
|
|
ExecutionEnvironment::ExecutionEnvironment() {
|
|
|
|
WaitUtils::init();
|
2022-10-26 20:41:36 +08:00
|
|
|
this->configureNeoEnvironment();
|
2021-03-31 02:11:00 +08:00
|
|
|
}
|
2019-05-06 18:33:44 +08:00
|
|
|
|
2021-10-11 23:34:03 +08:00
|
|
|
void ExecutionEnvironment::releaseRootDeviceEnvironmentResources(RootDeviceEnvironment *rootDeviceEnvironment) {
|
|
|
|
if (rootDeviceEnvironment == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SipKernel::freeSipKernels(rootDeviceEnvironment, memoryManager.get());
|
|
|
|
if (rootDeviceEnvironment->builtins.get()) {
|
2022-05-10 00:21:21 +08:00
|
|
|
rootDeviceEnvironment->builtins->freeSipKernels(memoryManager.get());
|
2021-10-11 23:34:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-24 19:34:25 +08:00
|
|
|
ExecutionEnvironment::~ExecutionEnvironment() {
|
2020-02-12 00:48:40 +08:00
|
|
|
if (memoryManager) {
|
|
|
|
memoryManager->commonCleanup();
|
2020-12-02 18:22:27 +08:00
|
|
|
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
|
2021-10-11 23:34:03 +08:00
|
|
|
releaseRootDeviceEnvironmentResources(rootDeviceEnvironment.get());
|
2020-12-02 18:22:27 +08:00
|
|
|
}
|
2020-02-12 00:48:40 +08:00
|
|
|
}
|
2019-10-24 19:34:25 +08:00
|
|
|
rootDeviceEnvironments.clear();
|
|
|
|
}
|
2018-07-16 23:11:43 +08:00
|
|
|
|
2020-09-18 22:19:41 +08:00
|
|
|
bool ExecutionEnvironment::initializeMemoryManager() {
|
2018-07-17 17:11:48 +08:00
|
|
|
if (this->memoryManager) {
|
2020-09-18 22:19:41 +08:00
|
|
|
return memoryManager->isInitialized();
|
2018-07-17 17:11:48 +08:00
|
|
|
}
|
2018-07-20 15:01:58 +08:00
|
|
|
|
2019-02-19 15:55:11 +08:00
|
|
|
int32_t setCommandStreamReceiverType = CommandStreamReceiverType::CSR_HW;
|
|
|
|
if (DebugManager.flags.SetCommandStreamReceiver.get() >= 0) {
|
|
|
|
setCommandStreamReceiverType = DebugManager.flags.SetCommandStreamReceiver.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (setCommandStreamReceiverType) {
|
|
|
|
case CommandStreamReceiverType::CSR_TBX:
|
|
|
|
case CommandStreamReceiverType::CSR_TBX_WITH_AUB:
|
|
|
|
case CommandStreamReceiverType::CSR_AUB:
|
2019-03-15 17:22:35 +08:00
|
|
|
memoryManager = std::make_unique<OsAgnosticMemoryManager>(*this);
|
2019-02-19 15:55:11 +08:00
|
|
|
break;
|
|
|
|
case CommandStreamReceiverType::CSR_HW:
|
|
|
|
case CommandStreamReceiverType::CSR_HW_WITH_AUB:
|
2021-05-25 23:37:44 +08:00
|
|
|
default: {
|
|
|
|
auto driverModelType = DriverModelType::UNKNOWN;
|
|
|
|
if (this->rootDeviceEnvironments[0]->osInterface && this->rootDeviceEnvironments[0]->osInterface->getDriverModel()) {
|
|
|
|
driverModelType = this->rootDeviceEnvironments[0]->osInterface->getDriverModel()->getDriverModelType();
|
|
|
|
}
|
|
|
|
memoryManager = MemoryManager::createMemoryManager(*this, driverModelType);
|
|
|
|
} break;
|
2019-02-19 15:55:11 +08:00
|
|
|
}
|
2020-09-18 22:19:41 +08:00
|
|
|
|
|
|
|
return memoryManager->isInitialized();
|
2018-07-16 23:11:43 +08:00
|
|
|
}
|
2019-12-17 15:11:16 +08:00
|
|
|
|
|
|
|
void ExecutionEnvironment::calculateMaxOsContextCount() {
|
2020-08-17 19:41:48 +08:00
|
|
|
MemoryManager::maxOsContextCount = 0u;
|
2020-02-12 18:27:28 +08:00
|
|
|
for (const auto &rootDeviceEnvironment : this->rootDeviceEnvironments) {
|
2020-02-21 22:25:04 +08:00
|
|
|
auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
|
2022-12-08 20:22:35 +08:00
|
|
|
auto &gfxCoreHelper = rootDeviceEnvironment->getHelper<GfxCoreHelper>();
|
2023-01-26 00:13:28 +08:00
|
|
|
auto osContextCount = static_cast<uint32_t>(gfxCoreHelper.getGpgpuEngineInstances(*rootDeviceEnvironment).size());
|
2022-12-08 20:22:35 +08:00
|
|
|
auto subDevicesCount = GfxCoreHelper::getSubDevicesCount(hwInfo);
|
2021-08-31 01:05:59 +08:00
|
|
|
auto ccsCount = hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled;
|
2020-02-12 18:27:28 +08:00
|
|
|
bool hasRootCsr = subDevicesCount > 1;
|
2019-12-17 15:11:16 +08:00
|
|
|
|
2021-08-31 01:05:59 +08:00
|
|
|
MemoryManager::maxOsContextCount += osContextCount * subDevicesCount + hasRootCsr;
|
|
|
|
|
|
|
|
if (ccsCount > 1 && DebugManager.flags.EngineInstancedSubDevices.get()) {
|
|
|
|
MemoryManager::maxOsContextCount += ccsCount * subDevicesCount;
|
|
|
|
}
|
2020-02-12 18:27:28 +08:00
|
|
|
}
|
2019-12-17 15:11:16 +08:00
|
|
|
}
|
|
|
|
|
2021-10-25 23:33:38 +08:00
|
|
|
DirectSubmissionController *ExecutionEnvironment::initializeDirectSubmissionController() {
|
|
|
|
auto initializeDirectSubmissionController = DirectSubmissionController::isSupported();
|
2021-07-30 17:56:58 +08:00
|
|
|
|
2022-02-28 20:03:29 +08:00
|
|
|
if (DebugManager.flags.SetCommandStreamReceiver.get() > 0) {
|
|
|
|
initializeDirectSubmissionController = false;
|
|
|
|
}
|
|
|
|
|
2021-07-30 17:56:58 +08:00
|
|
|
if (DebugManager.flags.EnableDirectSubmissionController.get() != -1) {
|
|
|
|
initializeDirectSubmissionController = DebugManager.flags.EnableDirectSubmissionController.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (initializeDirectSubmissionController && this->directSubmissionController == nullptr) {
|
|
|
|
this->directSubmissionController = std::make_unique<DirectSubmissionController>();
|
|
|
|
}
|
|
|
|
|
|
|
|
return directSubmissionController.get();
|
|
|
|
}
|
|
|
|
|
2019-11-15 16:59:48 +08:00
|
|
|
void ExecutionEnvironment::prepareRootDeviceEnvironments(uint32_t numRootDevices) {
|
|
|
|
if (rootDeviceEnvironments.size() < numRootDevices) {
|
|
|
|
rootDeviceEnvironments.resize(numRootDevices);
|
|
|
|
}
|
|
|
|
for (auto rootDeviceIndex = 0u; rootDeviceIndex < numRootDevices; rootDeviceIndex++) {
|
|
|
|
if (!rootDeviceEnvironments[rootDeviceIndex]) {
|
|
|
|
rootDeviceEnvironments[rootDeviceIndex] = std::make_unique<RootDeviceEnvironment>(*this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-06 00:00:12 +08:00
|
|
|
|
2022-05-17 23:23:15 +08:00
|
|
|
void ExecutionEnvironment::prepareForCleanup() const {
|
|
|
|
for (auto &rootDeviceEnvironment : rootDeviceEnvironments) {
|
|
|
|
if (rootDeviceEnvironment) {
|
|
|
|
rootDeviceEnvironment->prepareForCleanup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-11 23:34:03 +08:00
|
|
|
void ExecutionEnvironment::prepareRootDeviceEnvironment(const uint32_t rootDeviceIndexForReInit) {
|
|
|
|
rootDeviceEnvironments[rootDeviceIndexForReInit] = std::make_unique<RootDeviceEnvironment>(*this);
|
|
|
|
}
|
|
|
|
|
2021-01-25 17:24:00 +08:00
|
|
|
void ExecutionEnvironment::parseAffinityMask() {
|
2021-05-06 00:00:12 +08:00
|
|
|
const auto &affinityMaskString = DebugManager.flags.ZE_AFFINITY_MASK.get();
|
2021-01-25 17:24:00 +08:00
|
|
|
|
|
|
|
if (affinityMaskString.compare("default") == 0 ||
|
|
|
|
affinityMaskString.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
feature: Affinity mask plus ReturnSubDevicesAsApiDevices
When using ReturnSubDevicesAsApiDevices=1 to have
sub-devices-as-root-devices, then the driver should read the values
passed in the mask as those corresponding to the physical
sub-devices.
For instance, in a dual system with multi-tile device, we would have:
card 0, tile 0
card 0, tile 1
card 1, tile 0
card 1, tile 1
With:
ReturnSubDevicesAsApiDevices=0
ZE_AFFINITY_MASK=0,1
Then all tiles in card 0 and card 1 need to be exposed.
With:
ReturnSubDevicesAsApiDevices=1
ZE_AFFINITY_MASK=0,3
Then card 0 tile 0, and card 1 tile 1 need to be exposed.
Related-To: NEO-7137
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2023-02-02 10:54:47 +08:00
|
|
|
bool exposeSubDevicesAsApiDevices = false;
|
|
|
|
if (NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get() != -1) {
|
|
|
|
exposeSubDevicesAsApiDevices = NEO::DebugManager.flags.ReturnSubDevicesAsApiDevices.get();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t numRootDevices = static_cast<uint32_t>(rootDeviceEnvironments.size());
|
|
|
|
|
|
|
|
RootDeviceIndicesMap mapOfIndexes;
|
|
|
|
// Reserve at least for a size equal to rootDeviceEnvironments.size() times four,
|
|
|
|
// which is enough for typical configurations
|
|
|
|
size_t reservedSizeForIndices = numRootDevices * 4;
|
|
|
|
mapOfIndexes.reserve(reservedSizeForIndices);
|
|
|
|
if (exposeSubDevicesAsApiDevices) {
|
|
|
|
uint32_t currentDeviceIndex = 0;
|
|
|
|
for (uint32_t currentRootDevice = 0u; currentRootDevice < static_cast<uint32_t>(rootDeviceEnvironments.size()); currentRootDevice++) {
|
|
|
|
auto hwInfo = rootDeviceEnvironments[currentRootDevice]->getHardwareInfo();
|
|
|
|
auto subDevicesCount = GfxCoreHelper::getSubDevicesCount(hwInfo);
|
|
|
|
uint32_t currentSubDevice = 0;
|
|
|
|
mapOfIndexes[currentDeviceIndex++] = std::make_tuple(currentRootDevice, currentSubDevice);
|
|
|
|
for (currentSubDevice = 1; currentSubDevice < subDevicesCount; currentSubDevice++) {
|
|
|
|
mapOfIndexes[currentDeviceIndex++] = std::make_tuple(currentRootDevice, currentSubDevice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
numRootDevices = currentDeviceIndex;
|
|
|
|
UNRECOVERABLE_IF(numRootDevices > reservedSizeForIndices);
|
|
|
|
}
|
2021-05-05 16:07:53 +08:00
|
|
|
|
|
|
|
std::vector<AffinityMaskHelper> affinityMaskHelper(numRootDevices);
|
2021-01-25 17:24:00 +08:00
|
|
|
|
2021-05-06 00:00:12 +08:00
|
|
|
auto affinityMaskEntries = StringHelpers::split(affinityMaskString, ",");
|
|
|
|
|
|
|
|
for (const auto &entry : affinityMaskEntries) {
|
|
|
|
auto subEntries = StringHelpers::split(entry, ".");
|
|
|
|
uint32_t rootDeviceIndex = StringHelpers::toUint32t(subEntries[0]);
|
|
|
|
|
feature: Affinity mask plus ReturnSubDevicesAsApiDevices
When using ReturnSubDevicesAsApiDevices=1 to have
sub-devices-as-root-devices, then the driver should read the values
passed in the mask as those corresponding to the physical
sub-devices.
For instance, in a dual system with multi-tile device, we would have:
card 0, tile 0
card 0, tile 1
card 1, tile 0
card 1, tile 1
With:
ReturnSubDevicesAsApiDevices=0
ZE_AFFINITY_MASK=0,1
Then all tiles in card 0 and card 1 need to be exposed.
With:
ReturnSubDevicesAsApiDevices=1
ZE_AFFINITY_MASK=0,3
Then card 0 tile 0, and card 1 tile 1 need to be exposed.
Related-To: NEO-7137
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
2023-02-02 10:54:47 +08:00
|
|
|
// tiles as devices
|
|
|
|
if (exposeSubDevicesAsApiDevices) {
|
|
|
|
if (rootDeviceIndex > numRootDevices) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ReturnSubDevicesAsApiDevices not supported with AllowSingleTileEngineInstancedSubDevices
|
|
|
|
// so ignore X.Y
|
|
|
|
if (subEntries.size() > 1) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::tuple<uint32_t, uint32_t> indexKey = mapOfIndexes[rootDeviceIndex];
|
|
|
|
auto deviceIndex = std::get<0>(indexKey);
|
|
|
|
auto tileIndex = std::get<1>(indexKey);
|
|
|
|
affinityMaskHelper[deviceIndex].enableGenericSubDevice(tileIndex);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// cards as devices
|
2021-05-05 16:07:53 +08:00
|
|
|
if (rootDeviceIndex < numRootDevices) {
|
|
|
|
auto hwInfo = rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
|
2022-12-08 20:22:35 +08:00
|
|
|
auto subDevicesCount = GfxCoreHelper::getSubDevicesCount(hwInfo);
|
2021-05-05 16:07:53 +08:00
|
|
|
|
2021-05-06 19:33:39 +08:00
|
|
|
if (subEntries.size() > 1) {
|
2021-05-06 00:00:12 +08:00
|
|
|
uint32_t subDeviceIndex = StringHelpers::toUint32t(subEntries[1]);
|
2021-05-06 19:33:39 +08:00
|
|
|
|
2021-09-29 21:53:43 +08:00
|
|
|
bool enableSecondLevelEngineInstanced = ((subDevicesCount == 1) &&
|
|
|
|
(hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled > 1) &&
|
|
|
|
DebugManager.flags.AllowSingleTileEngineInstancedSubDevices.get());
|
|
|
|
|
|
|
|
if (enableSecondLevelEngineInstanced) {
|
|
|
|
UNRECOVERABLE_IF(subEntries.size() != 2);
|
|
|
|
|
|
|
|
if (subDeviceIndex < hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled) {
|
|
|
|
affinityMaskHelper[rootDeviceIndex].enableEngineInstancedSubDevice(0, subDeviceIndex); // Mask: X.Y
|
|
|
|
}
|
|
|
|
} else if (subDeviceIndex < subDevicesCount) {
|
2021-05-06 19:33:39 +08:00
|
|
|
if (subEntries.size() == 2) {
|
|
|
|
affinityMaskHelper[rootDeviceIndex].enableGenericSubDevice(subDeviceIndex); // Mask: X.Y
|
|
|
|
} else {
|
|
|
|
UNRECOVERABLE_IF(subEntries.size() != 3);
|
|
|
|
uint32_t ccsIndex = StringHelpers::toUint32t(subEntries[2]);
|
|
|
|
|
|
|
|
if (ccsIndex < hwInfo->gtSystemInfo.CCSInfo.NumberOfCCSEnabled) {
|
|
|
|
affinityMaskHelper[rootDeviceIndex].enableEngineInstancedSubDevice(subDeviceIndex, ccsIndex); // Mask: X.Y.Z
|
|
|
|
}
|
|
|
|
}
|
2021-01-25 17:24:00 +08:00
|
|
|
}
|
|
|
|
} else {
|
2021-05-06 19:33:39 +08:00
|
|
|
affinityMaskHelper[rootDeviceIndex].enableAllGenericSubDevices(subDevicesCount); // Mask: X
|
2021-01-25 17:24:00 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::vector<std::unique_ptr<RootDeviceEnvironment>> filteredEnvironments;
|
2021-05-05 16:07:53 +08:00
|
|
|
for (uint32_t i = 0u; i < numRootDevices; i++) {
|
|
|
|
if (!affinityMaskHelper[i].isDeviceEnabled()) {
|
2021-01-25 17:24:00 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-05-05 16:07:53 +08:00
|
|
|
rootDeviceEnvironments[i]->deviceAffinityMask = affinityMaskHelper[i];
|
2021-01-25 17:24:00 +08:00
|
|
|
filteredEnvironments.emplace_back(rootDeviceEnvironments[i].release());
|
|
|
|
}
|
|
|
|
|
|
|
|
rootDeviceEnvironments.swap(filteredEnvironments);
|
|
|
|
}
|
2022-07-25 20:13:27 +08:00
|
|
|
|
2022-09-22 16:48:55 +08:00
|
|
|
void ExecutionEnvironment::adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceEnvironment) const {
|
|
|
|
auto hwInfo = rootDeviceEnvironment->getMutableHardwareInfo();
|
2022-12-06 19:19:36 +08:00
|
|
|
auto &productHelper = rootDeviceEnvironment->getHelper<ProductHelper>();
|
|
|
|
productHelper.adjustNumberOfCcs(*hwInfo);
|
2022-09-22 16:48:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ExecutionEnvironment::adjustCcsCount() {
|
2022-07-25 20:13:27 +08:00
|
|
|
parseCcsCountLimitations();
|
|
|
|
|
2022-09-22 16:48:55 +08:00
|
|
|
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
|
|
|
|
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
2022-07-25 20:13:27 +08:00
|
|
|
UNRECOVERABLE_IF(!rootDeviceEnvironment);
|
|
|
|
if (!rootDeviceEnvironment->isNumberOfCcsLimited()) {
|
2022-09-22 16:48:55 +08:00
|
|
|
adjustCcsCountImpl(rootDeviceEnvironment.get());
|
2022-07-25 20:13:27 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-22 16:48:55 +08:00
|
|
|
void ExecutionEnvironment::adjustCcsCount(const uint32_t rootDeviceIndex) const {
|
|
|
|
auto &rootDeviceEnvironment = rootDeviceEnvironments[rootDeviceIndex];
|
|
|
|
UNRECOVERABLE_IF(!rootDeviceEnvironment);
|
|
|
|
if (rootDeviceNumCcsMap.find(rootDeviceIndex) != rootDeviceNumCcsMap.end()) {
|
|
|
|
rootDeviceEnvironment->limitNumberOfCcs(rootDeviceNumCcsMap.at(rootDeviceIndex));
|
|
|
|
} else {
|
|
|
|
adjustCcsCountImpl(rootDeviceEnvironment.get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExecutionEnvironment::parseCcsCountLimitations() {
|
2022-07-25 20:13:27 +08:00
|
|
|
const auto &numberOfCcsString = DebugManager.flags.ZEX_NUMBER_OF_CCS.get();
|
|
|
|
|
|
|
|
if (numberOfCcsString.compare("default") == 0 ||
|
|
|
|
numberOfCcsString.empty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const uint32_t numRootDevices = static_cast<uint32_t>(rootDeviceEnvironments.size());
|
|
|
|
|
|
|
|
auto numberOfCcsEntries = StringHelpers::split(numberOfCcsString, ",");
|
|
|
|
|
|
|
|
for (const auto &entry : numberOfCcsEntries) {
|
|
|
|
auto subEntries = StringHelpers::split(entry, ":");
|
|
|
|
uint32_t rootDeviceIndex = StringHelpers::toUint32t(subEntries[0]);
|
|
|
|
|
|
|
|
if (rootDeviceIndex < numRootDevices) {
|
|
|
|
if (subEntries.size() > 1) {
|
|
|
|
uint32_t maxCcsCount = StringHelpers::toUint32t(subEntries[1]);
|
2022-09-22 16:48:55 +08:00
|
|
|
rootDeviceNumCcsMap.insert({rootDeviceIndex, maxCcsCount});
|
2022-07-25 20:13:27 +08:00
|
|
|
rootDeviceEnvironments[rootDeviceIndex]->limitNumberOfCcs(maxCcsCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-10-26 20:41:36 +08:00
|
|
|
|
|
|
|
void ExecutionEnvironment::configureNeoEnvironment() {
|
|
|
|
if (DebugManager.flags.NEO_CAL_ENABLED.get()) {
|
2023-05-17 21:47:14 +08:00
|
|
|
DebugManager.flags.UseKmdMigration.setIfDefault(0);
|
|
|
|
DebugManager.flags.SplitBcsSize.setIfDefault(256);
|
2022-10-26 20:41:36 +08:00
|
|
|
}
|
|
|
|
}
|
2023-06-13 23:19:02 +08:00
|
|
|
|
|
|
|
bool ExecutionEnvironment::comparePciIdBusNumber(std::unique_ptr<RootDeviceEnvironment> &rootDeviceEnvironment1, std::unique_ptr<RootDeviceEnvironment> &rootDeviceEnvironment2) {
|
|
|
|
const auto pciOrderVar = DebugManager.flags.ZE_ENABLE_PCI_ID_DEVICE_ORDER.get();
|
|
|
|
if (!pciOrderVar) {
|
|
|
|
auto isIntegrated1 = rootDeviceEnvironment1->getHardwareInfo()->capabilityTable.isIntegratedDevice;
|
|
|
|
auto isIntegrated2 = rootDeviceEnvironment2->getHardwareInfo()->capabilityTable.isIntegratedDevice;
|
|
|
|
if (isIntegrated1 != isIntegrated2) {
|
|
|
|
return isIntegrated2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// BDF sample format is : 00:02.0
|
|
|
|
auto pciBusInfo1 = rootDeviceEnvironment1->osInterface->getDriverModel()->getPciBusInfo();
|
|
|
|
auto pciBusInfo2 = rootDeviceEnvironment2->osInterface->getDriverModel()->getPciBusInfo();
|
|
|
|
|
|
|
|
if (pciBusInfo1.pciDomain != pciBusInfo2.pciDomain) {
|
|
|
|
return (pciBusInfo1.pciDomain < pciBusInfo2.pciDomain);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pciBusInfo1.pciBus != pciBusInfo2.pciBus) {
|
|
|
|
return (pciBusInfo1.pciBus < pciBusInfo2.pciBus);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pciBusInfo1.pciDevice != pciBusInfo2.pciDevice) {
|
|
|
|
return (pciBusInfo1.pciDevice < pciBusInfo2.pciDevice);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (pciBusInfo1.pciFunction < pciBusInfo2.pciFunction);
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|