Revert "fix: initialize tile only when gt type main on xe kmd"
This reverts commit cbde47d638
.
Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
parent
f156a74f54
commit
096e424428
|
@ -45,7 +45,7 @@ namespace NEO {
|
||||||
int IoctlHelperXe::xeGetQuery(Query *data) {
|
int IoctlHelperXe::xeGetQuery(Query *data) {
|
||||||
if (data->numItems == 1) {
|
if (data->numItems == 1) {
|
||||||
QueryItem *queryItem = reinterpret_cast<QueryItem *>(data->itemsPtr);
|
QueryItem *queryItem = reinterpret_cast<QueryItem *>(data->itemsPtr);
|
||||||
std::vector<uint32_t> *queryData = nullptr;
|
std::vector<uint64_t> *queryData = nullptr;
|
||||||
switch (queryItem->queryId) {
|
switch (queryItem->queryId) {
|
||||||
case static_cast<int>(DrmParam::QueryHwconfigTable):
|
case static_cast<int>(DrmParam::QueryHwconfigTable):
|
||||||
queryData = &hwconfigFakei915;
|
queryData = &hwconfigFakei915;
|
||||||
|
@ -54,7 +54,7 @@ int IoctlHelperXe::xeGetQuery(Query *data) {
|
||||||
xeLog("error: bad query 0x%x\n", queryItem->queryId);
|
xeLog("error: bad query 0x%x\n", queryItem->queryId);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
auto queryDataSize = static_cast<int32_t>(queryData->size() * sizeof(uint32_t));
|
auto queryDataSize = static_cast<int32_t>(queryData->size() * sizeof(uint64_t));
|
||||||
if (queryItem->length == 0) {
|
if (queryItem->length == 0) {
|
||||||
queryItem->length = queryDataSize;
|
queryItem->length = queryDataSize;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -165,8 +165,7 @@ bool IoctlHelperXe::initialize() {
|
||||||
memset(&queryConfig, 0, sizeof(queryConfig));
|
memset(&queryConfig, 0, sizeof(queryConfig));
|
||||||
queryConfig.query = DRM_XE_DEVICE_QUERY_HWCONFIG;
|
queryConfig.query = DRM_XE_DEVICE_QUERY_HWCONFIG;
|
||||||
IoctlHelper::ioctl(DrmIoctl::Query, &queryConfig);
|
IoctlHelper::ioctl(DrmIoctl::Query, &queryConfig);
|
||||||
auto newSize = queryConfig.size / sizeof(uint32_t);
|
hwconfigFakei915.resize(queryConfig.size);
|
||||||
hwconfigFakei915.resize(newSize);
|
|
||||||
queryConfig.data = castToUint64(hwconfigFakei915.data());
|
queryConfig.data = castToUint64(hwconfigFakei915.data());
|
||||||
IoctlHelper::ioctl(DrmIoctl::Query, &queryConfig);
|
IoctlHelper::ioctl(DrmIoctl::Query, &queryConfig);
|
||||||
|
|
||||||
|
@ -292,20 +291,17 @@ std::unique_ptr<MemoryInfo> IoctlHelperXe::createMemoryInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto i = 0u; i < xeGtsData->num_gt; i++) {
|
for (auto i = 0u; i < xeGtsData->num_gt; i++) {
|
||||||
if (xeGtsData->gts[i].type == XE_QUERY_GT_TYPE_MAIN) {
|
uint64_t nativeMemRegions = xeGtsData->gts[i].native_mem_regions;
|
||||||
uint64_t nativeMemRegions = xeGtsData->gts[i].native_mem_regions;
|
auto regionIndex = Math::log2(nativeMemRegions);
|
||||||
auto regionIndex = Math::log2(nativeMemRegions);
|
UNRECOVERABLE_IF(!memoryRegionInstances[regionIndex]);
|
||||||
UNRECOVERABLE_IF(!memoryRegionInstances[regionIndex]);
|
regionsContainer.push_back(createMemoryRegionFromXeMemRegion(*memoryRegionInstances[regionIndex]));
|
||||||
regionsContainer.push_back(createMemoryRegionFromXeMemRegion(*memoryRegionInstances[regionIndex]));
|
|
||||||
|
|
||||||
xeTimestampFrequency = xeGtsData->gts[i].clock_freq;
|
xeTimestampFrequency = xeGtsData->gts[i].clock_freq;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return std::make_unique<MemoryInfo>(regionsContainer, drm);
|
return std::make_unique<MemoryInfo>(regionsContainer, drm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IoctlHelperXe::getTopologyData(size_t nTiles, std::vector<std::bitset<8>> *geomDss, std::vector<std::bitset<8>> *computeDss,
|
void IoctlHelperXe::getTopologyData(uint32_t nTiles, std::vector<std::bitset<8>> geomDss[2], std::vector<std::bitset<8>> computeDss[2], std::vector<std::bitset<8>> euDss[2], DrmQueryTopologyData &topologyData, bool &isComputeDssEmpty) {
|
||||||
std::vector<std::bitset<8>> *euDss, DrmQueryTopologyData &topologyData, bool &isComputeDssEmpty) {
|
|
||||||
int subSliceCount = 0;
|
int subSliceCount = 0;
|
||||||
int euPerDss = 0;
|
int euPerDss = 0;
|
||||||
|
|
||||||
|
@ -344,7 +340,7 @@ void IoctlHelperXe::getTopologyData(size_t nTiles, std::vector<std::bitset<8>> *
|
||||||
topologyData.maxSliceCount = 1;
|
topologyData.maxSliceCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IoctlHelperXe::getTopologyMap(size_t nTiles, std::vector<std::bitset<8>> *dssInfo, TopologyMap &topologyMap) {
|
void IoctlHelperXe::getTopologyMap(uint32_t nTiles, std::vector<std::bitset<8>> dssInfo[2], TopologyMap &topologyMap) {
|
||||||
for (auto tileId = 0u; tileId < nTiles; tileId++) {
|
for (auto tileId = 0u; tileId < nTiles; tileId++) {
|
||||||
std::vector<int> sliceIndices;
|
std::vector<int> sliceIndices;
|
||||||
std::vector<int> subSliceIndices;
|
std::vector<int> subSliceIndices;
|
||||||
|
@ -375,49 +371,34 @@ bool IoctlHelperXe::getTopologyDataAndMap(const HardwareInfo &hwInfo, DrmQueryTo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StackVec<std::vector<std::bitset<8>>, 2> geomDss;
|
std::vector<std::bitset<8>> geomDss[2];
|
||||||
StackVec<std::vector<std::bitset<8>>, 2> computeDss;
|
std::vector<std::bitset<8>> computeDss[2];
|
||||||
StackVec<std::vector<std::bitset<8>>, 2> euDss;
|
std::vector<std::bitset<8>> euDss[2];
|
||||||
StackVec<int, 2> gtIdToTile{-1};
|
|
||||||
|
|
||||||
auto topologySize = queryGtTopology.size();
|
auto topologySize = queryGtTopology.size();
|
||||||
auto dataPtr = queryGtTopology.data();
|
auto dataPtr = queryGtTopology.data();
|
||||||
|
|
||||||
auto gtsData = queryData<uint64_t>(DRM_XE_DEVICE_QUERY_GTS);
|
auto nTiles = 1u;
|
||||||
auto xeGtsData = reinterpret_cast<drm_xe_query_gts *>(gtsData.data());
|
|
||||||
gtIdToTile.resize(xeGtsData->num_gt, -1);
|
|
||||||
|
|
||||||
auto tileIndex = 0u;
|
|
||||||
for (auto gt = 0u; gt < gtIdToTile.size(); gt++) {
|
|
||||||
if (xeGtsData->gts[gt].type == XE_QUERY_GT_TYPE_MAIN) {
|
|
||||||
gtIdToTile[gt] = tileIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
geomDss.resize(tileIndex);
|
|
||||||
computeDss.resize(tileIndex);
|
|
||||||
euDss.resize(tileIndex);
|
|
||||||
while (topologySize >= sizeof(drm_xe_query_topology_mask)) {
|
while (topologySize >= sizeof(drm_xe_query_topology_mask)) {
|
||||||
drm_xe_query_topology_mask *topo = reinterpret_cast<drm_xe_query_topology_mask *>(dataPtr);
|
drm_xe_query_topology_mask *topo = reinterpret_cast<drm_xe_query_topology_mask *>(dataPtr);
|
||||||
UNRECOVERABLE_IF(topo == nullptr);
|
UNRECOVERABLE_IF(topo == nullptr);
|
||||||
|
|
||||||
uint32_t gtId = topo->gt_id;
|
uint32_t tileId = topo->gt_id;
|
||||||
|
nTiles = std::max(tileId + 1, nTiles);
|
||||||
|
|
||||||
if (xeGtsData->gts[gtId].type == XE_QUERY_GT_TYPE_MAIN) {
|
switch (topo->type) {
|
||||||
switch (topo->type) {
|
case XE_TOPO_DSS_GEOMETRY:
|
||||||
case XE_TOPO_DSS_GEOMETRY:
|
fillMask(geomDss[tileId], topo);
|
||||||
fillMask(geomDss[gtIdToTile[gtId]], topo);
|
break;
|
||||||
break;
|
case XE_TOPO_DSS_COMPUTE:
|
||||||
case XE_TOPO_DSS_COMPUTE:
|
fillMask(computeDss[tileId], topo);
|
||||||
fillMask(computeDss[gtIdToTile[gtId]], topo);
|
break;
|
||||||
break;
|
case XE_TOPO_EU_PER_DSS:
|
||||||
case XE_TOPO_EU_PER_DSS:
|
fillMask(euDss[tileId], topo);
|
||||||
fillMask(euDss[gtIdToTile[gtId]], topo);
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
xeLog("Unhandle GT Topo type: %d\n", topo->type);
|
||||||
xeLog("Unhandle GT Topo type: %d\n", topo->type);
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t itemSize = sizeof(drm_xe_query_topology_mask) + topo->num_bytes;
|
uint32_t itemSize = sizeof(drm_xe_query_topology_mask) + topo->num_bytes;
|
||||||
|
@ -426,10 +407,10 @@ bool IoctlHelperXe::getTopologyDataAndMap(const HardwareInfo &hwInfo, DrmQueryTo
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isComputeDssEmpty = false;
|
bool isComputeDssEmpty = false;
|
||||||
getTopologyData(tileIndex, geomDss.begin(), computeDss.begin(), euDss.begin(), topologyData, isComputeDssEmpty);
|
getTopologyData(nTiles, geomDss, computeDss, euDss, topologyData, isComputeDssEmpty);
|
||||||
|
|
||||||
auto &dssInfo = isComputeDssEmpty ? geomDss : computeDss;
|
auto &dssInfo = isComputeDssEmpty ? geomDss : computeDss;
|
||||||
getTopologyMap(tileIndex, dssInfo.begin(), topologyMap);
|
getTopologyMap(nTiles, dssInfo, topologyMap);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,8 +105,8 @@ class IoctlHelperXe : public IoctlHelper {
|
||||||
bool isWaitBeforeBindRequired(bool bind) const override;
|
bool isWaitBeforeBindRequired(bool bind) const override;
|
||||||
std::unique_ptr<EngineInfo> createEngineInfo(bool isSysmanEnabled) override;
|
std::unique_ptr<EngineInfo> createEngineInfo(bool isSysmanEnabled) override;
|
||||||
std::unique_ptr<MemoryInfo> createMemoryInfo() override;
|
std::unique_ptr<MemoryInfo> createMemoryInfo() override;
|
||||||
void getTopologyData(size_t nTiles, std::vector<std::bitset<8>> *geomDss, std::vector<std::bitset<8>> *computeDss, std::vector<std::bitset<8>> *euDss, DrmQueryTopologyData &topologyData, bool &isComputeDssEmpty);
|
void getTopologyData(uint32_t nTiles, std::vector<std::bitset<8>> geomDss[2], std::vector<std::bitset<8>> computeDss[2], std::vector<std::bitset<8>> euDss[2], DrmQueryTopologyData &topologyData, bool &isComputeDssEmpty);
|
||||||
void getTopologyMap(size_t nTiles, std::vector<std::bitset<8>> *dssInfo, TopologyMap &topologyMap);
|
void getTopologyMap(uint32_t nTiles, std::vector<std::bitset<8>> dssInfo[2], TopologyMap &topologyMap);
|
||||||
void fillBindInfoForIpcHandle(uint32_t handle, size_t size) override;
|
void fillBindInfoForIpcHandle(uint32_t handle, size_t size) override;
|
||||||
bool isImmediateVmBindRequired() const override;
|
bool isImmediateVmBindRequired() const override;
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ class IoctlHelperXe : public IoctlHelper {
|
||||||
std::vector<BindInfo> bindInfo;
|
std::vector<BindInfo> bindInfo;
|
||||||
int instance = 0;
|
int instance = 0;
|
||||||
uint32_t xeTimestampFrequency = 0;
|
uint32_t xeTimestampFrequency = 0;
|
||||||
std::vector<uint32_t> hwconfigFakei915;
|
std::vector<uint64_t> hwconfigFakei915;
|
||||||
std::vector<drm_xe_engine_class_instance> contextParamEngine;
|
std::vector<drm_xe_engine_class_instance> contextParamEngine;
|
||||||
std::vector<drm_xe_engine_class_instance> allEngines;
|
std::vector<drm_xe_engine_class_instance> allEngines;
|
||||||
};
|
};
|
||||||
|
|
|
@ -145,8 +145,8 @@ class DrmMockXe : public DrmMockCustom {
|
||||||
MemoryConstants::gigaByte // used size
|
MemoryConstants::gigaByte // used size
|
||||||
};
|
};
|
||||||
|
|
||||||
auto xeQueryGts = reinterpret_cast<drm_xe_query_gts *>(queryGts.begin());
|
auto xeQueryGts = reinterpret_cast<drm_xe_query_gts *>(queryGts);
|
||||||
xeQueryGts->num_gt = 3;
|
xeQueryGts->num_gt = 2;
|
||||||
xeQueryGts->gts[0] = {
|
xeQueryGts->gts[0] = {
|
||||||
XE_QUERY_GT_TYPE_MAIN, // type
|
XE_QUERY_GT_TYPE_MAIN, // type
|
||||||
0, // instance
|
0, // instance
|
||||||
|
@ -157,22 +157,13 @@ class DrmMockXe : public DrmMockCustom {
|
||||||
0 // inaccessible mem regions
|
0 // inaccessible mem regions
|
||||||
};
|
};
|
||||||
xeQueryGts->gts[1] = {
|
xeQueryGts->gts[1] = {
|
||||||
XE_QUERY_GT_TYPE_MEDIA, // type
|
XE_QUERY_GT_TYPE_REMOTE, // type
|
||||||
1, // instance
|
1, // instance
|
||||||
12500000, // clock freq
|
12500000, // clock freq
|
||||||
0, // features
|
0, // features
|
||||||
0b001, // native mem regions
|
0b010, // native mem regions
|
||||||
0x110, // slow mem regions
|
0x101, // slow mem regions
|
||||||
0 // inaccessible mem regions
|
0 // inaccessible mem regions
|
||||||
};
|
|
||||||
xeQueryGts->gts[2] = {
|
|
||||||
XE_QUERY_GT_TYPE_MAIN, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b010, // native mem regions
|
|
||||||
0x101, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +250,7 @@ class DrmMockXe : public DrmMockCustom {
|
||||||
break;
|
break;
|
||||||
case DRM_XE_DEVICE_QUERY_GTS:
|
case DRM_XE_DEVICE_QUERY_GTS:
|
||||||
if (deviceQuery->data) {
|
if (deviceQuery->data) {
|
||||||
memcpy_s(reinterpret_cast<void *>(deviceQuery->data), deviceQuery->size, queryGts.begin(), sizeof(queryGts));
|
memcpy_s(reinterpret_cast<void *>(deviceQuery->data), deviceQuery->size, queryGts, sizeof(queryGts));
|
||||||
}
|
}
|
||||||
deviceQuery->size = sizeof(queryGts);
|
deviceQuery->size = sizeof(queryGts);
|
||||||
break;
|
break;
|
||||||
|
@ -336,7 +327,7 @@ class DrmMockXe : public DrmMockCustom {
|
||||||
static_assert(sizeof(drm_xe_query_mem_region) == 12 * sizeof(uint64_t), "");
|
static_assert(sizeof(drm_xe_query_mem_region) == 12 * sizeof(uint64_t), "");
|
||||||
uint64_t queryMemUsage[37]{}; // 1 qword for num regions and 12 qwords per region
|
uint64_t queryMemUsage[37]{}; // 1 qword for num regions and 12 qwords per region
|
||||||
static_assert(sizeof(drm_xe_query_gts::drm_xe_query_gt) == 13 * sizeof(uint64_t), "");
|
static_assert(sizeof(drm_xe_query_gts::drm_xe_query_gt) == 13 * sizeof(uint64_t), "");
|
||||||
StackVec<uint64_t, 40> queryGts{}; // 1 qword for num gts and 13 qwords per gt
|
uint64_t queryGts[27]{}; // 1 qword for num gts and 13 qwords per gt
|
||||||
std::vector<uint8_t> queryTopology;
|
std::vector<uint8_t> queryTopology;
|
||||||
StackVec<drm_xe_wait_user_fence, 1> waitUserFenceInputs;
|
StackVec<drm_xe_wait_user_fence, 1> waitUserFenceInputs;
|
||||||
StackVec<drm_xe_vm_bind, 1> vmBindInputs;
|
StackVec<drm_xe_vm_bind, 1> vmBindInputs;
|
||||||
|
@ -941,11 +932,11 @@ TEST(IoctlHelperXeTest, givenGeomDssWhenGetTopologyDataAndMapThenResultsAreCorre
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||||
|
|
||||||
uint16_t tileId = 0;
|
uint16_t tileId = 0;
|
||||||
for (auto gtId = 0u; gtId < 3u; gtId++) {
|
|
||||||
drm.addMockedQueryTopologyData(gtId, XE_TOPO_DSS_GEOMETRY, 8, {0b11'1111, 0, 0, 0, 0, 0, 0, 0});
|
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_GEOMETRY, 8, {0b11'1111, 0, 0, 0, 0, 0, 0, 0});
|
||||||
drm.addMockedQueryTopologyData(gtId, XE_TOPO_DSS_COMPUTE, 8, {0, 0, 0, 0, 0, 0, 0, 0});
|
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_COMPUTE, 8, {0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
drm.addMockedQueryTopologyData(gtId, XE_TOPO_EU_PER_DSS, 8, {0b1111'1111, 0b1111'1111, 0, 0, 0, 0, 0, 0});
|
drm.addMockedQueryTopologyData(tileId, XE_TOPO_EU_PER_DSS, 8, {0b1111'1111, 0b1111'1111, 0, 0, 0, 0, 0, 0});
|
||||||
}
|
|
||||||
DrmQueryTopologyData topologyData{};
|
DrmQueryTopologyData topologyData{};
|
||||||
TopologyMap topologyMap{};
|
TopologyMap topologyMap{};
|
||||||
|
|
||||||
|
@ -988,11 +979,9 @@ TEST(IoctlHelperXeTest, givenComputeDssWhenGetTopologyDataAndMapThenResultsAreCo
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||||
|
|
||||||
uint16_t tileId = 0;
|
uint16_t tileId = 0;
|
||||||
for (auto gtId = 0u; gtId < 3u; gtId++) {
|
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_GEOMETRY, 8, {0, 0, 0, 0, 0, 0, 0, 0});
|
||||||
drm.addMockedQueryTopologyData(gtId, XE_TOPO_DSS_GEOMETRY, 8, {0, 0, 0, 0, 0, 0, 0, 0});
|
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_COMPUTE, 8, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
|
||||||
drm.addMockedQueryTopologyData(gtId, XE_TOPO_DSS_COMPUTE, 8, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
|
drm.addMockedQueryTopologyData(tileId, XE_TOPO_EU_PER_DSS, 8, {0b1111'1111, 0, 0, 0, 0, 0, 0, 0});
|
||||||
drm.addMockedQueryTopologyData(gtId, XE_TOPO_EU_PER_DSS, 8, {0b1111'1111, 0, 0, 0, 0, 0, 0, 0});
|
|
||||||
}
|
|
||||||
|
|
||||||
DrmQueryTopologyData topologyData{};
|
DrmQueryTopologyData topologyData{};
|
||||||
TopologyMap topologyMap{};
|
TopologyMap topologyMap{};
|
||||||
|
@ -1033,183 +1022,10 @@ TEST(IoctlHelperXeTest, givenComputeDssWhenGetTopologyDataAndMapThenResultsAreCo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(IoctlHelperXeTest, givenOnlyMediaTypeWhenGetTopologyDataAndMapThenSubsliceIndicesNotSet) {
|
|
||||||
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
||||||
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
||||||
auto xeQueryGts = reinterpret_cast<drm_xe_query_gts *>(drm.queryGts.begin());
|
|
||||||
xeQueryGts->num_gt = 1;
|
|
||||||
xeQueryGts->gts[0] = {
|
|
||||||
XE_QUERY_GT_TYPE_MEDIA, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b100, // native mem regions
|
|
||||||
0x011, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
|
|
||||||
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
|
||||||
|
|
||||||
uint16_t tileId = 0;
|
|
||||||
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_GEOMETRY, 8, {0, 0, 0, 0, 0, 0, 0, 0});
|
|
||||||
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_COMPUTE, 8, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
|
|
||||||
drm.addMockedQueryTopologyData(tileId, XE_TOPO_EU_PER_DSS, 8, {0b1111'1111, 0, 0, 0, 0, 0, 0, 0});
|
|
||||||
|
|
||||||
DrmQueryTopologyData topologyData{};
|
|
||||||
TopologyMap topologyMap{};
|
|
||||||
|
|
||||||
auto result = xeIoctlHelper->getTopologyDataAndMap(hwInfo, topologyData, topologyMap);
|
|
||||||
ASSERT_TRUE(result);
|
|
||||||
|
|
||||||
// verify topology data
|
|
||||||
EXPECT_EQ(1, topologyData.sliceCount);
|
|
||||||
EXPECT_EQ(1, topologyData.maxSliceCount);
|
|
||||||
|
|
||||||
EXPECT_EQ(0, topologyData.subSliceCount);
|
|
||||||
EXPECT_EQ(0, topologyData.maxSubSliceCount);
|
|
||||||
|
|
||||||
EXPECT_EQ(0, topologyData.euCount);
|
|
||||||
EXPECT_EQ(0, topologyData.maxEuPerSubSlice);
|
|
||||||
|
|
||||||
// verify topology map
|
|
||||||
ASSERT_EQ(0u, topologyMap[tileId].sliceIndices.size());
|
|
||||||
|
|
||||||
ASSERT_EQ(0u, topologyMap[tileId].subsliceIndices.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(IoctlHelperXeTest, givenMainAndMediaTypesWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
|
||||||
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
|
||||||
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
|
||||||
drm.queryGts.resize(53);
|
|
||||||
auto xeQueryGts = reinterpret_cast<drm_xe_query_gts *>(drm.queryGts.begin());
|
|
||||||
xeQueryGts->num_gt = 4;
|
|
||||||
xeQueryGts->gts[0] = {
|
|
||||||
XE_QUERY_GT_TYPE_MAIN, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b100, // native mem regions
|
|
||||||
0x011, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
xeQueryGts->gts[1] = {
|
|
||||||
XE_QUERY_GT_TYPE_MEDIA, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b100, // native mem regions
|
|
||||||
0x011, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
xeQueryGts->gts[2] = {
|
|
||||||
XE_QUERY_GT_TYPE_MAIN, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b010, // native mem regions
|
|
||||||
0x101, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
xeQueryGts->gts[3] = {
|
|
||||||
XE_QUERY_GT_TYPE_MEDIA, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b001, // native mem regions
|
|
||||||
0x100, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
|
|
||||||
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
|
||||||
for (auto tileId = 0; tileId < 4; tileId++) {
|
|
||||||
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_GEOMETRY, 8, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
|
|
||||||
drm.addMockedQueryTopologyData(tileId, XE_TOPO_DSS_COMPUTE, 8, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
|
|
||||||
drm.addMockedQueryTopologyData(tileId, XE_TOPO_EU_PER_DSS, 8, {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff});
|
|
||||||
}
|
|
||||||
|
|
||||||
DrmQueryTopologyData topologyData{};
|
|
||||||
TopologyMap topologyMap{};
|
|
||||||
|
|
||||||
auto result = xeIoctlHelper->getTopologyDataAndMap(hwInfo, topologyData, topologyMap);
|
|
||||||
ASSERT_TRUE(result);
|
|
||||||
|
|
||||||
// verify topology data
|
|
||||||
EXPECT_EQ(1, topologyData.sliceCount);
|
|
||||||
EXPECT_EQ(1, topologyData.maxSliceCount);
|
|
||||||
|
|
||||||
EXPECT_EQ(64, topologyData.subSliceCount);
|
|
||||||
EXPECT_EQ(64, topologyData.maxSubSliceCount);
|
|
||||||
|
|
||||||
EXPECT_EQ(4096, topologyData.euCount);
|
|
||||||
EXPECT_EQ(64, topologyData.maxEuPerSubSlice);
|
|
||||||
EXPECT_EQ(2u, topologyMap.size());
|
|
||||||
// verify topology map
|
|
||||||
for (auto tileId : {0u, 1u}) {
|
|
||||||
ASSERT_EQ(1u, topologyMap[tileId].sliceIndices.size());
|
|
||||||
ASSERT_EQ(64u, topologyMap[tileId].subsliceIndices.size());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DrmMockXe2T : public DrmMockXe {
|
|
||||||
DrmMockXe2T(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockXe(rootDeviceEnvironment) {
|
|
||||||
auto xeQueryMemUsage = reinterpret_cast<drm_xe_query_mem_usage *>(queryMemUsage);
|
|
||||||
xeQueryMemUsage->num_regions = 3;
|
|
||||||
xeQueryMemUsage->regions[0] = {
|
|
||||||
XE_MEM_REGION_CLASS_VRAM, // class
|
|
||||||
1, // instance
|
|
||||||
0, // padding
|
|
||||||
MemoryConstants::pageSize, // min page size
|
|
||||||
2 * MemoryConstants::gigaByte, // total size
|
|
||||||
MemoryConstants::megaByte // used size
|
|
||||||
};
|
|
||||||
xeQueryMemUsage->regions[1] = {
|
|
||||||
XE_MEM_REGION_CLASS_SYSMEM, // class
|
|
||||||
0, // instance
|
|
||||||
0, // padding
|
|
||||||
MemoryConstants::pageSize, // min page size
|
|
||||||
MemoryConstants::gigaByte, // total size
|
|
||||||
MemoryConstants::kiloByte // used size
|
|
||||||
};
|
|
||||||
xeQueryMemUsage->regions[2] = {
|
|
||||||
XE_MEM_REGION_CLASS_VRAM, // class
|
|
||||||
2, // instance
|
|
||||||
0, // padding
|
|
||||||
MemoryConstants::pageSize, // min page size
|
|
||||||
4 * MemoryConstants::gigaByte, // total size
|
|
||||||
MemoryConstants::gigaByte // used size
|
|
||||||
};
|
|
||||||
queryGts.resize(27);
|
|
||||||
auto xeQueryGts = reinterpret_cast<drm_xe_query_gts *>(queryGts.begin());
|
|
||||||
xeQueryGts->num_gt = 2;
|
|
||||||
xeQueryGts->gts[0] = {
|
|
||||||
XE_QUERY_GT_TYPE_MAIN, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b100, // native mem regions
|
|
||||||
0x011, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
xeQueryGts->gts[1] = {
|
|
||||||
XE_QUERY_GT_TYPE_MAIN, // type
|
|
||||||
0, // instance
|
|
||||||
12500000, // clock freq
|
|
||||||
0, // features
|
|
||||||
0b010, // native mem regions
|
|
||||||
0x101, // slow mem regions
|
|
||||||
0 // inaccessible mem regions
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST(IoctlHelperXeTest, given2TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
TEST(IoctlHelperXeTest, given2TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
||||||
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
DrmMockXe2T drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||||
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||||
|
|
||||||
|
@ -1264,7 +1080,7 @@ TEST(IoctlHelperXeTest, given2TileAndComputeDssWhenGetTopologyDataAndMapThenResu
|
||||||
|
|
||||||
TEST(IoctlHelperXeTest, given2TileWithDisabledDssOn1TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
TEST(IoctlHelperXeTest, given2TileWithDisabledDssOn1TileAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
DrmMockXe2T drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||||
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||||
|
|
||||||
|
@ -1330,7 +1146,7 @@ TEST(IoctlHelperXeTest, given2TileWithDisabledDssOn1TileAndComputeDssWhenGetTopo
|
||||||
TEST(IoctlHelperXeTest, given2TileWithDisabledEvenDssAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
TEST(IoctlHelperXeTest, given2TileWithDisabledEvenDssAndComputeDssWhenGetTopologyDataAndMapThenResultsAreCorrect) {
|
||||||
|
|
||||||
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
auto executionEnvironment = std::make_unique<MockExecutionEnvironment>();
|
||||||
DrmMockXe2T drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
DrmMockXe drm{*executionEnvironment->rootDeviceEnvironments[0]};
|
||||||
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
auto &hwInfo = *executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||||
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
auto xeIoctlHelper = std::make_unique<MockIoctlHelperXe>(drm);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue