Move TGLLP specific workarounds to HwInfo

Related-To: NEO-3914

Change-Id: I115b28ea6e796dcc69b32105e39a68da0e5af7df
Signed-off-by: Pawel Wilma <pawel.wilma@intel.com>
This commit is contained in:
Pawel Wilma
2019-12-13 16:31:09 +01:00
committed by sys_ocldev
parent 37a690a185
commit 0643a89ff9
16 changed files with 122 additions and 80 deletions

View File

@@ -182,6 +182,10 @@ class HwHelperHw : public HwHelper {
static bool isBlitAuxTranslationRequired(const HardwareInfo &hwInfo, const MultiDispatchInfo &multiDispatchInfo);
static bool isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo);
static bool isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo);
protected:
static const AuxTranslationMode defaultAuxTranslationMode;
HwHelperHw() = default;

View File

@@ -262,4 +262,14 @@ uint32_t HwHelperHw<GfxFamily>::getBarriersCountFromHasBarriers(uint32_t hasBarr
return hasBarriers;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) {
return false;
}
template <typename GfxFamily>
bool HwHelperHw<GfxFamily>::isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) {
return false;
}
} // namespace NEO

View File

@@ -118,7 +118,5 @@ struct WorkaroundTableBase {
bool waUntypedBufferCompression = false;
bool waAuxTable16KGranular = false;
bool waDisableFusedThreadScheduling = false;
bool waUseOffsetToSkipSetFFIDGP = false;
bool waForceDefaultRCSEngine = false;
};
} // namespace NEO

View File

@@ -243,7 +243,7 @@ uint64_t DeviceQueueHw<GfxFamily>::getBlockKernelStartPointer(const Device &devi
auto blockKernelStartPointer = blockAllocation ? blockAllocation->getGpuAddressToPatch() : 0llu;
if (blockAllocation && isCcsUsed && device.getHardwareInfo().workaroundTable.waUseOffsetToSkipSetFFIDGP) {
if (blockAllocation && isCcsUsed && HwHelperHw<GfxFamily>::isOffsetToSkipSetFFIDGPWARequired(device.getHardwareInfo())) {
blockKernelStartPointer += blockInfo->patchInfo.threadPayload->OffsetToSkipSetFFIDGP;
}
return blockKernelStartPointer;

View File

@@ -15,9 +15,19 @@
namespace NEO {
typedef TGLLPFamily Family;
template <>
bool HwHelperHw<Family>::isOffsetToSkipSetFFIDGPWARequired(const HardwareInfo &hwInfo) {
return (hwInfo.platform.usRevId < REVISION_B);
}
template <>
bool HwHelperHw<Family>::isForceDefaultRCSEngineWARequired(const HardwareInfo &hwInfo) {
return ((hwInfo.platform.eProductFamily == IGFX_TIGERLAKE_LP) & (hwInfo.platform.usRevId < REVISION_B));
}
template <>
void HwHelperHw<Family>::adjustDefaultEngineType(HardwareInfo *pHwInfo) {
if (!pHwInfo->featureTable.ftrCCSNode || pHwInfo->workaroundTable.waForceDefaultRCSEngine) {
if (!pHwInfo->featureTable.ftrCCSNode || isForceDefaultRCSEngineWARequired(*pHwInfo)) {
pHwInfo->capabilityTable.defaultEngineType = aub_stream::ENGINE_RCS;
}
}

View File

@@ -100,10 +100,6 @@ void TGLLP::setupFeatureAndWorkaroundTable(HardwareInfo *hwInfo) {
workaroundTable->wa4kAlignUVOffsetNV12LinearSurface = true;
workaroundTable->waEnablePreemptionGranularityControlByUMD = true;
workaroundTable->waUntypedBufferCompression = true;
if (hwInfo->platform.usRevId < REVISION_B) {
workaroundTable->waUseOffsetToSkipSetFFIDGP = true;
workaroundTable->waForceDefaultRCSEngine = true;
}
};
const HardwareInfo TGLLP_1x6x16::hwInfo = {

View File

@@ -6,6 +6,7 @@
*/
#pragma once
#include "core/helpers/hw_helper.h"
#include "runtime/helpers/hardware_commands_helper.h"
#include "runtime/kernel/kernel.h"
@@ -103,7 +104,7 @@ void HardwareCommandsHelper<GfxFamily>::setKernelStartOffset(
}
kernelStartOffset += kernel.getStartOffset();
if (isCssUsed && kernel.getDevice().getHardwareInfo().workaroundTable.waUseOffsetToSkipSetFFIDGP) {
if (isCssUsed && HwHelperHw<GfxFamily>::isOffsetToSkipSetFFIDGPWARequired(kernel.getDevice().getHardwareInfo())) {
kernelStartOffset += kernelInfo.patchInfo.threadPayload->OffsetToSkipSetFFIDGP;
}
}

View File

@@ -792,30 +792,3 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TheSimplestDeviceQueueFixture, getProfilingEndCmdsSi
EXPECT_EQ(expectedSize, MockDeviceQueueHw<FamilyType>::getProfilingEndCmdsSize());
}
HWCMDTEST_F(IGFX_GEN8_CORE, DeviceQueueHwTest, givenDeviceQueueWhenRunningOnCCsThenFfidSkipOffsetIsAddedToBlockKernelStartPointer) {
auto device = pContext->getDevice(0);
std::unique_ptr<MockParentKernel> mockParentKernel(MockParentKernel::create(*pContext));
KernelInfo *blockInfo = const_cast<KernelInfo *>(mockParentKernel->mockProgram->blockKernelManager->getBlockKernelInfo(0));
blockInfo->createKernelAllocation(device->getRootDeviceIndex(), device->getMemoryManager());
ASSERT_NE(nullptr, blockInfo->getGraphicsAllocation());
const_cast<SPatchThreadPayload *>(blockInfo->patchInfo.threadPayload)->OffsetToSkipSetFFIDGP = 0x1234;
const_cast<HardwareInfo &>(device->getHardwareInfo()).workaroundTable.waUseOffsetToSkipSetFFIDGP = true;
uint64_t expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch() + blockInfo->patchInfo.threadPayload->OffsetToSkipSetFFIDGP;
uint64_t offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, true);
EXPECT_EQ(expectedOffset, offset);
expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch();
offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, false);
EXPECT_EQ(expectedOffset, offset);
const_cast<HardwareInfo &>(device->getHardwareInfo()).workaroundTable.waUseOffsetToSkipSetFFIDGP = false;
expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch();
offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, true);
EXPECT_EQ(expectedOffset, offset);
offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, false);
EXPECT_EQ(expectedOffset, offset);
}

