fix: correct queryFabricStats in WSL path

Related-To: GSD-10939
Signed-off-by: Jaroslaw Warchulski <jaroslaw.warchulski@intel.com>
This commit is contained in:
Jaroslaw Warchulski
2025-03-28 11:56:32 +00:00
committed by Compute-Runtime-Automation
parent 3fff3dd77b
commit f760731173
7 changed files with 51 additions and 31 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2023-2024 Intel Corporation
# Copyright (C) 2023-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -17,14 +17,10 @@ target_sources(${L0_STATIC_LIB_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/device_imp.h
)
if(UNIX AND NEO_ENABLE_I915_PRELIM_DETECTION)
if(UNIX)
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/device_imp_drm/device_imp_peer.cpp
)
else()
target_sources(${L0_STATIC_LIB_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/device_imp_peer_stub.cpp
${CMAKE_CURRENT_SOURCE_DIR}/device_imp_drm/device_imp_peer.h
)
endif()

View File

@@ -1,17 +1,19 @@
/*
* Copyright (C) 2022-2024 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/core/source/device/device_imp.h"
#include "level_zero/core/source/device/device_imp_drm/device_imp_peer.h"
namespace L0 {
ze_result_t DeviceImp::queryDeviceLuid(ze_device_luid_ext_properties_t *deviceLuidProperties) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
uint32_t DeviceImp::queryDeviceNodeMask() {
return 1;
}
@@ -25,4 +27,8 @@ ze_result_t DeviceImp::getExternalMemoryProperties(ze_device_external_memory_pro
return ZE_RESULT_SUCCESS;
}
} // namespace L0
ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth) {
return queryFabricStatsDrm(this, pPeerDevice, latency, bandwidth);
}
} // namespace L0

View File

@@ -1,10 +1,12 @@
/*
* Copyright (C) 2022-2023 Intel Corporation
* Copyright (C) 2022-2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/core/source/device/device_imp_drm/device_imp_peer.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/linux/drm_neo.h"
@@ -22,7 +24,7 @@ const std::string iafDirectoryLegacy = "iaf.";
const std::string iafDirectory = "i915.iaf.";
const std::string fabricIdFile = "/iaf_fabric_id";
ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth) {
ze_result_t queryFabricStatsDrm(DeviceImp *pSourceDevice, DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth) {
auto &osPeerInterface = pPeerDevice->getNEODevice()->getRootDeviceEnvironment().osInterface;
if (osPeerInterface == nullptr) {
@@ -57,7 +59,7 @@ ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latenc
size_t end = 0;
uint32_t fabricId = static_cast<uint32_t>(std::stoul(fabricIdStr, &end, 16));
auto &osInterface = this->getNEODevice()->getRootDeviceEnvironment().osInterface;
auto &osInterface = pSourceDevice->getNEODevice()->getRootDeviceEnvironment().osInterface;
auto pDrm = osInterface->getDriverModel()->as<NEO::Drm>();
bool success = pDrm->getIoctlHelper()->getFabricLatency(fabricId, latency, bandwidth);
if (success == false) {
@@ -66,7 +68,7 @@ ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latenc
PRINT_DEBUG_STRING(NEO::debugManager.flags.PrintDebugMessages.get(), stderr,
"Connection detected between device %d and peer device %d: latency %d hops, bandwidth %d GBPS\n",
this->getRootDeviceIndex(), pPeerDevice->getRootDeviceIndex(), latency, bandwidth);
pSourceDevice->getRootDeviceIndex(), pPeerDevice->getRootDeviceIndex(), latency, bandwidth);
return ZE_RESULT_SUCCESS;
}

View File

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include <level_zero/ze_api.h>
namespace L0 {
struct DeviceImp;
ze_result_t queryFabricStatsDrm(DeviceImp *pSourceDevice, DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth);
} // namespace L0

View File

@@ -14,6 +14,7 @@
#include "shared/source/os_interface/windows/wddm/wddm.h"
#include "level_zero/core/source/device/device_imp.h"
#include "level_zero/core/source/device/device_imp_drm/device_imp_peer.h"
namespace L0 {
@@ -67,4 +68,15 @@ ze_result_t DeviceImp::getExternalMemoryProperties(ze_device_external_memory_pro
return ZE_RESULT_SUCCESS;
}
} // namespace L0
ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth) {
NEO::Device *activeDevice = getActiveDevice();
if (activeDevice->getRootDeviceEnvironment().osInterface) {
NEO::DriverModelType driverType = neoDevice->getRootDeviceEnvironment().osInterface->getDriverModel()->getDriverModelType();
if (driverType == NEO::DriverModelType::drm) {
return queryFabricStatsDrm(this, pPeerDevice, latency, bandwidth);
}
}
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
} // namespace L0

View File

@@ -1,16 +0,0 @@
/*
* Copyright (C) 2022 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "level_zero/core/source/device/device_imp.h"
namespace L0 {
ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
} // namespace L0

View File

@@ -42,4 +42,8 @@ ze_result_t DeviceImp::getExternalMemoryProperties(ze_device_external_memory_pro
return ZE_RESULT_SUCCESS;
}
} // namespace L0
ze_result_t DeviceImp::queryFabricStats(DeviceImp *pPeerDevice, uint32_t &latency, uint32_t &bandwidth) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
} // namespace L0