Skip to content

Commit 44577dd

Browse files
Baj, TomaszCompute-Runtime-Automation
authored andcommitted
fix: if device hierarchy is flat then getSubDevicesCount return 1u
Related-To: NEO-9167 Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com> Source: cb0bb57
1 parent 0c8e0f9 commit 44577dd

File tree

43 files changed

+88
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+88
-80
lines changed

level_zero/core/source/device/device_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ void DeviceImp::setDebugSession(DebugSession *session) {
15881588
}
15891589
bool DeviceImp::toPhysicalSliceId(const NEO::TopologyMap &topologyMap, uint32_t &slice, uint32_t &subslice, uint32_t &deviceIndex) {
15901590
auto hwInfo = neoDevice->getRootDeviceEnvironment().getHardwareInfo();
1591-
uint32_t subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(hwInfo);
1591+
uint32_t subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(neoDevice->getExecutionEnvironment()->isExposingSubDevicesAsDevices(), hwInfo);
15921592
auto deviceBitfield = neoDevice->getDeviceBitfield();
15931593

15941594
if (topologyMap.size() == subDeviceCount && !isSubdevice) {

level_zero/sysman/source/linux/zes_os_sysman_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ ze_result_t LinuxSysmanImp::init() {
5858
}
5959
DEBUG_BREAK_IF(nullptr == pSysfsAccess);
6060

61-
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(&pParentSysmanDeviceImp->getHardwareInfo());
61+
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(false, &pParentSysmanDeviceImp->getHardwareInfo());
6262
if (subDeviceCount == 1) {
6363
subDeviceCount = 0;
6464
}

level_zero/sysman/source/ras/linux/sysman_os_ras_imp_hbm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ ze_result_t LinuxRasSourceHbm::osRasGetState(zes_ras_state_t &state, ze_bool_t c
2929
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
3030
}
3131
uint32_t subDeviceCount = 0;
32-
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(&pDevice->getHardwareInfo());
32+
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(false, &pDevice->getHardwareInfo());
3333
if (clear == true) {
3434
uint64_t errorCount = 0;
3535
ze_result_t result = pFwInterface->fwGetMemoryErrorCount(osRasErrorType, subDeviceCount, subdeviceId, errorCount);

level_zero/sysman/source/windows/zes_os_sysman_imp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ze_result_t WddmSysmanImp::init() {
3030
pKmdSysManager = KmdSysManager::create(pWddm);
3131
UNRECOVERABLE_IF(nullptr == pKmdSysManager);
3232

33-
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(&pParentSysmanDeviceImp->getHardwareInfo());
33+
subDeviceCount = NEO::GfxCoreHelper::getSubDevicesCount(false, &pParentSysmanDeviceImp->getHardwareInfo());
3434
if (subDeviceCount == 1) {
3535
subDeviceCount = 0;
3636
}

level_zero/tools/source/sysman/sysman_imp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "level_zero/tools/source/sysman/sysman_imp.h"
99

1010
#include "shared/source/device/sub_device.h"
11+
#include "shared/source/execution_environment/execution_environment.h"
1112
#include "shared/source/helpers/basic_math.h"
1213
#include "shared/source/helpers/gfx_core_helper.h"
1314
#include "shared/source/helpers/hw_info.h"
@@ -88,7 +89,7 @@ void SysmanDeviceImp::getSysmanDeviceInfo(zes_device_handle_t hDevice, uint32_t
8889
// Check for root device with 1 sub-device case
8990
if (!neoDevice->isSubDevice() && neoDevice->getDeviceBitfield().count() == 1) {
9091
subdeviceId = Math::log2(static_cast<uint32_t>(neoDevice->getDeviceBitfield().to_ulong()));
91-
if ((NEO::GfxCoreHelper::getSubDevicesCount(&neoDevice->getHardwareInfo()) > 1) && useMultiArchEnabled) {
92+
if ((NEO::GfxCoreHelper::getSubDevicesCount(neoDevice->getExecutionEnvironment()->isExposingSubDevicesAsDevices(), &neoDevice->getHardwareInfo()) > 1) && useMultiArchEnabled) {
9293
onSubdevice = true;
9394
}
9495
} else if (neoDevice->isSubDevice()) {

level_zero/tools/test/unit_tests/sources/sysman/mocks/mock_sysman_device_info.h

Lines changed: 2 additions & 1 deletion
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
*
@@ -31,6 +31,7 @@ class SysmanMultiDeviceInfoFixture : public ::testing::Test {
3131
hwInfo.gtSystemInfo.MultiTileArchInfo.Tile0 = 1;
3232
hwInfo.gtSystemInfo.MultiTileArchInfo.Tile1 = 1;
3333
auto executionEnvironment = MockDevice::prepareExecutionEnvironment(&hwInfo, 0u);
34+
executionEnvironment->setExposeSubDevicesAsDevices(false);
3435
neoDevice = NEO::MockDevice::createWithExecutionEnvironment<NEO::MockDevice>(&hwInfo, executionEnvironment, 0u);
3536

3637
NEO::DeviceVector devices;

opencl/test/unit_test/aub_tests/fixtures/multicontext_aub_fixture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void MulticontextAubFixture::setUp(uint32_t numberOfTiles, EnabledCommandStreame
8181
strfilename << renderEngineName << "_CCS0_3"; // xehp_config_name_RCS_CCS0_3.aub
8282
}
8383

84-
auto filename = AUBCommandStreamReceiver::createFullFilePath(localHwInfo, strfilename.str(), rootDeviceIndex);
84+
auto filename = AUBCommandStreamReceiver::createFullFilePath(localHwInfo, strfilename.str(), rootDeviceIndex, platform()->peekExecutionEnvironment()->isExposingSubDevicesAsDevices());
8585

8686
DebugManager.flags.AUBDumpCaptureFileName.set(filename);
8787

opencl/test/unit_test/device/device_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ TEST(ClDeviceHelperTest, givenNonZeroNumberOfTilesWhenPrepareDeviceEnvironmentsC
735735
HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable};
736736
DebugManager.flags.CreateMultipleSubDevices.set(0);
737737

738-
uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(&hwInfo);
738+
uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(false, &hwInfo);
739739
EXPECT_EQ(devicesCount, 3u);
740740
}
741741

@@ -751,7 +751,7 @@ TEST(ClDeviceHelperTest, givenZeroNumberOfTilesWhenPrepareDeviceEnvironmentsCoun
751751
HardwareInfo hwInfo{&platform, &skuTable, &waTable, &sysInfo, capTable};
752752
DebugManager.flags.CreateMultipleSubDevices.set(0);
753753

754-
uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(&hwInfo);
754+
uint32_t devicesCount = GfxCoreHelper::getSubDevicesCount(false, &hwInfo);
755755
EXPECT_EQ(devicesCount, 1u);
756756
}
757757

opencl/test/unit_test/linux/main_linux_dll.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ TEST_F(DrmTests, whenDrmIsCreatedWithMultipleSubDevicesThenCreateMultipleVirtual
712712
GTEST_SKIP();
713713
}
714714

715-
auto numSubDevices = GfxCoreHelper::getSubDevicesCount(rootDeviceEnvironment->getHardwareInfo());
715+
auto numSubDevices = GfxCoreHelper::getSubDevicesCount(false, rootDeviceEnvironment->getHardwareInfo());
716716
for (auto id = 0u; id < numSubDevices; id++) {
717717
EXPECT_EQ(id + 1, drm->getVirtualMemoryAddressSpace(id));
718718
}
@@ -730,7 +730,7 @@ TEST_F(DrmTests, givenDebuggingEnabledWhenDrmIsCreatedThenPerContextVMIsTrueGetV
730730
if (drm->isVmBindAvailable()) {
731731
EXPECT_TRUE(drm->isPerContextVMRequired());
732732

733-
auto numSubDevices = GfxCoreHelper::getSubDevicesCount(rootDeviceEnvironment->getHardwareInfo());
733+
auto numSubDevices = GfxCoreHelper::getSubDevicesCount(false, rootDeviceEnvironment->getHardwareInfo());
734734
for (auto id = 0u; id < numSubDevices; id++) {
735735
EXPECT_EQ(0u, drm->getVirtualMemoryAddressSpace(id));
736736
}
@@ -759,7 +759,7 @@ TEST_F(DrmTests, givenEnabledDebuggingAndVmBindNotAvailableWhenDrmIsCreatedThenP
759759
GTEST_SKIP();
760760
}
761761

762-
auto numSubDevices = GfxCoreHelper::getSubDevicesCount(rootDeviceEnvironment->getHardwareInfo());
762+
auto numSubDevices = GfxCoreHelper::getSubDevicesCount(false, rootDeviceEnvironment->getHardwareInfo());
763763
for (auto id = 0u; id < numSubDevices; id++) {
764764
EXPECT_NE(0u, drm->getVirtualMemoryAddressSpace(id));
765765
}

shared/source/aub/aub_center.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include "shared/source/aub/aub_helper.h"
1111
#include "shared/source/debug_settings/debug_settings_manager.h"
12+
#include "shared/source/execution_environment/execution_environment.h"
1213
#include "shared/source/execution_environment/root_device_environment.h"
1314
#include "shared/source/helpers/gfx_core_helper.h"
1415
#include "shared/source/helpers/hw_info.h"
@@ -24,8 +25,9 @@ extern aub_stream::AubManager *createAubManager(const aub_stream::AubManagerOpti
2425
AubCenter::AubCenter(const RootDeviceEnvironment &rootDeviceEnvironment, bool localMemoryEnabled, const std::string &aubFileName, CommandStreamReceiverType csrType) {
2526
if (DebugManager.flags.UseAubStream.get()) {
2627
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
27-
auto devicesCount = GfxCoreHelper::getSubDevicesCount(hwInfo);
28-
auto memoryBankSize = AubHelper::getPerTileLocalMemorySize(hwInfo);
28+
bool subDevicesAsDevices = rootDeviceEnvironment.executionEnvironment.isExposingSubDevicesAsDevices();
29+
auto devicesCount = GfxCoreHelper::getSubDevicesCount(subDevicesAsDevices, hwInfo);
30+
auto memoryBankSize = AubHelper::getPerTileLocalMemorySize(subDevicesAsDevices, hwInfo);
2931
CommandStreamReceiverType type = csrType;
3032
if (DebugManager.flags.SetCommandStreamReceiver.get() >= CommandStreamReceiverType::CSR_HW) {
3133
type = static_cast<CommandStreamReceiverType>(DebugManager.flags.SetCommandStreamReceiver.get());

0 commit comments

Comments
 (0)