View File

@@ -12,6 +12,7 @@ if(TESTS_GEN12LP)
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_hw_tests_gen12lp.inl
${CMAKE_CURRENT_SOURCE_DIR}/command_stream_receiver_simulated_common_hw_tests_gen12lp.inl
${CMAKE_CURRENT_SOURCE_DIR}/compute_mode_tests_gen12lp.inl
${CMAKE_CURRENT_SOURCE_DIR}/device_queue_tests_gen12lp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/enqueue_media_kernel_gen12lp.inl
${CMAKE_CURRENT_SOURCE_DIR}/gen12lp_tests_wrapper.cpp
${CMAKE_CURRENT_SOURCE_DIR}/hardware_commands_helper_tests_gen12lp.inl

View File

@@ -0,0 +1,43 @@
/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "unit_tests/fixtures/device_host_queue_fixture.h"
#include "unit_tests/mocks/mock_context.h"
#include "unit_tests/mocks/mock_device.h"
#include "unit_tests/mocks/mock_device_queue.h"
#include "unit_tests/mocks/mock_kernel.h"
using namespace NEO;
using namespace DeviceHostQueue;
GEN12LPTEST_F(DeviceQueueHwTest, givenDeviceQueueWhenRunningOnCCsThenFfidSkipOffsetIsAddedToBlockKernelStartPointer) {
auto device = pContext->getDevice(0);
std::unique_ptr<MockParentKernel> mockParentKernel(MockParentKernel::create(*pContext));
KernelInfo *blockInfo = const_cast<KernelInfo *>(mockParentKernel->mockProgram->blockKernelManager->getBlockKernelInfo(0));
blockInfo->createKernelAllocation(device->getRootDeviceIndex(), device->getMemoryManager());
ASSERT_NE(nullptr, blockInfo->getGraphicsAllocation());
const_cast<SPatchThreadPayload *>(blockInfo->patchInfo.threadPayload)->OffsetToSkipSetFFIDGP = 0x1234;
const_cast<HardwareInfo &>(device->getHardwareInfo()).platform.usRevId = REVISION_A0;
uint64_t expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch() + blockInfo->patchInfo.threadPayload->OffsetToSkipSetFFIDGP;
uint64_t offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, true);
EXPECT_EQ(expectedOffset, offset);
expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch();
offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, false);
EXPECT_EQ(expectedOffset, offset);
const_cast<HardwareInfo &>(device->getHardwareInfo()).platform.usRevId = REVISION_B;
expectedOffset = blockInfo->getGraphicsAllocation()->getGpuAddressToPatch();
offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, true);
EXPECT_EQ(expectedOffset, offset);
offset = MockDeviceQueueHw<FamilyType>::getBlockKernelStartPointer(*device, blockInfo, false);
EXPECT_EQ(expectedOffset, offset);
}

