Linux dll tests: test turbo patch only on supported platforms

use deviceId from first entry in deviceDescriptorTable as default deviceId
correct using simplified mocs table

Change-Id: I3a6e7cd599912380d48937767f201b44ee98e391
This commit is contained in:
Mateusz Jablonski 2018-05-18 09:53:59 +02:00 committed by sys_ocldev
parent c2368739ce
commit 08faa004aa
5 changed files with 63 additions and 12 deletions

View File

@ -210,7 +210,7 @@ Drm *Drm::create(int32_t deviceOrdinal) {
if (ret != 0) {
//turbo patch not present, we are not on custom Kernel, switch to simplified Mocs selection
//do this only for GEN9+
if (eGtType >= GTTYPE_GTA) {
if (device->pHwInfo->pPlatform->eRenderCoreFamily >= IGFX_GEN9_CORE) {
Gmm::useSimplifiedMocsTable = true;
}
printDebugString(DebugManager.flags.PrintDebugMessages.get(), stderr, "%s", "WARNING: Failed to request OCL Turbo Boost\n");

View File

@ -73,7 +73,7 @@ TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENcallGetDeviceIdTHENreturnProper
int deviceId = 0;
int ret = drmNullDevice->getDeviceID(deviceId);
EXPECT_EQ(0, ret);
EXPECT_EQ(0x1916, deviceId);
EXPECT_EQ(deviceDescriptorTable[0].deviceId, deviceId);
}
TEST_F(DrmNullDeviceTests, GIVENdrmNullDeviceWHENcallIoctlTHENalwaysSuccess) {

View File

@ -26,6 +26,7 @@
#include "runtime/helpers/basic_math.h"
#include "runtime/os_interface/linux/allocator_helper.h"
#include "unit_tests/custom_event_listener.h"
#include "unit_tests/helpers/variable_backup.h"
#include "test.h"
using namespace OCLRT;
@ -199,6 +200,7 @@ TEST_F(DrmTests, failOnSoftPin) {
}
TEST_F(DrmTests, failOnParamBoost) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
@ -206,23 +208,73 @@ TEST_F(DrmTests, failOnParamBoost) {
EXPECT_NE(ptr, nullptr);
}
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenDeviceLowerThenGen9IsCreatedThenSimplifiedMocsSelectionIsFalse) {
#ifdef SUPPORT_BDW
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenBdwDeviceIsCreatedThenSimplifiedMocsSelectionIsFalse) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
useSimplifiedMocsTableBckp = false;
deviceId = IBDW_GT3_WRK_DEVICE_F0_ID;
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
EXPECT_NE(ptr, nullptr);
EXPECT_FALSE(Gmm::useSimplifiedMocsTable);
}
#endif
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenDeviceIsNewerThenGen9IsCreatedThenSimplifiedMocsSelectionIsTrue) {
Gmm::useSimplifiedMocsTable = false;
#ifdef SUPPORT_SKL
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenSklDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
useSimplifiedMocsTableBckp = false;
deviceId = ISKL_GT2_DT_DEVICE_F0_ID;
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
EXPECT_NE(ptr, nullptr);
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
}
#endif
#ifdef SUPPORT_KBL
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenKblDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
useSimplifiedMocsTableBckp = false;
deviceId = IKBL_GT1_ULT_DEVICE_F0_ID;
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
EXPECT_NE(ptr, nullptr);
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
}
#endif
#ifdef SUPPORT_BXT
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenBxtDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
useSimplifiedMocsTableBckp = false;
deviceId = IBXT_X_DEVICE_F0_ID;
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
EXPECT_NE(ptr, nullptr);
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
Gmm::useSimplifiedMocsTable = false;
}
#endif
#ifdef SUPPORT_GLK
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenGlkDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
useSimplifiedMocsTableBckp = false;
deviceId = IGLK_GT2_ULT_18EU_DEVICE_F0_ID;
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
EXPECT_NE(ptr, nullptr);
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
}
#endif
#ifdef SUPPORT_CFL
TEST_F(DrmTests, givenKernelNotSupportingTurboPatchWhenCflDeviceIsCreatedThenSimplifiedMocsSelectionIsTrue) {
VariableBackup<bool> useSimplifiedMocsTableBckp(&Gmm::useSimplifiedMocsTable);
useSimplifiedMocsTableBckp = false;
deviceId = ICFL_GT1_S61_DT_DEVICE_F0_ID;
failOnParamBoost = -1;
auto ptr = DrmWrap::createDrm(0);
EXPECT_NE(ptr, nullptr);
EXPECT_TRUE(Gmm::useSimplifiedMocsTable);
}
#endif
TEST_F(DrmTests, givenKernelSupportingTurboPatchWhenDeviceIsCreatedThenSimplifiedMocsSelectionIsFalse) {
auto ptr = DrmWrap::createDrm(0);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -23,15 +23,14 @@
#include "mock_os_layer.h"
#include <cassert>
#include <iostream>
const char *devDri[2] = {"/dev/dri/renderD128", "/dev/dri/card0"};
int (*c_open)(const char *pathname, int flags, ...) = nullptr;
int (*c_ioctl)(int fd, unsigned long int request, ...) = nullptr;
int fakeFd = 1023;
int haveDri = 0; // index of dri to serve, -1 - none
int deviceId = 0x1916; // known DeviceID
int haveDri = 0; // index of dri to serve, -1 - none
int deviceId = OCLRT::deviceDescriptorTable[0].deviceId; // default supported DeviceID
int haveSoftPin = 1;
int havePreemption = 1;
int failOnDeviceId = 0;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Intel Corporation
* Copyright (c) 2017 - 2018, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@ -63,7 +63,7 @@ extern std::array<OCLRT::Drm *, 1> drms;
inline void resetOSMockGlobalState() {
fakeFd = 1023;
haveDri = 0;
deviceId = 0x1916;
deviceId = OCLRT::deviceDescriptorTable[0].deviceId;
haveSoftPin = 1;
failOnDeviceId = 0;
failOnRevisionId = 0;