mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 04:48:08 +08:00
Update Fabric Vertex Support to include iaf querying
This patch adds 1. enumeration of connected iaf devices 2. move fabric vertex to driver, to support deviceless vertices case Related-To: LOCI-3376 Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
6532cb28bb
commit
44a1f4822b
@@ -53,8 +53,6 @@ set(L0_RUNTIME_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/event/event.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fence/fence.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fence/fence.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric/fabric.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric/fabric.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/helpers/allocation_extensions.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/helpers/allocation_extensions.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/helpers/api_specific_config_l0.cpp
|
||||
|
||||
@@ -1099,8 +1099,6 @@ Device *Device::create(DriverHandle *driverHandle, NEO::Device *neoDevice, bool
|
||||
|
||||
device->populateSubDeviceCopyEngineGroups();
|
||||
|
||||
device->fabricVertex = std::unique_ptr<FabricVertex>(FabricVertex::createFromDevice(device));
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
|
||||
@@ -132,10 +132,11 @@ struct DeviceImp : public Device {
|
||||
void createSysmanHandle(bool isSubDevice);
|
||||
void populateSubDeviceCopyEngineGroups();
|
||||
bool isQueueGroupOrdinalValid(uint32_t ordinal);
|
||||
void setFabricVertex(FabricVertex *inFabricVertex) { fabricVertex = inFabricVertex; }
|
||||
|
||||
using CmdListCreateFunPtrT = L0::CommandList *(*)(uint32_t, Device *, NEO::EngineGroupType, ze_command_list_flags_t, ze_result_t &);
|
||||
CmdListCreateFunPtrT getCmdListCreateFunc(const ze_command_list_desc_t *desc);
|
||||
std::unique_ptr<FabricVertex> fabricVertex;
|
||||
FabricVertex *fabricVertex = nullptr;
|
||||
|
||||
ze_result_t queryDeviceLuid(ze_device_luid_ext_properties_t *deviceLuidProperties);
|
||||
ze_result_t setDeviceLuid(ze_device_luid_ext_properties_t *deviceLuidProperties);
|
||||
|
||||
@@ -159,6 +159,12 @@ DriverHandleImp::~DriverHandleImp() {
|
||||
for (auto &device : this->devices) {
|
||||
delete device;
|
||||
}
|
||||
|
||||
for (auto &fabricVertex : this->fabricVertices) {
|
||||
delete fabricVertex;
|
||||
}
|
||||
this->fabricVertices.clear();
|
||||
|
||||
if (this->svmAllocsManager) {
|
||||
delete this->svmAllocsManager;
|
||||
this->svmAllocsManager = nullptr;
|
||||
@@ -232,6 +238,14 @@ ze_result_t DriverHandleImp::initialize(std::vector<std::unique_ptr<NEO::Device>
|
||||
createHostPointerManager();
|
||||
}
|
||||
|
||||
for (auto &device : this->devices) {
|
||||
|
||||
auto deviceImpl = static_cast<DeviceImp *>(device);
|
||||
auto fabricVertex = FabricVertex::createFromDevice(device);
|
||||
deviceImpl->setFabricVertex(fabricVertex);
|
||||
this->fabricVertices.push_back(fabricVertex);
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -621,23 +635,16 @@ ze_result_t DriverHandleImp::checkMemoryAccessFromDevice(Device *device, const v
|
||||
|
||||
ze_result_t DriverHandleImp::fabricVertexGetExp(uint32_t *pCount, ze_fabric_vertex_handle_t *phVertices) {
|
||||
|
||||
uint32_t deviceCount = 0;
|
||||
getDevice(&deviceCount, nullptr);
|
||||
|
||||
uint32_t fabricVertexCount = static_cast<uint32_t>(this->fabricVertices.size());
|
||||
if (*pCount == 0) {
|
||||
*pCount = deviceCount;
|
||||
*pCount = fabricVertexCount;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
std::vector<ze_device_handle_t> deviceHandles;
|
||||
deviceHandles.resize(deviceCount);
|
||||
getDevice(&deviceCount, deviceHandles.data());
|
||||
|
||||
*pCount = std::min(deviceCount, *pCount);
|
||||
*pCount = std::min(fabricVertexCount, *pCount);
|
||||
|
||||
for (uint32_t index = 0; index < *pCount; index++) {
|
||||
auto deviceImp = static_cast<DeviceImp *>(deviceHandles[index]);
|
||||
phVertices[index] = deviceImp->fabricVertex->toHandle();
|
||||
phVertices[index] = this->fabricVertices[index]->toHandle();
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
namespace L0 {
|
||||
class HostPointerManager;
|
||||
struct FabricVertex;
|
||||
|
||||
struct DriverHandleImp : public DriverHandle {
|
||||
~DriverHandleImp() override;
|
||||
@@ -86,6 +87,7 @@ struct DriverHandleImp : public DriverHandle {
|
||||
std::map<void *, NEO::GraphicsAllocation *> sharedMakeResidentAllocations;
|
||||
|
||||
std::vector<Device *> devices;
|
||||
std::vector<FabricVertex *> fabricVertices;
|
||||
// Spec extensions
|
||||
const std::vector<std::pair<std::string, uint32_t>> extensionsSupported = {
|
||||
{ZE_FLOAT_ATOMICS_EXT_NAME, ZE_FLOAT_ATOMICS_EXT_VERSION_CURRENT},
|
||||
|
||||
20
level_zero/core/source/fabric/CMakeLists.txt
Normal file
20
level_zero/core/source/fabric/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(L0_SRCS_FABRIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_interface.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric.cpp
|
||||
)
|
||||
|
||||
add_subdirectories()
|
||||
set(L0_RUNTIME_SOURCES
|
||||
${L0_RUNTIME_SOURCES}
|
||||
${L0_SRCS_FABRIC}
|
||||
${L0_SRCS_FABRIC_OS}
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -10,13 +10,39 @@
|
||||
#include "shared/source/helpers/string.h"
|
||||
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/fabric/fabric_device_interface.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
FabricVertex::~FabricVertex() {
|
||||
|
||||
for (auto subVertex : subVertices) {
|
||||
delete subVertex;
|
||||
}
|
||||
subVertices.clear();
|
||||
}
|
||||
|
||||
FabricVertex *FabricVertex::createFromDevice(Device *device) {
|
||||
|
||||
// Fabric Vertices are not created for engine instanced devices
|
||||
if (device->getNEODevice()->isEngineInstanced()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto fabricVertex = new FabricVertex();
|
||||
UNRECOVERABLE_IF(fabricVertex == nullptr);
|
||||
|
||||
auto deviceImpl = static_cast<DeviceImp *>(device);
|
||||
for (auto &subDevice : deviceImpl->subDevices) {
|
||||
auto subVertex = FabricVertex::createFromDevice(subDevice);
|
||||
if (subVertex == nullptr) {
|
||||
continue;
|
||||
}
|
||||
auto subDeviceImpl = static_cast<DeviceImp *>(subDevice);
|
||||
subDeviceImpl->setFabricVertex(subVertex);
|
||||
fabricVertex->subVertices.push_back(subVertex);
|
||||
}
|
||||
|
||||
ze_device_properties_t deviceProperties = {};
|
||||
ze_pci_ext_properties_t pciProperties = {};
|
||||
|
||||
@@ -42,31 +68,36 @@ FabricVertex *FabricVertex::createFromDevice(Device *device) {
|
||||
fabricVertex->properties.address.function = pciProperties.address.function;
|
||||
}
|
||||
|
||||
fabricVertex->pFabricDeviceInterface = FabricDeviceInterface::createFabricDeviceInterface(*fabricVertex);
|
||||
UNRECOVERABLE_IF(fabricVertex->pFabricDeviceInterface == nullptr);
|
||||
|
||||
fabricVertex->pFabricDeviceInterface->enumerate();
|
||||
|
||||
return fabricVertex;
|
||||
}
|
||||
|
||||
ze_result_t FabricVertex::getSubVertices(uint32_t *pCount, ze_fabric_vertex_handle_t *phSubvertices) {
|
||||
|
||||
auto deviceImp = static_cast<DeviceImp *>(device);
|
||||
uint32_t subVertexCount = static_cast<uint32_t>(subVertices.size());
|
||||
if (*pCount == 0) {
|
||||
*pCount = deviceImp->numSubDevices;
|
||||
*pCount = subVertexCount;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
*pCount = std::min(deviceImp->numSubDevices, *pCount);
|
||||
*pCount = std::min(subVertexCount, *pCount);
|
||||
for (uint32_t index = 0; index < *pCount; index++) {
|
||||
auto subDeviceImp = static_cast<DeviceImp *>(deviceImp->subDevices[index]);
|
||||
phSubvertices[index] = subDeviceImp->fabricVertex->toHandle();
|
||||
phSubvertices[index] = subVertices[index]->toHandle();
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t FabricVertex::getProperties(ze_fabric_vertex_exp_properties_t *pVertexProperties) {
|
||||
ze_result_t FabricVertex::getProperties(ze_fabric_vertex_exp_properties_t *pVertexProperties) const {
|
||||
*pVertexProperties = properties;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t FabricVertex::getDevice(ze_device_handle_t *phDevice) {
|
||||
ze_result_t FabricVertex::getDevice(ze_device_handle_t *phDevice) const {
|
||||
|
||||
*phDevice = device->toHandle();
|
||||
return ZE_RESULT_SUCCESS;
|
||||
|
||||
@@ -9,25 +9,33 @@
|
||||
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
struct _ze_fabric_vertex_handle_t {};
|
||||
|
||||
namespace L0 {
|
||||
struct Device;
|
||||
class FabricDeviceInterface;
|
||||
|
||||
struct FabricVertex : _ze_fabric_vertex_handle_t {
|
||||
|
||||
public:
|
||||
static FabricVertex *createFromDevice(Device *device);
|
||||
virtual ~FabricVertex() = default;
|
||||
virtual ~FabricVertex();
|
||||
ze_result_t getSubVertices(uint32_t *pCount, ze_fabric_vertex_handle_t *phSubvertices);
|
||||
ze_result_t getProperties(ze_fabric_vertex_exp_properties_t *pVertexProperties);
|
||||
ze_result_t getDevice(ze_device_handle_t *phDevice);
|
||||
ze_result_t getProperties(ze_fabric_vertex_exp_properties_t *pVertexProperties) const;
|
||||
ze_result_t getDevice(ze_device_handle_t *phDevice) const;
|
||||
static FabricVertex *fromHandle(ze_fabric_vertex_handle_t handle) { return static_cast<FabricVertex *>(handle); }
|
||||
inline ze_fabric_vertex_handle_t toHandle() { return this; }
|
||||
|
||||
std::unique_ptr<FabricDeviceInterface> pFabricDeviceInterface;
|
||||
|
||||
private:
|
||||
struct Device *device = nullptr;
|
||||
ze_fabric_vertex_exp_properties_t properties = {};
|
||||
|
||||
std::vector<FabricVertex *> subVertices = {};
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
|
||||
25
level_zero/core/source/fabric/fabric_device_interface.h
Normal file
25
level_zero/core/source/fabric/fabric_device_interface.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "level_zero/core/source/fabric/fabric.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class FabricDeviceInterface {
|
||||
|
||||
public:
|
||||
virtual ~FabricDeviceInterface(){};
|
||||
virtual ze_result_t enumerate() = 0;
|
||||
static std::unique_ptr<FabricDeviceInterface> createFabricDeviceInterface(const FabricVertex &fabricVertex);
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
25
level_zero/core/source/fabric/linux/CMakeLists.txt
Normal file
25
level_zero/core/source/fabric/linux/CMakeLists.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(UNIX)
|
||||
|
||||
if(LIBGENL_FOUND AND NEO_ENABLE_i915_PRELIM_DETECTION)
|
||||
set(L0_SRCS_FABRIC_OS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_iaf.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_iaf.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
else()
|
||||
set(L0_SRCS_FABRIC_OS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_iaf_stub.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_iaf_stub.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
171
level_zero/core/source/fabric/linux/fabric_device_iaf.cpp
Normal file
171
level_zero/core/source/fabric/linux/fabric_device_iaf.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/core/source/fabric/linux/fabric_device_iaf.h"
|
||||
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/os_interface/linux/drm_neo.h"
|
||||
#include "shared/source/os_interface/linux/pci_path.h"
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
|
||||
#include "level_zero/core/source/device/device.h"
|
||||
#include "level_zero/core/source/device/device_imp.h"
|
||||
#include "level_zero/core/source/fabric/fabric.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
FabricDeviceIaf::FabricDeviceIaf(Device *device) : device(device) {
|
||||
|
||||
DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
|
||||
|
||||
if (deviceImp->numSubDevices == 0) {
|
||||
//Add one sub-device
|
||||
subDeviceIafs.push_back(std::make_unique<FabricSubDeviceIaf>(device));
|
||||
} else {
|
||||
for (const auto &subDevice : deviceImp->subDevices) {
|
||||
subDeviceIafs.push_back(std::make_unique<FabricSubDeviceIaf>(subDevice));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ze_result_t FabricDeviceIaf::enumerate() {
|
||||
|
||||
ze_result_t result = ZE_RESULT_SUCCESS;
|
||||
for (auto &subDeviceIaf : subDeviceIafs) {
|
||||
result = subDeviceIaf->enumerate();
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
FabricSubDeviceIaf::FabricSubDeviceIaf(Device *device) : device(device) {
|
||||
pIafNlApi = std::make_unique<IafNlApi>();
|
||||
UNRECOVERABLE_IF(nullptr == pIafNlApi);
|
||||
}
|
||||
|
||||
ze_result_t FabricSubDeviceIaf::enumerate() {
|
||||
|
||||
auto &osInterface = device->getNEODevice()->getRootDeviceEnvironment().osInterface;
|
||||
|
||||
if (osInterface == nullptr) {
|
||||
return ZE_RESULT_ERROR_UNINITIALIZED;
|
||||
}
|
||||
|
||||
if (osInterface->getDriverModel()->getDriverModelType() != NEO::DriverModelType::DRM) {
|
||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
||||
}
|
||||
|
||||
auto pDrm = osInterface->getDriverModel()->as<NEO::Drm>();
|
||||
std::optional<std::string> rootPciPath = NEO::getPciLinkPath(pDrm->getFileDescriptor());
|
||||
if (!rootPciPath.has_value()) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
std::vector<IafPort> iafPorts = {};
|
||||
ze_result_t result = pIafNlApi->getPorts("/sys/class/drm/" + rootPciPath.value() + "/device/", iafPorts);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
DeviceImp *deviceImp = static_cast<DeviceImp *>(device);
|
||||
uint32_t physicalSubDeviceId = deviceImp->getPhysicalSubDeviceId();
|
||||
|
||||
// Remove ports which donot belong to this device
|
||||
for (auto iter = iafPorts.begin(); iter != iafPorts.end();) {
|
||||
IafPort &port = *iter;
|
||||
if (port.portId.attachId != physicalSubDeviceId) {
|
||||
iter = iafPorts.erase(iter);
|
||||
continue;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
// Get Connections
|
||||
for (auto iafPort : iafPorts) {
|
||||
FabricPortConnection connection = {};
|
||||
ze_result_t result = getConnection(iafPort, connection);
|
||||
if (result != ZE_RESULT_SUCCESS) {
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"failure observed for IafPort{0x%x, 0x%x, 0x%x}: 0x%x\n",
|
||||
iafPort.portId.fabricId, iafPort.portId.attachId, iafPort.portId.portNumber,
|
||||
result);
|
||||
continue;
|
||||
}
|
||||
connections.push_back(connection);
|
||||
}
|
||||
|
||||
// Get guid
|
||||
if (iafPorts.size() > 0) {
|
||||
std::vector<uint8_t> ports = {};
|
||||
if (ZE_RESULT_SUCCESS != pIafNlApi->subdevicePropertiesGet(iafPorts[0].portId.fabricId, physicalSubDeviceId, guid, ports)) {
|
||||
connections.clear();
|
||||
NEO::printDebugString(NEO::DebugManager.flags.PrintDebugMessages.get(), stderr,
|
||||
"failure during fabric port guid reading {0x%x, 0x%x, 0x%x}: result: 0x%x subdeviceId:%d\n",
|
||||
iafPorts[0].portId.fabricId, iafPorts[0].portId.attachId, iafPorts[0].portId.portNumber,
|
||||
result, physicalSubDeviceId);
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
ze_result_t FabricSubDeviceIaf::getConnection(IafPort &port, FabricPortConnection &connection) {
|
||||
|
||||
IafPortState iafPortState = {};
|
||||
ze_result_t result = pIafNlApi->fPortStatusQuery(port.portId, iafPortState);
|
||||
if (ZE_RESULT_SUCCESS != result || iafPortState.healthStatus != IAF_FPORT_HEALTH_HEALTHY) {
|
||||
return ZE_RESULT_ERROR_UNKNOWN;
|
||||
}
|
||||
|
||||
// Consider only healthy ports
|
||||
uint64_t neighbourGuid;
|
||||
uint8_t neighbourPortNumber;
|
||||
IafPortSpeed maxRxSpeed = {}, maxTxSpeed = {};
|
||||
IafPortSpeed rxSpeed = {}, txSpeed = {};
|
||||
|
||||
result = pIafNlApi->fportProperties(port.portId, neighbourGuid, neighbourPortNumber, maxRxSpeed, maxTxSpeed, rxSpeed, txSpeed);
|
||||
if (ZE_RESULT_SUCCESS != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
connection.currentid = port.portId;
|
||||
connection.neighbourPortNumber = neighbourPortNumber;
|
||||
connection.neighbourGuid = neighbourGuid;
|
||||
const double bandwidthInBitsPerSecond = static_cast<double>(maxRxSpeed.bitRate * maxRxSpeed.width);
|
||||
// 8ull - bits to bytes; 1e9 - seconds to nano-seconds
|
||||
connection.bandwidthInBytesPerNanoSecond = static_cast<uint32_t>(bandwidthInBitsPerSecond / (8ull * 1e9));
|
||||
connection.isDuplex = true;
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
void FabricSubDeviceIaf::setIafNlApi(IafNlApi *iafNlApi) {
|
||||
pIafNlApi.reset(iafNlApi);
|
||||
}
|
||||
|
||||
std::unique_ptr<FabricDeviceInterface> FabricDeviceInterface::createFabricDeviceInterface(const FabricVertex &fabricVertex) {
|
||||
|
||||
ze_fabric_vertex_exp_properties_t vertexProperties = {};
|
||||
fabricVertex.getProperties(&vertexProperties);
|
||||
|
||||
ze_device_handle_t hDevice = nullptr;
|
||||
fabricVertex.getDevice(&hDevice);
|
||||
DEBUG_BREAK_IF(hDevice == nullptr);
|
||||
|
||||
DeviceImp *deviceImp = static_cast<DeviceImp *>(hDevice);
|
||||
Device *device = static_cast<Device *>(hDevice);
|
||||
if (deviceImp->isSubdevice) {
|
||||
return std::unique_ptr<FabricDeviceInterface>(new (std::nothrow) FabricSubDeviceIaf(device));
|
||||
}
|
||||
|
||||
return std::unique_ptr<FabricDeviceInterface>(new (std::nothrow) FabricDeviceIaf(device));
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
57
level_zero/core/source/fabric/linux/fabric_device_iaf.h
Normal file
57
level_zero/core/source/fabric/linux/fabric_device_iaf.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "level_zero/core/source/fabric/fabric_device_interface.h"
|
||||
#include "level_zero/tools/source/sysman/linux/nl_api/iaf_nl_api.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class FabricSubDeviceIaf;
|
||||
|
||||
struct FabricPortConnection {
|
||||
IafPortId currentid;
|
||||
uint8_t neighbourPortNumber;
|
||||
uint64_t neighbourGuid;
|
||||
uint32_t bandwidthInBytesPerNanoSecond;
|
||||
bool isDuplex;
|
||||
};
|
||||
|
||||
class FabricDeviceIaf : public FabricDeviceInterface {
|
||||
|
||||
public:
|
||||
FabricDeviceIaf(Device *device);
|
||||
~FabricDeviceIaf() override = default;
|
||||
ze_result_t enumerate() override;
|
||||
std::vector<std::unique_ptr<FabricSubDeviceIaf>> subDeviceIafs = {};
|
||||
|
||||
protected:
|
||||
Device *device = nullptr;
|
||||
};
|
||||
|
||||
class FabricSubDeviceIaf : public FabricDeviceInterface {
|
||||
|
||||
public:
|
||||
FabricSubDeviceIaf(Device *device);
|
||||
~FabricSubDeviceIaf() override = default;
|
||||
ze_result_t enumerate() override;
|
||||
void setIafNlApi(IafNlApi *iafNlApi);
|
||||
std::vector<FabricPortConnection> connections = {};
|
||||
|
||||
protected:
|
||||
ze_result_t getConnection(IafPort &port, FabricPortConnection &connection);
|
||||
|
||||
std::unique_ptr<IafNlApi> pIafNlApi = nullptr;
|
||||
Device *device = nullptr;
|
||||
uint64_t guid = 0ull;
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/core/source/fabric/linux/fabric_device_iaf_stub.h"
|
||||
|
||||
#include "level_zero/core/source/fabric/fabric.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
std::unique_ptr<FabricDeviceInterface> FabricDeviceInterface::createFabricDeviceInterface(const FabricVertex &fabricVertex) {
|
||||
|
||||
return std::unique_ptr<FabricDeviceInterface>(new (std::nothrow) FabricDeviceIafStub());
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
25
level_zero/core/source/fabric/linux/fabric_device_iaf_stub.h
Normal file
25
level_zero/core/source/fabric/linux/fabric_device_iaf_stub.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "level_zero/core/source/fabric/fabric_device_interface.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class FabricDeviceIafStub : public FabricDeviceInterface {
|
||||
|
||||
public:
|
||||
FabricDeviceIafStub() = default;
|
||||
~FabricDeviceIafStub() override = default;
|
||||
ze_result_t enumerate() override {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
14
level_zero/core/source/fabric/windows/CMakeLists.txt
Normal file
14
level_zero/core/source/fabric/windows/CMakeLists.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Copyright (C) 2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
if(WIN32)
|
||||
set(L0_SRCS_FABRIC_OS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_iaf.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fabric_device_iaf.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
endif()
|
||||
19
level_zero/core/source/fabric/windows/fabric_device_iaf.cpp
Normal file
19
level_zero/core/source/fabric/windows/fabric_device_iaf.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "level_zero/core/source/fabric/windows/fabric_device_iaf.h"
|
||||
|
||||
#include "level_zero/core/source/fabric/fabric.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
std::unique_ptr<FabricDeviceInterface> FabricDeviceInterface::createFabricDeviceInterface(const FabricVertex &fabricVertex) {
|
||||
|
||||
return std::unique_ptr<FabricDeviceInterface>(new (std::nothrow) FabricDeviceIaf());
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
25
level_zero/core/source/fabric/windows/fabric_device_iaf.h
Normal file
25
level_zero/core/source/fabric/windows/fabric_device_iaf.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "level_zero/core/source/fabric/fabric_device_interface.h"
|
||||
#include <level_zero/ze_api.h>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class FabricDeviceIaf : public FabricDeviceInterface {
|
||||
|
||||
public:
|
||||
FabricDeviceIaf() = default;
|
||||
~FabricDeviceIaf() override = default;
|
||||
ze_result_t enumerate() override {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace L0
|
||||
Reference in New Issue
Block a user