fix: correct querying engines from xe kmd
we get drm_xe_query_engines, not array of drm_xe_engine_class_instance Related-To: NEO-10496 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
parent
eb259c1f52
commit
833fa6bce1
|
@ -191,29 +191,29 @@ std::vector<DataType> IoctlHelperXe::queryData(uint32_t queryId) {
|
|||
}
|
||||
|
||||
std::unique_ptr<EngineInfo> IoctlHelperXe::createEngineInfo(bool isSysmanEnabled) {
|
||||
auto enginesData = queryData<uint16_t>(DRM_XE_DEVICE_QUERY_ENGINES);
|
||||
|
||||
auto numberHwEngines = enginesData.size() * sizeof(uint16_t) /
|
||||
sizeof(struct drm_xe_engine_class_instance);
|
||||
|
||||
xeLog("numberHwEngines=%d\n", numberHwEngines);
|
||||
auto enginesData = queryData<uint64_t>(DRM_XE_DEVICE_QUERY_ENGINES);
|
||||
|
||||
if (enginesData.empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto queriedEngines = reinterpret_cast<struct drm_xe_engine_class_instance *>(enginesData.data());
|
||||
auto queryEngines = reinterpret_cast<struct drm_xe_query_engines *>(enginesData.data());
|
||||
|
||||
auto numberHwEngines = queryEngines->num_engines;
|
||||
|
||||
xeLog("numberHwEngines=%d\n", numberHwEngines);
|
||||
|
||||
StackVec<std::vector<EngineClassInstance>, 2> enginesPerTile{};
|
||||
std::bitset<8> multiTileMask{};
|
||||
|
||||
for (auto i = 0u; i < numberHwEngines; i++) {
|
||||
auto tile = queriedEngines[i].gt_id;
|
||||
const auto &engine = queryEngines->engines[i].instance;
|
||||
auto tile = engine.gt_id;
|
||||
multiTileMask.set(tile);
|
||||
EngineClassInstance engineClassInstance{};
|
||||
engineClassInstance.engineClass = queriedEngines[i].engine_class;
|
||||
engineClassInstance.engineInstance = queriedEngines[i].engine_instance;
|
||||
xeLog("\t%s:%d\n", xeGetClassName(engineClassInstance.engineClass), engineClassInstance.engineInstance);
|
||||
engineClassInstance.engineClass = engine.engine_class;
|
||||
engineClassInstance.engineInstance = engine.engine_instance;
|
||||
xeLog("\t%s:%d:%d\n", xeGetClassName(engineClassInstance.engineClass), engineClassInstance.engineInstance, engine.gt_id);
|
||||
|
||||
if (engineClassInstance.engineClass == getDrmParamValue(DrmParam::engineClassCompute) ||
|
||||
engineClassInstance.engineClass == getDrmParamValue(DrmParam::engineClassRender) ||
|
||||
|
@ -225,7 +225,7 @@ std::unique_ptr<EngineInfo> IoctlHelperXe::createEngineInfo(bool isSysmanEnabled
|
|||
enginesPerTile.resize(tile + 1);
|
||||
}
|
||||
enginesPerTile[tile].push_back(engineClassInstance);
|
||||
allEngines.push_back(queriedEngines[i]);
|
||||
allEngines.push_back(engine);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,19 @@ class DrmMockXeDebug : public DrmMockCustom {
|
|||
public:
|
||||
DrmMockXeDebug(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockCustom(rootDeviceEnvironment) {
|
||||
this->ioctlHelper = std::make_unique<IoctlHelperXe>(*this);
|
||||
auto xeQueryEngines = reinterpret_cast<drm_xe_query_engines *>(queryEngines);
|
||||
xeQueryEngines->num_engines = 11;
|
||||
xeQueryEngines->engines[0] = {{DRM_XE_ENGINE_CLASS_RENDER, 0, 0}, {}};
|
||||
xeQueryEngines->engines[1] = {{DRM_XE_ENGINE_CLASS_COPY, 1, 0}, {}};
|
||||
xeQueryEngines->engines[2] = {{DRM_XE_ENGINE_CLASS_COPY, 2, 0}, {}};
|
||||
xeQueryEngines->engines[3] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 3, 0}, {}};
|
||||
xeQueryEngines->engines[4] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0}, {}};
|
||||
xeQueryEngines->engines[5] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 5, 1}, {}};
|
||||
xeQueryEngines->engines[6] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1}, {}};
|
||||
xeQueryEngines->engines[7] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 7, 1}, {}};
|
||||
xeQueryEngines->engines[8] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 8, 1}, {}};
|
||||
xeQueryEngines->engines[9] = {{DRM_XE_ENGINE_CLASS_VIDEO_DECODE, 9, 1}, {}};
|
||||
xeQueryEngines->engines[10] = {{DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE, 10, 0}, {}};
|
||||
};
|
||||
|
||||
int getErrno() override {
|
||||
|
@ -160,18 +173,8 @@ class DrmMockXeDebug : public DrmMockCustom {
|
|||
return allowDebugAttach;
|
||||
}
|
||||
|
||||
const drm_xe_engine_class_instance queryEngines[11] = {
|
||||
{DRM_XE_ENGINE_CLASS_RENDER, 0, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COPY, 1, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COPY, 2, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 3, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 5, 1},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 7, 1},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 8, 1},
|
||||
{DRM_XE_ENGINE_CLASS_VIDEO_DECODE, 9, 1},
|
||||
{DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE, 10, 0}};
|
||||
static_assert(sizeof(drm_xe_engine) == 4 * sizeof(uint64_t), "");
|
||||
uint64_t queryEngines[45]{}; // 1 qword for num engines and 4 qwords per engine
|
||||
|
||||
struct drm_xe_ext_set_property receivedContextCreateSetParam = {};
|
||||
bool allowDebugAttachCallBase = false;
|
||||
|
|
|
@ -49,6 +49,20 @@ inline constexpr uint32_t testValueGemCreate = 0x8273;
|
|||
class DrmMockXe : public DrmMockCustom {
|
||||
public:
|
||||
DrmMockXe(RootDeviceEnvironment &rootDeviceEnvironment) : DrmMockCustom(rootDeviceEnvironment) {
|
||||
auto xeQueryEngines = reinterpret_cast<drm_xe_query_engines *>(queryEngines);
|
||||
xeQueryEngines->num_engines = 11;
|
||||
xeQueryEngines->engines[0] = {{DRM_XE_ENGINE_CLASS_RENDER, 0, 0}, {}};
|
||||
xeQueryEngines->engines[1] = {{DRM_XE_ENGINE_CLASS_COPY, 1, 0}, {}};
|
||||
xeQueryEngines->engines[2] = {{DRM_XE_ENGINE_CLASS_COPY, 2, 0}, {}};
|
||||
xeQueryEngines->engines[3] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 3, 0}, {}};
|
||||
xeQueryEngines->engines[4] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0}, {}};
|
||||
xeQueryEngines->engines[5] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 5, 1}, {}};
|
||||
xeQueryEngines->engines[6] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1}, {}};
|
||||
xeQueryEngines->engines[7] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 7, 1}, {}};
|
||||
xeQueryEngines->engines[8] = {{DRM_XE_ENGINE_CLASS_COMPUTE, 8, 1}, {}};
|
||||
xeQueryEngines->engines[9] = {{DRM_XE_ENGINE_CLASS_VIDEO_DECODE, 9, 1}, {}};
|
||||
xeQueryEngines->engines[10] = {{DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE, 10, 0}, {}};
|
||||
|
||||
auto xeQueryMemUsage = reinterpret_cast<drm_xe_query_mem_regions *>(queryMemUsage);
|
||||
xeQueryMemUsage->num_mem_regions = 3;
|
||||
xeQueryMemUsage->mem_regions[0] = {
|
||||
|
@ -251,19 +265,9 @@ class DrmMockXe : public DrmMockCustom {
|
|||
int forceIoctlAnswer = 0;
|
||||
int setIoctlAnswer = 0;
|
||||
int gemVmBindReturn = 0;
|
||||
const drm_xe_engine_class_instance queryEngines[11] = {
|
||||
{DRM_XE_ENGINE_CLASS_RENDER, 0, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COPY, 1, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COPY, 2, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 3, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 4, 0},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 5, 1},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 6, 1},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 7, 1},
|
||||
{DRM_XE_ENGINE_CLASS_COMPUTE, 8, 1},
|
||||
{DRM_XE_ENGINE_CLASS_VIDEO_DECODE, 9, 1},
|
||||
{DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE, 10, 0}};
|
||||
|
||||
static_assert(sizeof(drm_xe_engine) == 4 * sizeof(uint64_t), "");
|
||||
uint64_t queryEngines[45]{}; // 1 qword for num engines and 4 qwords per engine
|
||||
static_assert(sizeof(drm_xe_mem_region) == 11 * sizeof(uint64_t), "");
|
||||
uint64_t queryMemUsage[34]{}; // 1 qword for num regions and 11 qwords per region
|
||||
static_assert(sizeof(drm_xe_gt) == 12 * sizeof(uint64_t), "");
|
||||
|
|
Loading…
Reference in New Issue