Update Fabric Latency to Edge Properties
Related-To: LOCI-3464 Signed-off-by: Joshua Santosh Ranjan <joshua.santosh.ranjan@intel.com>
This commit is contained in:
parent
fcd0dd95a1
commit
83b4edddf0
|
@ -80,8 +80,8 @@ bool FabricDeviceIaf::getEdgeProperty(FabricVertex *neighborVertex, ze_fabric_ed
|
|||
memcpy_s(edgeProperty.model, ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE, "XeLink", 7);
|
||||
edgeProperty.bandwidth = accumulatedBandwidth;
|
||||
edgeProperty.bandwidthUnit = ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC;
|
||||
edgeProperty.latency = 0;
|
||||
edgeProperty.latencyUnit = ZE_LATENCY_UNIT_UNKNOWN;
|
||||
edgeProperty.latency = subDeviceEdgeProperties[0].latency;
|
||||
edgeProperty.latencyUnit = subDeviceEdgeProperties[0].latencyUnit;
|
||||
edgeProperty.duplexity = ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX;
|
||||
|
||||
isConnected = true;
|
||||
|
@ -211,14 +211,23 @@ bool FabricSubDeviceIaf::getEdgeProperty(FabricSubDeviceIaf *pNeighbourInterface
|
|||
|
||||
// Considering the neighboring port is attached on a subdevice, fabricId and attachId could be used from
|
||||
// any of the connection
|
||||
memcpy_s(&uuid.id[8], 4, &pNeighbourInterface->connections[0].currentid.fabricId, 4);
|
||||
auto neighbourFabricId = pNeighbourInterface->connections[0].currentid.fabricId;
|
||||
memcpy_s(&uuid.id[8], 4, &neighbourFabricId, 4);
|
||||
memcpy_s(&uuid.id[12], 1, &pNeighbourInterface->connections[0].currentid.attachId, 1);
|
||||
|
||||
memcpy_s(edgeProperty.model, ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE, "XeLink", 7);
|
||||
edgeProperty.bandwidth = accumulatedBandwidth;
|
||||
edgeProperty.bandwidthUnit = ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC;
|
||||
edgeProperty.latency = 0;
|
||||
|
||||
auto &osInterface = device->getNEODevice()->getRootDeviceEnvironment().osInterface;
|
||||
auto pDrm = osInterface->getDriverModel()->as<NEO::Drm>();
|
||||
|
||||
edgeProperty.latency = std::numeric_limits<uint32_t>::max();
|
||||
edgeProperty.latencyUnit = ZE_LATENCY_UNIT_UNKNOWN;
|
||||
if (pDrm->getIoctlHelper()->getFabricLatency(neighbourFabricId, edgeProperty.latency) == true) {
|
||||
edgeProperty.latencyUnit = ZE_LATENCY_UNIT_HOP;
|
||||
}
|
||||
|
||||
edgeProperty.duplexity = ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX;
|
||||
isConnected = true;
|
||||
}
|
||||
|
@ -268,8 +277,8 @@ bool FabricSubDeviceIaf::getEdgeProperty(FabricVertex *neighborVertex,
|
|||
memcpy_s(edgeProperty.model, ZE_MAX_FABRIC_EDGE_MODEL_EXP_SIZE, "XeLink", 7);
|
||||
edgeProperty.bandwidth = accumulatedBandwidth;
|
||||
edgeProperty.bandwidthUnit = ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC;
|
||||
edgeProperty.latency = 0;
|
||||
edgeProperty.latencyUnit = ZE_LATENCY_UNIT_UNKNOWN;
|
||||
edgeProperty.latency = subEdgeProperties[0].latency;
|
||||
edgeProperty.latencyUnit = subEdgeProperties[0].latencyUnit;
|
||||
edgeProperty.duplexity = ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX;
|
||||
|
||||
isConnected = true;
|
||||
|
|
|
@ -231,9 +231,31 @@ TEST_F(TestFabricIaf, GivenIafFabricAvailableWhenGetPortsReturnsErrorThenReturnE
|
|||
delete subDeviceFabric;
|
||||
}
|
||||
|
||||
class MockIoctlHelperIafTest : public NEO::IoctlHelperPrelim20 {
|
||||
public:
|
||||
using IoctlHelperPrelim20::IoctlHelperPrelim20;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency) override {
|
||||
latency = 1;
|
||||
return mockFabricLatencyReturn;
|
||||
}
|
||||
|
||||
bool mockFabricLatencyReturn = true;
|
||||
};
|
||||
|
||||
using FabricIafEdgeFixture = Test<MultiDeviceFixture>;
|
||||
TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesThenEdgesCreatedAreCorrect) {
|
||||
|
||||
// Setup OsInterface for Devices
|
||||
for (auto &device : driverHandle->devices) {
|
||||
auto executionEnvironment = device->getNEODevice()->getExecutionEnvironment();
|
||||
auto &rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()];
|
||||
auto osInterface = new OSInterface();
|
||||
auto drmMock = new DrmMockResources(*rootDeviceEnvironment);
|
||||
drmMock->ioctlHelper.reset(new MockIoctlHelperIafTest(*drmMock));
|
||||
rootDeviceEnvironment->osInterface.reset(osInterface);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<Drm>(drmMock));
|
||||
}
|
||||
|
||||
// IAF port connection configuration
|
||||
// Device | SubDevice | Port -- Connected to -- Device | SubDevice | Port
|
||||
// 0 0 1 1 0 2
|
||||
|
@ -410,9 +432,9 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 4u);
|
||||
EXPECT_EQ(edgeProperties.bandwidthUnit, ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC);
|
||||
EXPECT_EQ(edgeProperties.latency, 0u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_UNKNOWN);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_EQ(edgeProperties.latency, 1u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_HOP);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
EXPECT_EQ(edgeProperties.duplexity, ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX);
|
||||
|
||||
// Root to Sub-Devices Connection
|
||||
|
@ -424,7 +446,9 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex0->toHandle(), fabricVertex1->subVertices[0], &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 2u);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_EQ(edgeProperties.latency, 1u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_HOP);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
|
||||
count = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex0->toHandle(), fabricVertex1->subVertices[1], &count, nullptr));
|
||||
|
@ -433,7 +457,9 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex0->toHandle(), fabricVertex1->subVertices[1], &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 2u);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_EQ(edgeProperties.latency, 1u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_HOP);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
|
||||
// Sub-Devices to Root Connection
|
||||
count = 0;
|
||||
|
@ -443,7 +469,9 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex0->subVertices[0], fabricVertex1->toHandle(), &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 2u);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_EQ(edgeProperties.latency, 1u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_HOP);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
|
||||
count = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex0->subVertices[1], fabricVertex1->toHandle(), &count, nullptr));
|
||||
|
@ -452,7 +480,7 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex0->subVertices[1], fabricVertex1->toHandle(), &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 2u);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
|
||||
// Sub-Devices to Sub-Devices Connection
|
||||
count = 0;
|
||||
|
@ -465,7 +493,7 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(edgeProperties.bandwidthUnit, ZE_BANDWIDTH_UNIT_UNKNOWN);
|
||||
EXPECT_EQ(edgeProperties.latency, 0u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_UNKNOWN);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "MDFI"), 0);
|
||||
EXPECT_STREQ(edgeProperties.model, "MDFI");
|
||||
EXPECT_EQ(edgeProperties.duplexity, ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX);
|
||||
|
||||
count = 0;
|
||||
|
@ -474,7 +502,7 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
edges.clear();
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->subVertices[0], fabricVertex1->subVertices[1], &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "MDFI"), 0);
|
||||
EXPECT_STREQ(edgeProperties.model, "MDFI");
|
||||
|
||||
count = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->subVertices[0], fabricVertex0->subVertices[0], &count, nullptr));
|
||||
|
@ -483,7 +511,9 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->subVertices[0], fabricVertex0->subVertices[0], &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 2u);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
EXPECT_EQ(edgeProperties.latency, 1u);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_HOP);
|
||||
|
||||
count = 0;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->subVertices[1], fabricVertex0->subVertices[1], &count, nullptr));
|
||||
|
@ -492,7 +522,87 @@ TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenCreatingEdgesT
|
|||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->subVertices[1], fabricVertex0->subVertices[1], &count, edges.data()));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidth, 2u);
|
||||
EXPECT_EQ(strcmp(edgeProperties.model, "XeLink"), 0);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
}
|
||||
|
||||
TEST_F(FabricIafEdgeFixture, GivenMultipleDevicesAndSubDevicesWhenLatencyRequestIoctlFailsThenEdgeLatencyPropertiesAreUnknown) {
|
||||
|
||||
// Setup OsInterface for Devices
|
||||
for (auto &device : driverHandle->devices) {
|
||||
auto executionEnvironment = device->getNEODevice()->getExecutionEnvironment();
|
||||
auto &rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()];
|
||||
auto osInterface = new OSInterface();
|
||||
auto drmMock = new DrmMockResources(*rootDeviceEnvironment);
|
||||
auto mockIoctlHelper = new MockIoctlHelperIafTest(*drmMock);
|
||||
mockIoctlHelper->mockFabricLatencyReturn = false;
|
||||
drmMock->ioctlHelper.reset(mockIoctlHelper);
|
||||
rootDeviceEnvironment->osInterface.reset(osInterface);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->osInterface->setDriverModel(std::unique_ptr<Drm>(drmMock));
|
||||
}
|
||||
|
||||
// IAF port connection configuration
|
||||
// Device | SubDevice | Port -- Connected to -- Device | SubDevice | Port
|
||||
// 0 0 1 1 0 2
|
||||
|
||||
std::vector<FabricPortConnection> connection_00_10;
|
||||
{
|
||||
FabricPortConnection connection;
|
||||
connection.currentid = IafPortId(0, 0, 1);
|
||||
connection.neighbourPortNumber = 2;
|
||||
connection.neighbourGuid = 0xABC;
|
||||
connection.bandwidthInBytesPerNanoSecond = 1;
|
||||
connection.isDuplex = true;
|
||||
connection_00_10.push_back(connection);
|
||||
}
|
||||
|
||||
std::vector<FabricPortConnection> connection_10_00;
|
||||
{
|
||||
FabricPortConnection connection;
|
||||
connection.currentid = IafPortId(1, 0, 2);
|
||||
connection.neighbourPortNumber = 1;
|
||||
connection.neighbourGuid = 0xA;
|
||||
connection.bandwidthInBytesPerNanoSecond = 1;
|
||||
connection.isDuplex = true;
|
||||
connection_10_00.push_back(connection);
|
||||
}
|
||||
|
||||
auto &fabricVertex0 = driverHandle->fabricVertices[0];
|
||||
{
|
||||
auto fabricDeviceIaf = static_cast<FabricDeviceIaf *>(fabricVertex0->pFabricDeviceInterfaces[FabricDeviceInterface::Type::Iaf].get());
|
||||
auto &fabricSubDeviceIaf0 = fabricDeviceIaf->subDeviceIafs[0];
|
||||
fabricSubDeviceIaf0->connections.clear();
|
||||
fabricSubDeviceIaf0->connections = connection_00_10;
|
||||
fabricSubDeviceIaf0->guid = 0xA;
|
||||
}
|
||||
|
||||
auto fabricVertex1 = static_cast<FabricVertex *>(driverHandle->fabricVertices[1]);
|
||||
{
|
||||
auto fabricDeviceIaf = static_cast<FabricDeviceIaf *>(fabricVertex1->pFabricDeviceInterfaces[FabricDeviceInterface::Type::Iaf].get());
|
||||
auto &fabricSubDeviceIaf0 = fabricDeviceIaf->subDeviceIafs[0];
|
||||
fabricSubDeviceIaf0->connections.clear();
|
||||
fabricSubDeviceIaf0->connections = connection_10_00;
|
||||
fabricSubDeviceIaf0->guid = 0xABC;
|
||||
}
|
||||
|
||||
for (auto &edge : driverHandle->fabricEdges) {
|
||||
delete edge;
|
||||
}
|
||||
driverHandle->fabricEdges.clear();
|
||||
FabricEdge::createEdgesFromVertices(driverHandle->fabricVertices, driverHandle->fabricEdges);
|
||||
uint32_t count = 0;
|
||||
std::vector<ze_fabric_edge_handle_t> edges(30);
|
||||
|
||||
// Root to Root Connection
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->toHandle(), fabricVertex0->toHandle(), &count, nullptr));
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetExp(fabricVertex1->toHandle(), fabricVertex0->toHandle(), &count, edges.data()));
|
||||
ze_fabric_vertex_handle_t vertexA = nullptr, vertexB = nullptr;
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetVerticesExp(edges[0], &vertexA, &vertexB));
|
||||
ze_fabric_edge_exp_properties_t edgeProperties = {};
|
||||
EXPECT_EQ(ZE_RESULT_SUCCESS, L0::zeFabricEdgeGetPropertiesExp(edges[0], &edgeProperties));
|
||||
EXPECT_EQ(edgeProperties.bandwidthUnit, ZE_BANDWIDTH_UNIT_BYTES_PER_NANOSEC);
|
||||
EXPECT_EQ(edgeProperties.latencyUnit, ZE_LATENCY_UNIT_UNKNOWN);
|
||||
EXPECT_STREQ(edgeProperties.model, "XeLink");
|
||||
EXPECT_EQ(edgeProperties.duplexity, ZE_FABRIC_EDGE_EXP_DUPLEXITY_FULL_DUPLEX);
|
||||
}
|
||||
|
||||
} // namespace ult
|
||||
|
|
|
@ -134,6 +134,7 @@ class IoctlHelper {
|
|||
virtual std::string getFileForMaxGpuFrequency() const;
|
||||
virtual std::string getFileForMaxGpuFrequencyOfSubDevice(int subDeviceId) const;
|
||||
virtual std::string getFileForMaxMemoryFrequencyOfSubDevice(int subDeviceId) const;
|
||||
virtual bool getFabricLatency(uint32_t fabricId, uint32_t &latency) = 0;
|
||||
|
||||
uint32_t getFlagsForPrimeHandleToFd() const;
|
||||
|
||||
|
@ -190,6 +191,7 @@ class IoctlHelperUpstream : public IoctlHelper {
|
|||
int getDrmParamValue(DrmParam drmParam) const override;
|
||||
std::string getDrmParamString(DrmParam param) const override;
|
||||
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency) override;
|
||||
};
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
|
@ -256,6 +258,7 @@ class IoctlHelperPrelim20 : public IoctlHelper {
|
|||
std::string getDrmParamString(DrmParam param) const override;
|
||||
std::string getIoctlString(DrmIoctl ioctlRequest) const override;
|
||||
bool checkIfIoctlReinvokeRequired(int error, DrmIoctl ioctlRequest) const override;
|
||||
bool getFabricLatency(uint32_t fabricId, uint32_t &latency) override;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
|
|
@ -655,6 +655,34 @@ bool IoctlHelperPrelim20::checkIfIoctlReinvokeRequired(int error, DrmIoctl ioctl
|
|||
return IoctlHelper::checkIfIoctlReinvokeRequired(error, ioctlRequest);
|
||||
}
|
||||
|
||||
bool IoctlHelperPrelim20::getFabricLatency(uint32_t fabricId, uint32_t &latency) {
|
||||
Query query = {};
|
||||
QueryItem queryItem = {};
|
||||
PrelimI915::prelim_drm_i915_query_fabric_info info = {};
|
||||
info.fabric_id = fabricId;
|
||||
|
||||
queryItem.queryId = PRELIM_DRM_I915_QUERY_FABRIC_INFO;
|
||||
queryItem.length = static_cast<int32_t>(sizeof(info));
|
||||
queryItem.dataPtr = reinterpret_cast<uint64_t>(&info);
|
||||
queryItem.flags = 0;
|
||||
|
||||
query.itemsPtr = reinterpret_cast<uint64_t>(&queryItem);
|
||||
query.numItems = 1;
|
||||
auto ret = IoctlHelper::ioctl(DrmIoctl::Query, &query);
|
||||
if (ret != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (info.latency < 10) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Latency is in tenths of path length. 10 == 1 fabric link between src and dst
|
||||
// 1 link = zero hops
|
||||
latency = (info.latency / 10) - 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static_assert(sizeof(MemoryClassInstance) == sizeof(prelim_drm_i915_gem_memory_class_instance));
|
||||
static_assert(offsetof(MemoryClassInstance, memoryClass) == offsetof(prelim_drm_i915_gem_memory_class_instance, memory_class));
|
||||
static_assert(offsetof(MemoryClassInstance, memoryInstance) == offsetof(prelim_drm_i915_gem_memory_class_instance, memory_instance));
|
||||
|
|
|
@ -235,4 +235,8 @@ std::string IoctlHelperUpstream::getIoctlString(DrmIoctl ioctlRequest) const {
|
|||
return getIoctlStringBase(ioctlRequest);
|
||||
}
|
||||
}
|
||||
|
||||
bool IoctlHelperUpstream::getFabricLatency(uint32_t fabricId, uint32_t &latency) {
|
||||
return false;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "shared/source/os_interface/linux/i915_prelim.h"
|
||||
#include "shared/source/os_interface/linux/ioctl_helper.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/libult/linux/drm_mock.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
|
@ -348,3 +349,58 @@ TEST_F(IoctlPrelimHelperTests, givenPrelimWhenGettingEuStallPropertiesThenCorrec
|
|||
TEST_F(IoctlPrelimHelperTests, givenPrelimWhenGettingEuStallFdParameterThenCorrectIoctlValueIsReturned) {
|
||||
EXPECT_EQ(static_cast<uint32_t>(PRELIM_I915_PERF_FLAG_FD_EU_STALL), ioctlHelper.getEuStallFdParameter());
|
||||
}
|
||||
|
||||
class DrmMockIoctl : public DrmMock {
|
||||
public:
|
||||
DrmMockIoctl(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMock(rootDeviceEnvironment) {
|
||||
rootDeviceEnvironment.setHwInfo(defaultHwInfo.get());
|
||||
}
|
||||
int handleRemainingRequests(DrmIoctl request, void *arg) override {
|
||||
if (request == DrmIoctl::Query) {
|
||||
|
||||
Query *query = static_cast<Query *>(arg);
|
||||
QueryItem *queryItem = reinterpret_cast<QueryItem *>(query->itemsPtr);
|
||||
PrelimI915::prelim_drm_i915_query_fabric_info *info =
|
||||
reinterpret_cast<PrelimI915::prelim_drm_i915_query_fabric_info *>(queryItem->dataPtr);
|
||||
|
||||
info->latency = mockLatency;
|
||||
return mockIoctlReturn;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int mockIoctlReturn = 0;
|
||||
uint32_t mockLatency = 10;
|
||||
};
|
||||
|
||||
TEST(IoctlPrelimHelperFabricLatencyTest, givenPrelimWhenGettingFabricLatencyThenSuccessIsReturned) {
|
||||
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
std::unique_ptr<DrmMockIoctl> drm = std::make_unique<DrmMockIoctl>(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
IoctlHelperPrelim20 ioctlHelper{*drm};
|
||||
|
||||
uint32_t latency = 0, fabricId = 0;
|
||||
EXPECT_TRUE(ioctlHelper.getFabricLatency(fabricId, latency));
|
||||
}
|
||||
|
||||
TEST(IoctlPrelimHelperFabricLatencyTest, givenPrelimWhenGettingFabricLatencyAndIoctlFailsThenErrorIsReturned) {
|
||||
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
std::unique_ptr<DrmMockIoctl> drm = std::make_unique<DrmMockIoctl>(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
IoctlHelperPrelim20 ioctlHelper{*drm};
|
||||
|
||||
uint32_t latency = 0, fabricId = 0;
|
||||
drm->mockIoctlReturn = 1;
|
||||
EXPECT_FALSE(ioctlHelper.getFabricLatency(fabricId, latency));
|
||||
}
|
||||
|
||||
TEST(IoctlPrelimHelperFabricLatencyTest, givenPrelimWhenGettingFabricLatencyAndIoctlSetsZeroForLatencyThenErrorIsReturned) {
|
||||
|
||||
MockExecutionEnvironment executionEnvironment{};
|
||||
std::unique_ptr<DrmMockIoctl> drm = std::make_unique<DrmMockIoctl>(*executionEnvironment.rootDeviceEnvironments[0]);
|
||||
IoctlHelperPrelim20 ioctlHelper{*drm};
|
||||
|
||||
uint32_t latency = 0, fabricId = 0;
|
||||
drm->mockIoctlReturn = 0;
|
||||
drm->mockLatency = 0;
|
||||
EXPECT_FALSE(ioctlHelper.getFabricLatency(fabricId, latency));
|
||||
}
|
||||
|
|
|
@ -477,3 +477,11 @@ TEST(IoctlHelperTestsUpstream, givenUpstreamWhenInitializingThenTrueIsReturned)
|
|||
IoctlHelperUpstream ioctlHelper{*drm};
|
||||
EXPECT_EQ(true, ioctlHelper.initialize());
|
||||
}
|
||||
|
||||
TEST(IoctlHelperTestsUpstream, givenUpstreamWhenGettingFabricLatencyThenFalseIsReturned) {
|
||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||
auto drm = std::make_unique<DrmTipMock>(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
IoctlHelperUpstream ioctlHelper{*drm};
|
||||
uint32_t fabricId = 0, latency = 0;
|
||||
EXPECT_FALSE(ioctlHelper.getFabricLatency(fabricId, latency));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue