fix(sysman): Fix the sysman ULTS in memory, scheduler and performance modules

Some of the failing sysman ULTS in the memory, performance and scheduler
modules have been fixed.
Related-To: LOCI-4483

Signed-off-by: Bari, Pratik <pratik.bari@intel.com>
This commit is contained in:
Bari, Pratik
2023-06-01 17:58:58 +05:30
committed by Compute-Runtime-Automation
parent a69110a7ec
commit 73d05045b0
4 changed files with 26 additions and 19 deletions

View File

@@ -27,6 +27,7 @@ namespace L0 {
namespace ult {
struct MockMemoryNeoDrm : public Drm {
using Drm::ioctlHelper;
using Drm::memoryInfo;
const int mockFd = 33;
MockMemoryNeoDrm(RootDeviceEnvironment &rootDeviceEnvironment) : Drm(std::make_unique<MockSysmanHwDeviceIdDrm>(mockFd, ""), rootDeviceEnvironment) {}

View File

@@ -24,8 +24,10 @@ class SysmanDeviceMemoryFixture : public SysmanDeviceFixture {
void SetUp() override {
DebugManager.flags.EnableLocalMemory.set(1);
SysmanDeviceFixture::SetUp();
pDrm = new MockMemoryNeoDrm(const_cast<NEO::RootDeviceEnvironment &>(pSysmanDeviceImp->getRootDeviceEnvironment()));
pDrm->ioctlHelper = static_cast<std::unique_ptr<NEO::IoctlHelper>>(std::make_unique<IoctlHelperUpstream>(*pDrm));
auto &osInterface = pSysmanDeviceImp->getRootDeviceEnvironment().osInterface;
osInterface->setDriverModel(std::make_unique<MockMemoryNeoDrm>(const_cast<NEO::RootDeviceEnvironment &>(pSysmanDeviceImp->getRootDeviceEnvironment())));
osInterface->setDriverModel(std::unique_ptr<MockMemoryNeoDrm>(pDrm));
pSysmanDeviceImp->pMemoryHandleContext->handleList.clear();
getMemoryHandles(0);

View File

@@ -17,6 +17,7 @@ class ZesPerformanceFixture : public SysmanMultiDeviceFixture {
L0::Sysman::SysmanDevice *device = nullptr;
void SetUp() override {
SysmanMultiDeviceFixture::SetUp();
device = pSysmanDevice;
pSysmanDeviceImp->pPerformanceHandleContext->handleList.clear();
getPerfHandles(0);
}
@@ -31,41 +32,44 @@ class ZesPerformanceFixture : public SysmanMultiDeviceFixture {
};
TEST_F(ZesPerformanceFixture, GivenValidSysmanHandleWhenRetrievingPerfThenZeroHandlesInReturn) {
uint32_t handleCount = 0;
uint32_t count = 0;
ze_result_t result = zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &count, NULL);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(count, mockHandleCount);
EXPECT_EQ(count, handleCount);
uint32_t testcount = count + 1;
result = zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &testcount, NULL);
EXPECT_EQ(ZE_RESULT_SUCCESS, result);
EXPECT_EQ(testcount, mockHandleCount);
EXPECT_EQ(testcount, handleCount);
count = 0;
std::vector<zes_perf_handle_t> handles(count, nullptr);
EXPECT_EQ(zesDeviceEnumPerformanceFactorDomains(device->toHandle(), &count, handles.data()), ZE_RESULT_SUCCESS);
EXPECT_EQ(count, mockHandleCount);
EXPECT_EQ(count, handleCount);
}
TEST_F(ZesPerformanceFixture, GivenValidOsSysmanPointerWhenCreatingOsPerformanceThenValidhandleForOsPerformanceIsRetrieved) {
auto subDeviceCount = pLinuxSysmanImp->getSubDeviceCount();
uint32_t subdeviceId = 0;
for (subdeviceId = 0; subdeviceId < subDeviceCount; subdeviceId++) {
ze_bool_t onSubdevice = (subDeviceCount == 0) ? false : true;
L0::Sysman::Performance *pPerformance = new L0::Sysman::PerformanceImp(pOsSysman, onSubdevice, subdeviceId, ZES_ENGINE_TYPE_FLAG_MEDIA);
TEST_F(ZesPerformanceFixture, GivenValidOsSysmanPointerWhenCreatingOsPerformanceAndCallingPerformancePropertiesThenErrorIsReturned) {
uint32_t handleId = 0;
for (handleId = 0; handleId < mockHandleCount; handleId++) {
auto pPerformance = std::make_unique<L0::Sysman::PerformanceImp>(pOsSysman, true, handleId, ZES_ENGINE_TYPE_FLAG_MEDIA);
zes_perf_properties_t properties = {};
EXPECT_EQ(ZE_RESULT_SUCCESS, pPerformance->performanceGetProperties(&properties));
EXPECT_FALSE(pPerformance->pOsPerformance->isPerformanceSupported());
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pPerformance->pOsPerformance->osPerformanceGetProperties(properties));
zes_perf_handle_t perfHandle = pPerformance->toPerformanceHandle();
EXPECT_EQ(pPerformance.get(), L0::Sysman::Performance::fromHandle(perfHandle));
}
}
TEST_F(ZesPerformanceFixture, GivenValidOsSysmanPointerWhenCreatingOsPerformanceAndCallingPerformanceGetAndSetConfigThenErrorIsReturned) {
uint32_t handleId = 0;
for (handleId = 0; handleId < mockHandleCount; handleId++) {
auto pPerformance = std::make_unique<L0::Sysman::PerformanceImp>(pOsSysman, true, handleId, ZES_ENGINE_TYPE_FLAG_MEDIA);
double factor = 0;
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pPerformance->performanceGetConfig(&factor));
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, pPerformance->performanceSetConfig(factor));
EXPECT_FALSE(static_cast<L0::Sysman::PerformanceImp *>(pPerformance)->pOsPerformance->isPerformanceSupported());
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE,
static_cast<L0::Sysman::PerformanceImp *>(pPerformance)->pOsPerformance->osPerformanceGetProperties(properties));
zes_perf_handle_t perfHandle = pPerformance->toPerformanceHandle();
EXPECT_EQ(pPerformance, L0::Sysman::Performance::fromHandle(perfHandle));
delete pPerformance;
EXPECT_EQ(pPerformance.get(), L0::Sysman::Performance::fromHandle(perfHandle));
}
}

View File

@@ -548,7 +548,7 @@ TEST_F(SysmanDeviceSchedulerFixture, GivenValidDeviceHandleWhenCallingzesSchedul
for (auto handle : handles) {
ze_bool_t needReload;
ze_result_t result = zesSchedulerSetComputeUnitDebugMode(handle, &needReload);
EXPECT_EQ(ZE_RESULT_ERROR_UNSUPPORTED_FEATURE, result);
EXPECT_EQ(ZE_RESULT_ERROR_NOT_AVAILABLE, result);
}
}