mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-06 10:26:29 +08:00
(Sysman):Changes made in standby API.
Replacing normal pointers by smart pointers in standby module of L0 sysman. Related-To: LOCI-2810 Signed-off-by: Singh, Prasoon <prasoon.singh@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
49827b7122
commit
ac929eaf61
@@ -85,9 +85,9 @@ LinuxStandbyImp::LinuxStandbyImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uin
|
||||
init();
|
||||
}
|
||||
|
||||
OsStandby *OsStandby::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
LinuxStandbyImp *pLinuxStandbyImp = new LinuxStandbyImp(pOsSysman, onSubdevice, subdeviceId);
|
||||
return static_cast<OsStandby *>(pLinuxStandbyImp);
|
||||
std::unique_ptr<OsStandby> OsStandby::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
std::unique_ptr<LinuxStandbyImp> pLinuxStandbyImp = std::make_unique<LinuxStandbyImp>(pOsSysman, onSubdevice, subdeviceId);
|
||||
return pLinuxStandbyImp;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "level_zero/tools/source/sysman/os_sysman.h"
|
||||
#include <level_zero/zes_api.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
class OsStandby {
|
||||
@@ -20,7 +22,7 @@ class OsStandby {
|
||||
|
||||
virtual bool isStandbySupported(void) = 0;
|
||||
|
||||
static OsStandby *create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||
static std::unique_ptr<OsStandby> create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId);
|
||||
virtual ~OsStandby() {}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,18 +13,11 @@
|
||||
|
||||
namespace L0 {
|
||||
|
||||
StandbyHandleContext::~StandbyHandleContext() {
|
||||
for (Standby *pStandby : handleList) {
|
||||
delete pStandby;
|
||||
}
|
||||
}
|
||||
|
||||
StandbyHandleContext::~StandbyHandleContext() = default;
|
||||
void StandbyHandleContext::createHandle(ze_device_handle_t deviceHandle) {
|
||||
Standby *pStandby = new StandbyImp(pOsSysman, deviceHandle);
|
||||
std::unique_ptr<Standby> pStandby = std::make_unique<StandbyImp>(pOsSysman, deviceHandle);
|
||||
if (pStandby->isStandbyEnabled == true) {
|
||||
handleList.push_back(pStandby);
|
||||
} else {
|
||||
delete pStandby;
|
||||
handleList.push_back(std::move(pStandby));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -44,7 +44,7 @@ struct StandbyHandleContext {
|
||||
ze_result_t standbyGet(uint32_t *pCount, zes_standby_handle_t *phStandby);
|
||||
|
||||
OsSysman *pOsSysman;
|
||||
std::vector<Standby *> handleList = {};
|
||||
std::vector<std::unique_ptr<Standby>> handleList = {};
|
||||
|
||||
private:
|
||||
void createHandle(ze_device_handle_t deviceHandle);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -40,8 +40,5 @@ StandbyImp::StandbyImp(OsSysman *pOsSysman, ze_device_handle_t handle) : deviceH
|
||||
init();
|
||||
}
|
||||
|
||||
StandbyImp::~StandbyImp() {
|
||||
delete pOsStandby;
|
||||
}
|
||||
|
||||
StandbyImp::~StandbyImp() {}
|
||||
} // namespace L0
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,7 +24,7 @@ class StandbyImp : public Standby, NEO::NonCopyableOrMovableClass {
|
||||
StandbyImp() = default;
|
||||
StandbyImp(OsSysman *pOsSysman, ze_device_handle_t handle);
|
||||
~StandbyImp() override;
|
||||
OsStandby *pOsStandby = nullptr;
|
||||
std::unique_ptr<OsStandby> pOsStandby = nullptr;
|
||||
|
||||
void init();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -33,9 +33,9 @@ bool WddmStandbyImp::isStandbySupported(void) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OsStandby *OsStandby::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
WddmStandbyImp *pWddmStandbyImp = new WddmStandbyImp();
|
||||
return static_cast<OsStandby *>(pWddmStandbyImp);
|
||||
std::unique_ptr<OsStandby> OsStandby::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId) {
|
||||
std::unique_ptr<WddmStandbyImp> pWddmStandbyImp = std::make_unique<WddmStandbyImp>();
|
||||
return pWddmStandbyImp;
|
||||
}
|
||||
|
||||
} // namespace L0
|
||||
|
||||
Reference in New Issue
Block a user