mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Sysman : Add check on engine handle creation
Add check whether init succeeded on handle creation. Related-To: LOCI-3005 Signed-off-by: Bellekallu Rajkiran <bellekallu.rajkiran@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
878466a1ea
commit
061af9c284
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,7 +24,11 @@ EngineHandleContext::~EngineHandleContext() {
|
||||
|
||||
void EngineHandleContext::createHandle(zes_engine_group_t engineType, uint32_t engineInstance, uint32_t subDeviceId) {
|
||||
Engine *pEngine = new EngineImp(pOsSysman, engineType, engineInstance, subDeviceId);
|
||||
handleList.push_back(pEngine);
|
||||
if (pEngine->initSuccess == true) {
|
||||
handleList.push_back(pEngine);
|
||||
} else {
|
||||
delete pEngine;
|
||||
}
|
||||
}
|
||||
|
||||
void EngineHandleContext::init() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -28,6 +28,7 @@ class Engine : _zes_engine_handle_t {
|
||||
return static_cast<Engine *>(handle);
|
||||
}
|
||||
inline zes_engine_handle_t toHandle() { return this; }
|
||||
bool initSuccess = false;
|
||||
};
|
||||
|
||||
struct EngineHandleContext {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -20,7 +20,10 @@ ze_result_t EngineImp::engineGetProperties(zes_engine_properties_t *pProperties)
|
||||
}
|
||||
|
||||
void EngineImp::init() {
|
||||
pOsEngine->getProperties(engineProperties);
|
||||
if (pOsEngine->isEngineModuleSupported()) {
|
||||
pOsEngine->getProperties(engineProperties);
|
||||
this->initSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
EngineImp::EngineImp(OsSysman *pOsSysman, zes_engine_group_t engineType, uint32_t engineInstance, uint32_t subDeviceId) {
|
||||
|
||||
@@ -72,6 +72,13 @@ void LinuxEngineImp::init() {
|
||||
fd = pPmuInterface->pmuInterfaceOpen(I915_PMU_ENGINE_BUSY(i915EngineClass->second, engineInstance), -1, PERF_FORMAT_TOTAL_TIME_ENABLED);
|
||||
}
|
||||
|
||||
bool LinuxEngineImp::isEngineModuleSupported() {
|
||||
if (fd < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LinuxEngineImp::LinuxEngineImp(OsSysman *pOsSysman, zes_engine_group_t type, uint32_t engineInstance, uint32_t subDeviceId) : engineGroup(type), engineInstance(engineInstance), subDeviceId(subDeviceId) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pDrm = &pLinuxSysmanImp->getDrm();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -19,6 +19,7 @@ class LinuxEngineImp : public OsEngine, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
ze_result_t getActivity(zes_engine_stats_t *pStats) override;
|
||||
ze_result_t getProperties(zes_engine_properties_t &properties) override;
|
||||
bool isEngineModuleSupported() override;
|
||||
static zes_engine_group_t getGroupFromEngineType(zes_engine_group_t type);
|
||||
LinuxEngineImp() = default;
|
||||
LinuxEngineImp(OsSysman *pOsSysman, zes_engine_group_t type, uint32_t engineInstance, uint32_t subDeviceId);
|
||||
|
||||
@@ -115,6 +115,13 @@ void LinuxEngineImp::init() {
|
||||
fd = pPmuInterface->pmuInterfaceOpen(config, -1, PERF_FORMAT_TOTAL_TIME_ENABLED);
|
||||
}
|
||||
|
||||
bool LinuxEngineImp::isEngineModuleSupported() {
|
||||
if (fd < 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
LinuxEngineImp::LinuxEngineImp(OsSysman *pOsSysman, zes_engine_group_t type, uint32_t engineInstance, uint32_t subDeviceId) : engineGroup(type), engineInstance(engineInstance), subDeviceId(subDeviceId) {
|
||||
LinuxSysmanImp *pLinuxSysmanImp = static_cast<LinuxSysmanImp *>(pOsSysman);
|
||||
pDrm = &pLinuxSysmanImp->getDrm();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -21,6 +21,7 @@ class OsEngine {
|
||||
public:
|
||||
virtual ze_result_t getActivity(zes_engine_stats_t *pStats) = 0;
|
||||
virtual ze_result_t getProperties(zes_engine_properties_t &properties) = 0;
|
||||
virtual bool isEngineModuleSupported() = 0;
|
||||
static OsEngine *create(OsSysman *pOsSysman, zes_engine_group_t engineType, uint32_t engineInstance, uint32_t subDeviceId);
|
||||
static ze_result_t getNumEngineTypeAndInstances(std::set<std::pair<zes_engine_group_t, EngineInstanceSubDeviceId>> &engineGroupInstance, OsSysman *pOsSysman);
|
||||
virtual ~OsEngine() = default;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -57,6 +57,10 @@ ze_result_t WddmEngineImp::getProperties(zes_engine_properties_t &properties) {
|
||||
return ZE_RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
bool WddmEngineImp::isEngineModuleSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
WddmEngineImp::WddmEngineImp(OsSysman *pOsSysman, zes_engine_group_t engineType, uint32_t engineInstance, uint32_t subDeviceId) {
|
||||
WddmSysmanImp *pWddmSysmanImp = static_cast<WddmSysmanImp *>(pOsSysman);
|
||||
this->engineGroup = engineType;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -17,6 +17,7 @@ class WddmEngineImp : public OsEngine, NEO::NonCopyableOrMovableClass {
|
||||
public:
|
||||
ze_result_t getActivity(zes_engine_stats_t *pStats) override;
|
||||
ze_result_t getProperties(zes_engine_properties_t &properties) override;
|
||||
bool isEngineModuleSupported() override;
|
||||
|
||||
WddmEngineImp() = default;
|
||||
WddmEngineImp(OsSysman *pOsSysman, zes_engine_group_t type, uint32_t engineInstance, uint32_t subDeviceId);
|
||||
|
||||
Reference in New Issue
Block a user