level-zero v1.0 (2/N)

Change-Id: I1419231a721fab210e166d26a264cae04d661dcd
Signed-off-by: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
Signed-off-by: macabral <matias.a.cabral@intel.com>
Signed-off-by: davidoli <david.olien@intel.com>
Signed-off-by: Aravind Gopalakrishnan <Aravind.Gopalakrishnan@intel.com>
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
Signed-off-by: Latif, Raiyan <raiyan.latif@intel.com>
Signed-off-by: Artur Harasimiuk <artur.harasimiuk@intel.com>
This commit is contained in:
Jaime Arteaga
2020-07-29 02:45:54 -07:00
committed by sys_ocldev
parent e8246a8179
commit 902fc2f6c4
255 changed files with 3200 additions and 12829 deletions

View File

@@ -13,10 +13,6 @@
namespace L0 {
constexpr uint64_t convertJouleToMicroJoule = 1000000u;
ze_result_t LinuxPowerImp::getEnergyThreshold(zet_energy_threshold_t *pThreshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t LinuxPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) {

View File

@@ -17,7 +17,6 @@ class PlatformMonitoringTech;
class LinuxPowerImp : public OsPower, NEO::NonCopyableOrMovableClass {
public:
ze_result_t getEnergyCounter(uint64_t &energy) override;
ze_result_t getEnergyThreshold(zet_energy_threshold_t *pThreshold) override;
ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override;
ze_result_t setEnergyThreshold(double threshold) override;
bool isPowerModuleSupported() override;

View File

@@ -7,9 +7,7 @@
#pragma once
#include <level_zero/zet_api.h>
#include "third_party/level_zero/zes_api_ext.h"
#include <level_zero/zes_api.h>
namespace L0 {
@@ -17,9 +15,8 @@ struct OsSysman;
class OsPower {
public:
virtual ze_result_t getEnergyCounter(uint64_t &energy) = 0;
virtual ze_result_t getEnergyThreshold(zet_energy_threshold_t *pThreshold) = 0;
virtual ze_result_t setEnergyThreshold(double threshold) = 0;
virtual ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) = 0;
virtual ze_result_t setEnergyThreshold(double threshold) = 0;
virtual bool isPowerModuleSupported() = 0;
static OsPower *create(OsSysman *pOsSysman);
virtual ~OsPower() = default;

View File

@@ -28,7 +28,7 @@ void PowerHandleContext::init() {
}
}
ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower) {
ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower) {
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
uint32_t numToCopy = std::min(*pCount, handleListSize);
if (0 == *pCount || *pCount > handleListSize) {
@@ -42,18 +42,4 @@ ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zet_sysman_pwr_handle
return ZE_RESULT_SUCCESS;
}
ze_result_t PowerHandleContext::powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower) {
uint32_t handleListSize = static_cast<uint32_t>(handleList.size());
uint32_t numToCopy = std::min(*pCount, handleListSize);
if (0 == *pCount || *pCount > handleListSize) {
*pCount = handleListSize;
}
if (nullptr != phPower) {
for (uint32_t i = 0; i < numToCopy; i++) {
phPower[i] = handleList[i]->toZesPwrHandle();
}
}
return ZE_RESULT_SUCCESS;
}
} // namespace L0

View File

@@ -6,9 +6,7 @@
*/
#pragma once
#include <level_zero/zet_api.h>
#include "third_party/level_zero/zes_api_ext.h"
#include <level_zero/zes_api.h>
#include <vector>
@@ -25,27 +23,17 @@ namespace L0 {
struct OsSysman;
class Power : _zet_sysman_pwr_handle_t, _zes_pwr_handle_t {
public:
virtual ze_result_t powerGetProperties(zet_power_properties_t *pProperties) = 0;
virtual ze_result_t powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) = 0;
virtual ze_result_t powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) = 0;
virtual ze_result_t powerSetLimits(const zet_power_sustained_limit_t *pSustained, const zet_power_burst_limit_t *pBurst, const zet_power_peak_limit_t *pPeak) = 0;
virtual ze_result_t powerGetEnergyThreshold(zet_energy_threshold_t *pThreshold) = 0;
virtual ze_result_t powerSetEnergyThreshold(double threshold) = 0;
virtual ze_result_t powerGetProperties(zes_power_properties_t *pProperties) = 0;
virtual ze_result_t powerGetEnergyCounter(zes_power_energy_counter_t *pEnergy) = 0;
virtual ze_result_t powerGetLimits(zes_power_sustained_limit_t *pSustained, zes_power_burst_limit_t *pBurst, zes_power_peak_limit_t *pPeak) = 0;
virtual ze_result_t powerSetLimits(const zes_power_sustained_limit_t *pSustained, const zes_power_burst_limit_t *pBurst, const zes_power_peak_limit_t *pPeak) = 0;
virtual ze_result_t powerGetEnergyThreshold(zes_energy_threshold_t *pThreshold) = 0;
virtual ze_result_t powerSetEnergyThreshold(double threshold) = 0;
static Power *fromHandle(zet_sysman_pwr_handle_t handle) {
return static_cast<Power *>(handle);
}
static Power *fromHandle(zes_pwr_handle_t handle) {
return static_cast<Power *>(handle);
}
inline zet_sysman_pwr_handle_t toHandle() { return this; }
inline zes_pwr_handle_t toZesPwrHandle() { return this; }
inline zes_pwr_handle_t toHandle() { return this; }
bool initSuccess = false;
};
struct PowerHandleContext {
@@ -54,7 +42,6 @@ struct PowerHandleContext {
void init();
ze_result_t powerGet(uint32_t *pCount, zet_sysman_pwr_handle_t *phPower);
ze_result_t powerGet(uint32_t *pCount, zes_pwr_handle_t *phPower);
OsSysman *pOsSysman = nullptr;

View File

@@ -20,33 +20,6 @@ void powerGetTimestamp(uint64_t &timestamp) {
timestamp = std::chrono::duration_cast<std::chrono::microseconds>(ts.time_since_epoch()).count();
}
ze_result_t PowerImp::powerGetProperties(zet_power_properties_t *pProperties) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t PowerImp::powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) {
ze_result_t result = pOsPower->getEnergyCounter(pEnergy->energy);
if (result != ZE_RESULT_SUCCESS) {
return result;
}
powerGetTimestamp(pEnergy->timestamp);
return result;
}
ze_result_t PowerImp::powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t PowerImp::powerSetLimits(const zet_power_sustained_limit_t *pSustained, const zet_power_burst_limit_t *pBurst, const zet_power_peak_limit_t *pPeak) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t PowerImp::powerGetEnergyThreshold(zet_energy_threshold_t *pThreshold) {
return (pOsPower->getEnergyThreshold(pThreshold));
}
ze_result_t PowerImp::powerSetEnergyThreshold(double threshold) {
return (pOsPower->setEnergyThreshold(threshold));
}

View File

@@ -15,11 +15,6 @@
namespace L0 {
class PowerImp : public Power, NEO::NonCopyableOrMovableClass {
public:
ze_result_t powerGetProperties(zet_power_properties_t *pProperties) override;
ze_result_t powerGetEnergyCounter(zet_power_energy_counter_t *pEnergy) override;
ze_result_t powerGetLimits(zet_power_sustained_limit_t *pSustained, zet_power_burst_limit_t *pBurst, zet_power_peak_limit_t *pPeak) override;
ze_result_t powerSetLimits(const zet_power_sustained_limit_t *pSustained, const zet_power_burst_limit_t *pBurst, const zet_power_peak_limit_t *pPeak) override;
ze_result_t powerGetEnergyThreshold(zet_energy_threshold_t *pThreshold) override;
ze_result_t powerSetEnergyThreshold(double threshold) override;
ze_result_t powerGetProperties(zes_power_properties_t *pProperties) override;

View File

@@ -12,7 +12,6 @@ namespace L0 {
class WddmPowerImp : public OsPower {
public:
ze_result_t getEnergyCounter(uint64_t &energy) override;
ze_result_t getEnergyThreshold(zet_energy_threshold_t *pThreshold) override;
ze_result_t getEnergyThreshold(zes_energy_threshold_t *pThreshold) override;
ze_result_t setEnergyThreshold(double threshold) override;
bool isPowerModuleSupported() override;
@@ -23,11 +22,6 @@ ze_result_t WddmPowerImp::getEnergyCounter(uint64_t &energy) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t WddmPowerImp::getEnergyThreshold(zet_energy_threshold_t *pThreshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
}
ze_result_t WddmPowerImp::getEnergyThreshold(zes_energy_threshold_t *pThreshold) {
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;