mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-22 10:17:01 +08:00
feature(sysman): supports performance module for zesInit windows
Related-To: LOCI-4205 Signed-off-by: Kulkarni, Ashwin Kumar <ashwin.kumar.kulkarni@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
d2c9122ad3
commit
bc719ad80e
@@ -10,24 +10,99 @@
|
|||||||
namespace L0 {
|
namespace L0 {
|
||||||
namespace Sysman {
|
namespace Sysman {
|
||||||
|
|
||||||
|
constexpr double maxPerformanceFactor = 100;
|
||||||
|
constexpr double halfOfMaxPerformanceFactor = 50;
|
||||||
|
constexpr double minPerformanceFactor = 0;
|
||||||
|
constexpr uint32_t mediaDynamicMode = 0;
|
||||||
|
constexpr uint32_t mediaOneToTwoMode = 128;
|
||||||
|
constexpr uint32_t mediaOneToOneMode = 256;
|
||||||
|
|
||||||
ze_result_t WddmPerformanceImp::osPerformanceGetConfig(double *pFactor) {
|
ze_result_t WddmPerformanceImp::osPerformanceGetConfig(double *pFactor) {
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
KmdSysman::RequestProperty request;
|
||||||
|
KmdSysman::ResponseProperty response;
|
||||||
|
uint32_t value = 0;
|
||||||
|
request.paramInfo = static_cast<uint32_t>(KmdSysman::ActivityDomainsType::ActivityDomainMedia);
|
||||||
|
request.commandId = KmdSysman::Command::Get;
|
||||||
|
request.componentId = KmdSysman::Component::PerformanceComponent;
|
||||||
|
request.requestId = KmdSysman::Requests::Performance::Factor;
|
||||||
|
|
||||||
|
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||||
|
|
||||||
|
if (status != ZE_RESULT_SUCCESS) {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy_s(&value, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
|
||||||
|
if (value == mediaOneToOneMode) {
|
||||||
|
*pFactor = maxPerformanceFactor;
|
||||||
|
} else if (value == mediaOneToTwoMode) {
|
||||||
|
*pFactor = halfOfMaxPerformanceFactor;
|
||||||
|
} else if (value == mediaDynamicMode) {
|
||||||
|
*pFactor = minPerformanceFactor;
|
||||||
|
} else {
|
||||||
|
status = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t WddmPerformanceImp::osPerformanceSetConfig(double pFactor) {
|
ze_result_t WddmPerformanceImp::osPerformanceSetConfig(double pFactor) {
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
if (pFactor < minPerformanceFactor || pFactor > maxPerformanceFactor) {
|
||||||
|
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
|
||||||
|
}
|
||||||
|
KmdSysman::RequestProperty request;
|
||||||
|
KmdSysman::ResponseProperty response;
|
||||||
|
uint32_t value = 0;
|
||||||
|
request.paramInfo = static_cast<uint32_t>(KmdSysman::ActivityDomainsType::ActivityDomainMedia);
|
||||||
|
request.commandId = KmdSysman::Command::Set;
|
||||||
|
request.componentId = KmdSysman::Component::PerformanceComponent;
|
||||||
|
request.requestId = KmdSysman::Requests::Performance::Factor;
|
||||||
|
request.dataSize = sizeof(uint32_t);
|
||||||
|
if (pFactor > halfOfMaxPerformanceFactor) {
|
||||||
|
value = mediaOneToOneMode;
|
||||||
|
} else if (pFactor > minPerformanceFactor) {
|
||||||
|
value = mediaOneToTwoMode;
|
||||||
|
} else {
|
||||||
|
value = mediaDynamicMode;
|
||||||
|
}
|
||||||
|
memcpy_s(request.dataBuffer, sizeof(uint32_t), &value, sizeof(uint32_t));
|
||||||
|
return pKmdSysManager->requestSingle(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
ze_result_t WddmPerformanceImp::osPerformanceGetProperties(zes_perf_properties_t &properties) {
|
ze_result_t WddmPerformanceImp::osPerformanceGetProperties(zes_perf_properties_t &properties) {
|
||||||
return ZE_RESULT_ERROR_UNSUPPORTED_FEATURE;
|
properties.onSubdevice = isSubdevice;
|
||||||
|
properties.subdeviceId = subDeviceId;
|
||||||
|
properties.engines = domain;
|
||||||
|
return ZE_RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WddmPerformanceImp::isPerformanceSupported(void) {
|
bool WddmPerformanceImp::isPerformanceSupported(void) {
|
||||||
|
if (domain == ZES_ENGINE_TYPE_FLAG_MEDIA) {
|
||||||
|
KmdSysman::RequestProperty request;
|
||||||
|
KmdSysman::ResponseProperty response;
|
||||||
|
uint32_t value = 0;
|
||||||
|
|
||||||
|
request.paramInfo = static_cast<uint32_t>(KmdSysman::ActivityDomainsType::ActivityDomainMedia);
|
||||||
|
request.commandId = KmdSysman::Command::Get;
|
||||||
|
request.componentId = KmdSysman::Component::PerformanceComponent;
|
||||||
|
request.requestId = KmdSysman::Requests::Performance::NumPerformanceDomains;
|
||||||
|
|
||||||
|
ze_result_t status = pKmdSysManager->requestSingle(request, response);
|
||||||
|
|
||||||
|
if (status != ZE_RESULT_SUCCESS) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy_s(&value, sizeof(uint32_t), response.dataBuffer, sizeof(uint32_t));
|
||||||
|
return static_cast<bool>(value);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WddmPerformanceImp::WddmPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
|
WddmPerformanceImp::WddmPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
|
||||||
zes_engine_type_flag_t domain) {}
|
zes_engine_type_flag_t domain) : isSubdevice(onSubdevice), subDeviceId(subdeviceId), domain(domain) {
|
||||||
|
WddmSysmanImp *pWddmSysmanImp = static_cast<WddmSysmanImp *>(pOsSysman);
|
||||||
|
pKmdSysManager = &pWddmSysmanImp->getKmdSysManager();
|
||||||
|
}
|
||||||
|
|
||||||
OsPerformance *OsPerformance::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
|
OsPerformance *OsPerformance::create(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
|
||||||
zes_engine_type_flag_t domain) {
|
zes_engine_type_flag_t domain) {
|
||||||
|
|||||||
@@ -22,6 +22,12 @@ class WddmPerformanceImp : public OsPerformance {
|
|||||||
WddmPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
|
WddmPerformanceImp(OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId,
|
||||||
zes_engine_type_flag_t domain);
|
zes_engine_type_flag_t domain);
|
||||||
~WddmPerformanceImp() override = default;
|
~WddmPerformanceImp() override = default;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ze_bool_t isSubdevice = false;
|
||||||
|
uint32_t subDeviceId = 0;
|
||||||
|
KmdSysManager *pKmdSysManager = nullptr;
|
||||||
|
zes_engine_type_flag_t domain = ZES_ENGINE_TYPE_FLAG_OTHER;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Sysman
|
} // namespace Sysman
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2023 Intel Corporation
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
#
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_sources(${TARGET_NAME}
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/test_zes_performance.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/mock_performance.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "level_zero/sysman/source/performance/windows/sysman_os_performance_imp.h"
|
||||||
|
#include "level_zero/sysman/test/unit_tests/sources/windows/mock_kmd_sys_manager.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
struct PerformanceKmdSysManager : public MockKmdSysManager {
|
||||||
|
|
||||||
|
uint32_t mockNumberOfDomains = 1;
|
||||||
|
uint32_t mockPerformanceFactor = 0;
|
||||||
|
void getPerformanceProperty(KmdSysman::GfxSysmanReqHeaderIn *pRequest, KmdSysman::GfxSysmanReqHeaderOut *pResponse) override {
|
||||||
|
uint8_t *pBuffer = reinterpret_cast<uint8_t *>(pResponse);
|
||||||
|
pBuffer += sizeof(KmdSysman::GfxSysmanReqHeaderOut);
|
||||||
|
|
||||||
|
KmdSysman::ActivityDomainsType domain = static_cast<KmdSysman::ActivityDomainsType>(pRequest->inCommandParam);
|
||||||
|
|
||||||
|
if (domain != KmdSysman::ActivityDomainsType::ActivityDomainMedia) {
|
||||||
|
pResponse->outDataSize = 0;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanFail;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (pRequest->inRequestId) {
|
||||||
|
case KmdSysman::Requests::Performance::NumPerformanceDomains: {
|
||||||
|
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
|
||||||
|
*pValue = mockNumberOfDomains;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||||
|
pResponse->outDataSize = sizeof(uint32_t);
|
||||||
|
} break;
|
||||||
|
case KmdSysman::Requests::Performance::Factor: {
|
||||||
|
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
|
||||||
|
*pValue = mockPerformanceFactor;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||||
|
pResponse->outDataSize = sizeof(uint32_t);
|
||||||
|
} break;
|
||||||
|
default: {
|
||||||
|
pResponse->outDataSize = 0;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanFail;
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPerformanceProperty(KmdSysman::GfxSysmanReqHeaderIn *pRequest, KmdSysman::GfxSysmanReqHeaderOut *pResponse) override {
|
||||||
|
uint8_t *pBuffer = reinterpret_cast<uint8_t *>(pRequest);
|
||||||
|
pBuffer += sizeof(KmdSysman::GfxSysmanReqHeaderIn);
|
||||||
|
KmdSysman::ActivityDomainsType domain = static_cast<KmdSysman::ActivityDomainsType>(pRequest->inCommandParam);
|
||||||
|
|
||||||
|
if (domain != KmdSysman::ActivityDomainsType::ActivityDomainMedia) {
|
||||||
|
pResponse->outDataSize = 0;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanFail;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (pRequest->inRequestId) {
|
||||||
|
case KmdSysman::Requests::Performance::Factor: {
|
||||||
|
uint32_t *pValue = reinterpret_cast<uint32_t *>(pBuffer);
|
||||||
|
mockPerformanceFactor = *pValue;
|
||||||
|
pResponse->outDataSize = 0;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanSuccess;
|
||||||
|
} break;
|
||||||
|
default: {
|
||||||
|
pResponse->outDataSize = 0;
|
||||||
|
pResponse->outReturnCode = KmdSysman::KmdSysmanFail;
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mock() = default;
|
||||||
|
//~Mock() override = default;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PublicWddmPerformanceImp : public L0::Sysman::WddmPerformanceImp {
|
||||||
|
public:
|
||||||
|
PublicWddmPerformanceImp(L0::Sysman::OsSysman *pOsSysman, ze_bool_t onSubdevice, uint32_t subdeviceId, zes_engine_type_flag_t domain) : WddmPerformanceImp(pOsSysman, onSubdevice, subdeviceId, domain) {}
|
||||||
|
using WddmPerformanceImp::domain;
|
||||||
|
using WddmPerformanceImp::pKmdSysManager;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "level_zero/sysman/source/performance/windows/sysman_os_performance_imp.h"
|
||||||
|
#include "level_zero/sysman/test/unit_tests/sources/performance/windows/mock_performance.h"
|
||||||
|
#include "level_zero/sysman/test/unit_tests/sources/windows/mock_sysman_fixture.h"
|
||||||
|
|
||||||
|
namespace L0 {
|
||||||
|
namespace ult {
|
||||||
|
|
||||||
|
constexpr uint32_t mockHandleCount = 1u;
|
||||||
|
constexpr double maxPerformanceFactor = 100;
|
||||||
|
constexpr double halfOfMaxPerformanceFactor = 50;
|
||||||
|
constexpr double minPerformanceFactor = 0;
|
||||||
|
|
||||||
|
class SysmanDevicePerformanceFixture : public SysmanDeviceFixture {
|
||||||
|
protected:
|
||||||
|
std::unique_ptr<PerformanceKmdSysManager> pKmdSysManager;
|
||||||
|
L0::Sysman::KmdSysManager *pOriginalKmdSysManager = nullptr;
|
||||||
|
void SetUp() override {
|
||||||
|
SysmanDeviceFixture::SetUp();
|
||||||
|
pKmdSysManager.reset(new PerformanceKmdSysManager);
|
||||||
|
|
||||||
|
pKmdSysManager->allowSetCalls = true;
|
||||||
|
|
||||||
|
pOriginalKmdSysManager = pWddmSysmanImp->pKmdSysManager;
|
||||||
|
pWddmSysmanImp->pKmdSysManager = pKmdSysManager.get();
|
||||||
|
|
||||||
|
pSysmanDeviceImp->pPerformanceHandleContext->handleList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() override {
|
||||||
|
pWddmSysmanImp->pKmdSysManager = pOriginalKmdSysManager;
|
||||||
|
SysmanDeviceFixture::TearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<zes_perf_handle_t> getPerfHandles(uint32_t count) {
|
||||||
|
std::vector<zes_perf_handle_t> handles(count, nullptr);
|
||||||
|
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
||||||
|
return handles;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidSysmanHandleWhenRetrievingPerfThenValidHandlesReturned) {
|
||||||
|
uint32_t count = 0;
|
||||||
|
ze_result_t result = zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, NULL);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
EXPECT_EQ(count, mockHandleCount);
|
||||||
|
|
||||||
|
uint32_t testcount = count + 1;
|
||||||
|
result = zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &testcount, NULL);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
EXPECT_EQ(testcount, mockHandleCount);
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
std::vector<zes_perf_handle_t> handles(count, nullptr);
|
||||||
|
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
|
||||||
|
EXPECT_EQ(count, mockHandleCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidSysmanHandleWhenRetrievingPerfAndRequestSingleFailsThenFailuresAreReturned) {
|
||||||
|
pKmdSysManager->mockRequestSingle = true;
|
||||||
|
pKmdSysManager->mockRequestSingleResult = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
uint32_t count = 0;
|
||||||
|
ze_result_t result = zesDeviceEnumPerformanceFactorDomains(pSysmanDevice->toHandle(), &count, NULL);
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
|
||||||
|
EXPECT_EQ(count, 0u);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidPerfHandleWhenGettingPerformancePropertiesThenValidPropertiesReturned) {
|
||||||
|
auto handles = getPerfHandles(mockHandleCount);
|
||||||
|
for (const auto &handle : handles) {
|
||||||
|
zes_perf_properties_t properties = {};
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetProperties(handle, &properties));
|
||||||
|
EXPECT_FALSE(properties.onSubdevice);
|
||||||
|
EXPECT_EQ(properties.engines, ZES_ENGINE_TYPE_FLAG_MEDIA);
|
||||||
|
EXPECT_EQ(properties.subdeviceId, 0u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidPerfHandleWhenSettingMediaConfigAndGettingMediaConfigThenSuccessIsReturned) {
|
||||||
|
pKmdSysManager->allowSetCalls = true;
|
||||||
|
auto handles = getPerfHandles(mockHandleCount);
|
||||||
|
for (const auto &handle : handles) {
|
||||||
|
zes_perf_properties_t properties = {};
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetProperties(handle, &properties));
|
||||||
|
if (properties.engines == ZES_ENGINE_TYPE_FLAG_MEDIA) {
|
||||||
|
double setFactor = 49;
|
||||||
|
double getFactor = 0;
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetConfig(handle, &getFactor));
|
||||||
|
EXPECT_DOUBLE_EQ(std::round(getFactor), halfOfMaxPerformanceFactor);
|
||||||
|
|
||||||
|
setFactor = 50;
|
||||||
|
getFactor = 0;
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetConfig(handle, &getFactor));
|
||||||
|
EXPECT_DOUBLE_EQ(std::round(getFactor), halfOfMaxPerformanceFactor);
|
||||||
|
|
||||||
|
setFactor = 60;
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetConfig(handle, &getFactor));
|
||||||
|
EXPECT_DOUBLE_EQ(std::round(getFactor), maxPerformanceFactor);
|
||||||
|
|
||||||
|
setFactor = 100;
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetConfig(handle, &getFactor));
|
||||||
|
EXPECT_DOUBLE_EQ(std::round(getFactor), maxPerformanceFactor);
|
||||||
|
|
||||||
|
setFactor = 0;
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetConfig(handle, &getFactor));
|
||||||
|
EXPECT_DOUBLE_EQ(std::round(getFactor), minPerformanceFactor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidPerfHandlesWhenRetrievingPerformanceFactorAndKmdReturnsInvalidValueThenUnknownErrorIsReturned) {
|
||||||
|
pKmdSysManager->mockPerformanceFactor = 512;
|
||||||
|
auto handles = getPerfHandles(mockHandleCount);
|
||||||
|
for (const auto &handle : handles) {
|
||||||
|
double factor = 0;
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, zesPerformanceFactorGetConfig(handle, &factor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidPerfHandleWhenRetrievingPerformanceFactorAndOsPerformanceGetConfigFailsThenFailureIsReturned) {
|
||||||
|
pKmdSysManager->mockRequestSingle = true;
|
||||||
|
pKmdSysManager->mockRequestSingleResult = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
PublicWddmPerformanceImp *pWddmPerformanceImp = new PublicWddmPerformanceImp(pOsSysman, 0, 0u, ZES_ENGINE_TYPE_FLAG_MEDIA);
|
||||||
|
double pFactor = 0;
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pWddmPerformanceImp->osPerformanceGetConfig(&pFactor));
|
||||||
|
delete pWddmPerformanceImp;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidPerfHandleWhenRetrievingPerformanceFactorAndOsPerformanceSetConfigFailsThenFailureIsReturned) {
|
||||||
|
pKmdSysManager->allowSetCalls = true;
|
||||||
|
pKmdSysManager->mockRequestSingle = true;
|
||||||
|
pKmdSysManager->mockRequestSingleResult = ZE_RESULT_ERROR_UNKNOWN;
|
||||||
|
PublicWddmPerformanceImp *pWddmPerformanceImp = new PublicWddmPerformanceImp(pOsSysman, 0, 0u, ZES_ENGINE_TYPE_FLAG_MEDIA);
|
||||||
|
double pFactor = halfOfMaxPerformanceFactor;
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_UNKNOWN, pWddmPerformanceImp->osPerformanceSetConfig(pFactor));
|
||||||
|
delete pWddmPerformanceImp;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(SysmanDevicePerformanceFixture, GivenValidPerfHandleWhenSettingPerformanceFactorWithInvalidValuesThenInvalidArgumentErrorIsReturned) {
|
||||||
|
pKmdSysManager->allowSetCalls = true;
|
||||||
|
auto handles = getPerfHandles(mockHandleCount);
|
||||||
|
for (const auto &handle : handles) {
|
||||||
|
zes_perf_properties_t properties = {};
|
||||||
|
EXPECT_EQ(ZE_RESULT_SUCCESS, zesPerformanceFactorGetProperties(handle, &properties));
|
||||||
|
if (properties.engines == ZES_ENGINE_TYPE_FLAG_MEDIA) {
|
||||||
|
double setFactor = -1;
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
|
||||||
|
setFactor = 110;
|
||||||
|
EXPECT_EQ(ZE_RESULT_ERROR_INVALID_ARGUMENT, zesPerformanceFactorSetConfig(handle, setFactor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace ult
|
||||||
|
} // namespace L0
|
||||||
Reference in New Issue
Block a user