Skip to content

Commit bd724de

Browse files
fix: adjust root device indices when filtering root device environments
Related-To: NEO-8166 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com> Source: 4e464e9
1 parent d464d5d commit bd724de

File tree

12 files changed

+66
-115
lines changed

12 files changed

+66
-115
lines changed

shared/source/execution_environment/drm/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

shared/source/execution_environment/drm/sort_devices_drm.cpp

Lines changed: 0 additions & 33 deletions
This file was deleted.

shared/source/execution_environment/execution_environment.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ void ExecutionEnvironment::parseAffinityMask() {
253253
rootDeviceEnvironments.swap(filteredEnvironments);
254254
}
255255

256+
void ExecutionEnvironment::sortNeoDevices() {
257+
std::sort(rootDeviceEnvironments.begin(), rootDeviceEnvironments.end(), comparePciIdBusNumber);
258+
}
259+
256260
void ExecutionEnvironment::adjustCcsCountImpl(RootDeviceEnvironment *rootDeviceEnvironment) const {
257261
auto hwInfo = rootDeviceEnvironment->getMutableHardwareInfo();
258262
auto &productHelper = rootDeviceEnvironment->getHelper<ProductHelper>();

shared/source/execution_environment/execution_environment.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class ExecutionEnvironment : public ReferenceTrackedObject<ExecutionEnvironment>
3232
void adjustCcsCount();
3333
void adjustCcsCount(const uint32_t rootDeviceIndex) const;
3434
void sortNeoDevices();
35-
void sortNeoDevicesDRM();
36-
void sortNeoDevicesWDDM();
35+
void adjustRootDeviceEnvironments();
3736
void prepareForCleanup() const;
3837
void setDebuggingMode(DebuggingMode debuggingMode) {
3938
debuggingEnabledMode = debuggingMode;
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
/*
2-
* Copyright (C) 2022 Intel Corporation
2+
* Copyright (C) 2022-2023 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
66
*/
77

88
#include "shared/source/execution_environment/execution_environment.h"
9+
#include "shared/source/execution_environment/root_device_environment.h"
10+
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
911

1012
namespace NEO {
1113

12-
void ExecutionEnvironment::sortNeoDevices() {
13-
return ExecutionEnvironment::sortNeoDevicesDRM();
14+
void ExecutionEnvironment::adjustRootDeviceEnvironments() {
15+
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
16+
auto drmMemoryOperationsHandler = static_cast<DrmMemoryOperationsHandler *>(rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface.get());
17+
drmMemoryOperationsHandler->setRootDeviceIndex(rootDeviceIndex);
18+
}
1419
}
15-
1620
} // namespace NEO

shared/source/execution_environment/execution_environment_drm_or_wddm.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,18 @@
88
#include "shared/source/execution_environment/execution_environment.h"
99
#include "shared/source/execution_environment/root_device_environment.h"
1010
#include "shared/source/helpers/driver_model_type.h"
11+
#include "shared/source/os_interface/linux/drm_memory_operations_handler.h"
1112
#include "shared/source/os_interface/os_interface.h"
1213

1314
namespace NEO {
1415

15-
void ExecutionEnvironment::sortNeoDevices() {
16-
16+
void ExecutionEnvironment::adjustRootDeviceEnvironments() {
1717
if (rootDeviceEnvironments[0]->osInterface->getDriverModel()->getDriverModelType() == DriverModelType::DRM) {
18-
return ExecutionEnvironment::sortNeoDevicesDRM();
19-
} else {
20-
return ExecutionEnvironment::sortNeoDevicesWDDM();
18+
for (auto rootDeviceIndex = 0u; rootDeviceIndex < rootDeviceEnvironments.size(); rootDeviceIndex++) {
19+
auto drmMemoryOperationsHandler = static_cast<DrmMemoryOperationsHandler *>(rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface.get());
20+
drmMemoryOperationsHandler->setRootDeviceIndex(rootDeviceIndex);
21+
}
2122
}
2223
}
2324

24-
} // namespace NEO
25+
} // namespace NEO
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022 Intel Corporation
2+
* Copyright (C) 2022-2023 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -9,8 +9,7 @@
99

1010
namespace NEO {
1111

12-
void ExecutionEnvironment::sortNeoDevices() {
13-
return ExecutionEnvironment::sortNeoDevicesWDDM();
12+
void ExecutionEnvironment::adjustRootDeviceEnvironments() {
1413
}
1514

16-
} // namespace NEO
15+
} // namespace NEO

shared/source/execution_environment/wddm/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
This file was deleted.

shared/source/execution_environment/wddm/sort_devices_wddm.cpp

Lines changed: 0 additions & 19 deletions
This file was deleted.

shared/source/os_interface/device_factory.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ bool DeviceFactory::prepareDeviceEnvironments(ExecutionEnvironment &executionEnv
179179

180180
executionEnvironment.sortNeoDevices();
181181
executionEnvironment.parseAffinityMask();
182+
executionEnvironment.adjustRootDeviceEnvironments();
182183
executionEnvironment.adjustCcsCount();
183184
executionEnvironment.calculateMaxOsContextCount();
184185

0 commit comments

Comments
 (0)