Adjust default engine type according to feature availability

Change-Id: I1645dfabe69a7697c1e17950c4d82e77f98984bf
This commit is contained in:
Zdanowicz, Zbigniew
2018-01-09 14:25:30 +01:00
committed by sys_ocldev
parent 4f884496a6
commit 8efafc1efb
9 changed files with 75 additions and 40 deletions

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"),
@ -54,4 +54,7 @@ bool HwHelper::setupPreemptionRegisters(HardwareInfo *pHwInfo, bool enable) {
return false;
}
void HwHelper::adjustDefaultEngineType(HardwareInfo *pHwInfo) {
}
} // namespace OCLRT

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"),
@ -38,6 +38,7 @@ class HwHelper {
virtual size_t getMaxBarrierRegisterPerSlice() const;
virtual void setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag);
virtual bool setupPreemptionRegisters(HardwareInfo *pHwInfo, bool enable);
virtual void adjustDefaultEngineType(HardwareInfo *pHwInfo);
protected:
HwHelper(){};
@ -79,6 +80,8 @@ class HwHelperHw : public HwHelper {
bool setupPreemptionRegisters(HardwareInfo *pHwInfo, bool enable) override;
void adjustDefaultEngineType(HardwareInfo *pHwInfo) override;
private:
HwHelperHw(){};
};

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"),
@ -27,4 +27,8 @@ template <typename Family>
void HwHelperHw<Family>::setCapabilityCoherencyFlag(const HardwareInfo *pHwInfo, bool &coherencyFlag) {
coherencyFlag = true;
}
template <typename Family>
void HwHelperHw<Family>::adjustDefaultEngineType(HardwareInfo *pHwInfo) {
}
} // namespace OCLRT

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"),
@ -67,6 +67,7 @@ bool DeviceFactory::getDevices(HardwareInfo **pHWInfos, size_t &numDevices) {
tempHwInfos[devNum].capabilityTable.ftrSvm = adapterInfo->SkuTable.FtrSVM;
HwHelper &hwHelper = HwHelper::get(adapterInfo->GfxPlatform.eRenderCoreFamily);
hwHelper.adjustDefaultEngineType(&tempHwInfos[devNum]);
hwHelper.setCapabilityCoherencyFlag(&tempHwInfos[devNum], tempHwInfos[devNum].capabilityTable.ftrSupportsCoherency);
hwHelper.setupPreemptionRegisters(&tempHwInfos[devNum], !!adapterInfo->WaTable.WaEnablePreemptionGranularityControlByUMD);
// Instrumentation

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"),
@ -34,7 +34,7 @@ GEN8TEST_F(HwHelperTestBdw, setCapabilityCoherencyFlag) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = false;
helper.setCapabilityCoherencyFlag(pHwInfo, coherency);
helper.setCapabilityCoherencyFlag(&hwInfo, coherency);
EXPECT_TRUE(coherency);
}
@ -42,10 +42,17 @@ GEN8TEST_F(HwHelperTestBdw, setupPreemptionRegisters) {
auto &helper = HwHelper::get(renderCoreFamily);
bool preemption = false;
preemption = helper.setupPreemptionRegisters(pHwInfo, preemption);
preemption = helper.setupPreemptionRegisters(&hwInfo, preemption);
EXPECT_FALSE(preemption);
preemption = true;
preemption = helper.setupPreemptionRegisters(pHwInfo, preemption);
preemption = helper.setupPreemptionRegisters(&hwInfo, preemption);
EXPECT_FALSE(preemption);
}
GEN8TEST_F(HwHelperTestBdw, adjustDefaultEngineType) {
auto engineType = hwInfo.capabilityTable.nodeOrdinal;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hwInfo);
EXPECT_EQ(engineType, hwInfo.capabilityTable.nodeOrdinal);
}

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"),
@ -33,7 +33,7 @@ GEN9TEST_F(HwHelperTestSkl, setCapabilityCoherencyFlag) {
auto &helper = HwHelper::get(renderCoreFamily);
bool coherency = false;
helper.setCapabilityCoherencyFlag(pHwInfo, coherency);
helper.setCapabilityCoherencyFlag(&hwInfo, coherency);
EXPECT_TRUE(coherency);
}
@ -41,12 +41,19 @@ GEN9TEST_F(HwHelperTestSkl, setupPreemptionRegisters) {
auto &helper = HwHelper::get(renderCoreFamily);
bool preemption = false;
preemption = helper.setupPreemptionRegisters(pHwInfo, preemption);
preemption = helper.setupPreemptionRegisters(&hwInfo, preemption);
EXPECT_FALSE(preemption);
EXPECT_FALSE(pHwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
EXPECT_FALSE(hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580);
preemption = true;
preemption = helper.setupPreemptionRegisters(pHwInfo, preemption);
preemption = helper.setupPreemptionRegisters(&hwInfo, preemption);
EXPECT_TRUE(preemption);
EXPECT_TRUE(pHwInfo->capabilityTable.whitelistedRegisters.csChicken1_0x2580);
EXPECT_TRUE(hwInfo.capabilityTable.whitelistedRegisters.csChicken1_0x2580);
}
GEN9TEST_F(HwHelperTestSkl, adjustDefaultEngineType) {
auto engineType = hwInfo.capabilityTable.nodeOrdinal;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hwInfo);
EXPECT_EQ(engineType, hwInfo.capabilityTable.nodeOrdinal);
}

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"),
@ -21,6 +21,21 @@
*/
#include "unit_tests/helpers/hw_helper_tests.h"
#include "runtime/helpers/options.h"
void HwHelperTest::SetUp() {
memcpy(&testPlatform, platformDevices[0]->pPlatform, sizeof(testPlatform));
memcpy(&testFtrTable, platformDevices[0]->pSkuTable, sizeof(testFtrTable));
memcpy(&testWaTable, platformDevices[0]->pWaTable, sizeof(testWaTable));
memcpy(&testSysInfo, platformDevices[0]->pSysInfo, sizeof(testSysInfo));
hwInfo.capabilityTable = platformDevices[0]->capabilityTable;
hwInfo.pPlatform = &testPlatform;
hwInfo.pSkuTable = &testFtrTable;
hwInfo.pSysInfo = &testSysInfo;
hwInfo.pWaTable = &testWaTable;
}
void HwHelperTest::TearDown() {
}
HWTEST_F(HwHelperTest, getReturnsValidHwHelper) {
auto helper = HwHelper::get(renderCoreFamily);
@ -94,13 +109,18 @@ HWTEST_F(HwHelperTest, setCapabilityCoherencyFlagDummy) {
bool coherency = false;
auto helper = HwHelper::get(renderCoreFamily);
helper.setCapabilityCoherencyFlag(pHwInfo, coherency);
helper.setCapabilityCoherencyFlag(&hwInfo, coherency);
}
HWTEST_F(HwHelperTest, setupPreemptionRegistersDummy) {
bool preemption = false;
auto helper = HwHelper::get(renderCoreFamily);
helper.setupPreemptionRegisters(pHwInfo, preemption);
helper.setupPreemptionRegisters(&hwInfo, preemption);
}
HWTEST_F(HwHelperTest, adjustDefaultEngineTypeDummy) {
auto helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hwInfo);
}
TEST(DwordBuilderTest, setNonMaskedBits) {

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"),
@ -24,32 +24,18 @@
#include "runtime/device/device.h"
#include "runtime/helpers/hw_helper.h"
#include "runtime/helpers/options.h"
#include "unit_tests/fixtures/platform_fixture.h"
#include "test.h"
using namespace OCLRT;
class HwHelperTest : public testing::Test,
public PlatformFixture {
void SetUp() override {
PlatformFixture::SetUp(numPlatformDevices, platformDevices);
const HardwareInfo &hwInfo = pPlatform->getDevice(0)->getHardwareInfo();
pHwInfo = const_cast<HardwareInfo *>(&hwInfo);
pOldPlatform = pHwInfo->pPlatform;
memcpy(&testPlatform, pOldPlatform, sizeof(testPlatform));
capabilities = pHwInfo->capabilityTable;
pHwInfo->pPlatform = &testPlatform;
}
void TearDown() override {
pHwInfo->pPlatform = pOldPlatform;
pHwInfo->capabilityTable = capabilities;
PlatformFixture::TearDown();
}
class HwHelperTest : public testing::Test {
void SetUp() override;
void TearDown() override;
protected:
const PLATFORM *pOldPlatform;
PLATFORM testPlatform;
RuntimeCapabilityTable capabilities;
HardwareInfo *pHwInfo;
FeatureTable testFtrTable;
WorkaroundTable testWaTable;
GT_SYSTEM_INFO testSysInfo;
HardwareInfo hwInfo;
};

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"),
@ -49,6 +49,10 @@ bool HwHelperHw<GENX>::setupPreemptionRegisters(HardwareInfo *pHwInfo, bool enab
return enable;
}
template <>
void HwHelperHw<GENX>::adjustDefaultEngineType(HardwareInfo *pHwInfo) {
}
struct hw_helper_static_init {
hw_helper_static_init() {
hwHelperFactory[IGFX_UNKNOWN_CORE] = &HwHelperHw<GENX>::get();