View File

@@ -21,8 +21,10 @@ TGLLPTEST_F(HardwareCommandsGen12LpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroun
threadPayload.OffsetToSkipSetFFIDGP = additionalOffsetDueToFfid;
auto hwInfo = *platformDevices[0];
for (auto workaround : ::testing::Bool()) {
hwInfo.workaroundTable.waUseOffsetToSkipSetFFIDGP = workaround;
unsigned short steppings[] = {REVISION_A0, REVISION_A1, REVISION_A3, REVISION_B};
for (auto stepping : steppings) {
hwInfo.platform.usRevId = stepping;
auto device = std::unique_ptr<MockDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
MockKernelWithInternals mockKernelWithInternals{*device};
mockKernelWithInternals.kernelInfo.patchInfo.threadPayload = &threadPayload;
@@ -32,7 +34,7 @@ TGLLPTEST_F(HardwareCommandsGen12LpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroun
HardwareCommandsHelper<FamilyType>::setKernelStartOffset(kernelStartOffset, false, mockKernelWithInternals.kernelInfo, false,
false, *mockKernelWithInternals.mockKernel, isCcsUsed);
if (workaround && isCcsUsed) {
if (stepping < REVISION_B && isCcsUsed) {
EXPECT_EQ(defaultKernelStartOffset + additionalOffsetDueToFfid, kernelStartOffset);
} else {
EXPECT_EQ(defaultKernelStartOffset, kernelStartOffset);

View File

@@ -64,14 +64,6 @@ GEN12LPTEST_F(HwHelperTestGen12Lp, adjustDefaultEngineTypeNoCcs) {
EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType);
}
GEN12LPTEST_F(HwHelperTestGen12Lp, adjustDefaultEngineTypeCcs) {
hardwareInfo.featureTable.ftrCCSNode = true;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hardwareInfo);
EXPECT_EQ(aub_stream::ENGINE_CCS, hardwareInfo.capabilityTable.defaultEngineType);
}
GEN12LPTEST_F(HwHelperTestGen12Lp, givenGen12LpPlatformWhenSetupHardwareCapabilitiesIsCalledThenDefaultImplementationIsUsed) {
if (SpecialUltHelperGen12lp::shouldTestDefaultImplementationOfSetupHardwareCapabilities(hardwareInfo.platform.eProductFamily)) {
auto &helper = HwHelper::get(renderCoreFamily);

View File

@@ -7,6 +7,7 @@
if(TESTS_TGLLP)
set(IGDRCL_SRCS_tests_gen12lp_tgllp
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_helper_tgllp.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_hw_info_config_tgllp.cpp
)
target_sources(igdrcl_tests PRIVATE ${IGDRCL_SRCS_tests_gen12lp_tgllp})

View File

@@ -0,0 +1,28 @@
/*
* Copyright (C) 2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "unit_tests/helpers/hw_helper_tests.h"
using HwHelperTestGen12Lp = HwHelperTest;
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpA0WhenAdjustDefaultEngineTypeCalledThenRcsIsReturned) {
hardwareInfo.featureTable.ftrCCSNode = true;
hardwareInfo.platform.usRevId = REVISION_A0;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hardwareInfo);
EXPECT_EQ(aub_stream::ENGINE_RCS, hardwareInfo.capabilityTable.defaultEngineType);
}
TGLLPTEST_F(HwHelperTestGen12Lp, givenTgllpA0WhenAdjustDefaultEngineTypeCalledThenCcsIsReturned) {
hardwareInfo.featureTable.ftrCCSNode = true;
hardwareInfo.platform.usRevId = REVISION_B;
auto &helper = HwHelper::get(renderCoreFamily);
helper.adjustDefaultEngineType(&hardwareInfo);
EXPECT_EQ(aub_stream::ENGINE_CCS, hardwareInfo.capabilityTable.defaultEngineType);
}

View File

@@ -80,34 +80,3 @@ TGLLPTEST_F(TgllpHwInfo, givenHwInfoConfigStringThenAfterSetupResultingVmeIsDisa
EXPECT_FALSE(hwInfo.capabilityTable.supportsVme);
}
TGLLPTEST_F(TgllpHwInfo, givenA0SteppingWhenWaTableIsInitializedThenWaUseOffsetToSkipSetFFIDGPIsSet) {
HardwareInfo hwInfo;
hwInfo.platform.usRevId = REVISION_A0;
TGLLP::setupFeatureAndWorkaroundTable(&hwInfo);
EXPECT_TRUE(hwInfo.workaroundTable.waUseOffsetToSkipSetFFIDGP);
}
TGLLPTEST_F(TgllpHwInfo, givenBSteppingWhenWaTableIsInitializedThenWaUseOffsetToSkipSetFFIDGPIsNotSet) {
HardwareInfo hwInfo;
hwInfo.platform.usRevId = REVISION_B;
TGLLP::setupFeatureAndWorkaroundTable(&hwInfo);
EXPECT_FALSE(hwInfo.workaroundTable.waUseOffsetToSkipSetFFIDGP);
}
TGLLPTEST_F(TgllpHwInfo, givenA0SteppingWhenWaTableIsInitializedThenWaForceDefaultRCSEngineIsSet) {
HardwareInfo hwInfo;
hwInfo.platform.usRevId = REVISION_A0;
TGLLP::setupFeatureAndWorkaroundTable(&hwInfo);
EXPECT_TRUE(hwInfo.workaroundTable.waForceDefaultRCSEngine);
}
TGLLPTEST_F(TgllpHwInfo, givenBSteppingWhenWaTableIsInitializedThenWaForceDefaultRCSEngineIsNotSet) {
HardwareInfo hwInfo;
hwInfo.platform.usRevId = REVISION_B;
TGLLP::setupFeatureAndWorkaroundTable(&hwInfo);
EXPECT_FALSE(hwInfo.workaroundTable.waForceDefaultRCSEngine);
}

View File

@@ -784,9 +784,23 @@ HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, GivenVariousValuesWhenCallingCalculate
EXPECT_EQ(hardwareInfo.gtSystemInfo.ThreadCount, result);
}
HWCMDTEST_F(IGFX_GEN8_CORE, HwHelperTest, givenWaForceDefaultRcsEngineIsSetWhenAdjustDefaultEngineTypeIsCalledThenRcsIsUsedAsDefaultEngine) {
HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsOffsetToSkipSetFFIDGPWARequiredCalledThenFalseIsReturned) {
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP();
}
EXPECT_FALSE(HwHelperHw<FamilyType>::isOffsetToSkipSetFFIDGPWARequired(hardwareInfo));
}
HWTEST_F(HwHelperTest, givenDefaultHwHelperHwWhenIsForceDefaultRCSEngineWARequiredCalledThenFalseIsReturned) {
if (hardwareInfo.platform.eRenderCoreFamily == IGFX_GEN12LP_CORE) {
GTEST_SKIP();
}
EXPECT_FALSE(HwHelperHw<FamilyType>::isForceDefaultRCSEngineWARequired(hardwareInfo));
}
TGLLPTEST_F(HwHelperTest, givenWaForceDefaultRcsEngineIsSetWhenAdjustDefaultEngineTypeIsCalledThenRcsIsUsedAsDefaultEngine) {
hardwareInfo.featureTable.ftrCCSNode = true;
hardwareInfo.workaroundTable.waForceDefaultRCSEngine = true;
hardwareInfo.platform.usRevId = REVISION_A0;
auto &helper = HwHelper::get(hardwareInfo.platform.eRenderCoreFamily);
helper.adjustDefaultEngineType(&hardwareInfo);