1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
|
/*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "opencl/test/unit_test/os_interface/linux/device_factory_tests.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/os_interface/linux/os_interface.h"
#include "shared/source/os_interface/os_interface.h"
#include "shared/test/unit_test/helpers/default_hw_info.h"
TEST_F(DeviceFactoryLinuxTest, PrepareDeviceEnvironmentsCheckEUCntSSCnt) {
const HardwareInfo *refHwinfo = defaultHwInfo.get();
pDrm->StoredEUVal = 16;
pDrm->StoredSSVal = 8;
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
EXPECT_TRUE(success);
EXPECT_NE(hwInfo, nullptr);
EXPECT_EQ(refHwinfo->platform.eDisplayCoreFamily, hwInfo->platform.eDisplayCoreFamily);
EXPECT_EQ((int)hwInfo->gtSystemInfo.EUCount, 16);
EXPECT_EQ((int)hwInfo->gtSystemInfo.SubSliceCount, 8);
//temporararily return GT2.
EXPECT_EQ(1u, hwInfo->featureTable.ftrGT2);
}
TEST_F(DeviceFactoryLinuxTest, givenSomeDisabledSSAndEUWhenPrepareDeviceEnvironmentsThenCorrectObtainEUCntSSCnt) {
const HardwareInfo *refHwinfo = defaultHwInfo.get();
pDrm->StoredEUVal = 144;
pDrm->StoredSSVal = 12;
pDrm->StoredSVal = 2;
pDrm->disableSomeTopology = true;
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
EXPECT_TRUE(success);
EXPECT_NE(hwInfo, nullptr);
EXPECT_EQ(refHwinfo->platform.eDisplayCoreFamily, hwInfo->platform.eDisplayCoreFamily);
EXPECT_EQ((int)hwInfo->gtSystemInfo.SliceCount, 1);
EXPECT_EQ((int)hwInfo->gtSystemInfo.SubSliceCount, 2);
EXPECT_EQ((int)hwInfo->gtSystemInfo.EUCount, 12);
}
TEST_F(DeviceFactoryLinuxTest, PrepareDeviceEnvironmentsDrmCreateFailedConfigureHwInfo) {
pDrm->StoredRetValForDeviceID = -1;
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
EXPECT_FALSE(success);
pDrm->StoredRetValForDeviceID = 0;
}
TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAllocatedAndItContainDrm) {
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
EXPECT_TRUE(success);
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->osInterface);
EXPECT_NE(nullptr, pDrm);
EXPECT_EQ(pDrm, executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getDrm());
}
TEST_F(DeviceFactoryLinuxTest, whenDrmIsNotCretedThenPrepareDeviceEnvironmentsFails) {
delete pDrm;
pDrm = nullptr;
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
EXPECT_FALSE(success);
}
|