mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-07 12:42:54 +08:00
fix(sysman): Changes in the Sysman Engine
The engine module returns error if incorrect fds are fetched Related-To: NEO-10657 Signed-off-by: Bari, Pratik <pratik.bari@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
f673a255f7
commit
22e94c3a8c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -44,6 +44,9 @@ ze_result_t OsEngine::getNumEngineTypeAndInstances(std::set<std::pair<zes_engine
|
||||
bool status = false;
|
||||
{
|
||||
auto hwDeviceId = pLinuxSysmanImp->getSysmanHwDeviceIdInstance();
|
||||
if (hwDeviceId.getFileDescriptor() < 0) {
|
||||
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
|
||||
}
|
||||
status = pDrm->sysmanQueryEngineInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2022-2023 Intel Corporation
|
||||
* Copyright (C) 2022-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -43,6 +43,9 @@ ze_result_t OsEngine::getNumEngineTypeAndInstances(std::set<std::pair<zes_engine
|
||||
bool status = false;
|
||||
{
|
||||
auto hwDeviceId = pLinuxSysmanImp->getSysmanHwDeviceIdInstance();
|
||||
if (hwDeviceId.getFileDescriptor() < 0) {
|
||||
return ZE_RESULT_ERROR_DEPENDENCY_UNAVAILABLE;
|
||||
}
|
||||
status = pDrm->sysmanQueryEngineInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -33,7 +33,12 @@ void EngineHandleContext::createHandle(zes_engine_group_t engineType, uint32_t e
|
||||
|
||||
void EngineHandleContext::init(uint32_t subDeviceCount) {
|
||||
std::set<std::pair<zes_engine_group_t, EngineInstanceSubDeviceId>> engineGroupInstance = {}; // set contains pair of engine group and struct containing engine instance and subdeviceId
|
||||
OsEngine::getNumEngineTypeAndInstances(engineGroupInstance, pOsSysman);
|
||||
deviceEngineInitStatus = OsEngine::getNumEngineTypeAndInstances(engineGroupInstance, pOsSysman);
|
||||
|
||||
if (deviceEngineInitStatus != ZE_RESULT_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto itr = engineGroupInstance.begin(); itr != engineGroupInstance.end(); ++itr) {
|
||||
for (uint32_t subDeviceId = 0; subDeviceId <= subDeviceCount; subDeviceId++) {
|
||||
if (subDeviceId == itr->second.second) {
|
||||
@@ -53,6 +58,11 @@ ze_result_t EngineHandleContext::engineGet(uint32_t *pCount, zes_engine_handle_t
|
||||
this->init(pOsSysman->getSubDeviceCount());
|
||||
this->engineInitDone = true;
|
||||
});
|
||||
|
||||
if (deviceEngineInitStatus != ZE_RESULT_SUCCESS) {
|
||||
return deviceEngineInitStatus;
|
||||
}
|
||||
|
||||
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
|
||||
uint32_t numToCopy = std::min(*pCount, handleListSize);
|
||||
if (0 == *pCount || *pCount > handleListSize) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
* Copyright (C) 2020-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -50,6 +50,7 @@ struct EngineHandleContext {
|
||||
void createHandle(zes_engine_group_t engineType, uint32_t engineInstance, uint32_t subDeviceId, ze_bool_t onSubdevice);
|
||||
std::once_flag initEngineOnce;
|
||||
bool engineInitDone = false;
|
||||
ze_result_t deviceEngineInitStatus = ZE_RESULT_SUCCESS;
|
||||
};
|
||||
|
||||
} // namespace Sysman
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Intel Corporation
|
||||
* Copyright (C) 2023-2024 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,9 +17,7 @@ class SysmanHwDeviceIdDrm : public NEO::HwDeviceIdDrm {
|
||||
using NEO::HwDeviceIdDrm::HwDeviceIdDrm;
|
||||
class SingleInstance {
|
||||
public:
|
||||
SingleInstance(SysmanHwDeviceIdDrm &input) : instance(input), fileDescriptor(input.openFileDescriptor()) {
|
||||
UNRECOVERABLE_IF(fileDescriptor < 0);
|
||||
}
|
||||
SingleInstance(SysmanHwDeviceIdDrm &input) : instance(input), fileDescriptor(input.openFileDescriptor()) {}
|
||||
~SingleInstance() { instance.closeFileDescriptor(); }
|
||||
int getFileDescriptor() const { return fileDescriptor; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user