2019-11-13 12:54:56 +01:00
|
|
|
/*
|
2020-01-14 14:32:11 +01:00
|
|
|
* Copyright (C) 2019-2020 Intel Corporation
|
2019-11-13 12:54:56 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "test.h"
|
|
|
|
#include "unit_tests/mocks/mock_device.h"
|
|
|
|
#include "unit_tests/mocks/mock_kernel.h"
|
|
|
|
|
2020-02-22 09:28:27 +01:00
|
|
|
#include "helpers/hardware_commands_helper.h"
|
|
|
|
|
2019-11-13 12:54:56 +01:00
|
|
|
using namespace NEO;
|
|
|
|
|
2020-01-23 15:52:49 +01:00
|
|
|
using KernelTgllpTests = ::testing::Test;
|
2019-11-13 12:54:56 +01:00
|
|
|
|
2020-01-23 15:52:49 +01:00
|
|
|
TGLLPTEST_F(KernelTgllpTests, GivenUseOffsetToSkipSetFFIDGPWorkaroundActiveWhenSettingKernelStartOffsetThenAdditionalOffsetIsSet) {
|
2019-11-13 12:54:56 +01:00
|
|
|
const uint64_t defaultKernelStartOffset = 0;
|
|
|
|
const uint64_t additionalOffsetDueToFfid = 0x1234;
|
|
|
|
SPatchThreadPayload threadPayload{};
|
|
|
|
threadPayload.OffsetToSkipSetFFIDGP = additionalOffsetDueToFfid;
|
|
|
|
auto hwInfo = *platformDevices[0];
|
|
|
|
|
2019-12-13 16:31:09 +01:00
|
|
|
unsigned short steppings[] = {REVISION_A0, REVISION_A1, REVISION_A3, REVISION_B};
|
|
|
|
for (auto stepping : steppings) {
|
|
|
|
|
|
|
|
hwInfo.platform.usRevId = stepping;
|
2020-01-14 14:32:11 +01:00
|
|
|
auto device = std::make_unique<MockClDevice>(MockDevice::createWithNewExecutionEnvironment<MockDevice>(&hwInfo));
|
2019-11-13 12:54:56 +01:00
|
|
|
MockKernelWithInternals mockKernelWithInternals{*device};
|
|
|
|
mockKernelWithInternals.kernelInfo.patchInfo.threadPayload = &threadPayload;
|
|
|
|
|
|
|
|
for (auto isCcsUsed : ::testing::Bool()) {
|
2020-01-23 15:52:49 +01:00
|
|
|
uint64_t kernelStartOffset = mockKernelWithInternals.mockKernel->getKernelStartOffset(false, false, isCcsUsed);
|
2019-11-13 12:54:56 +01:00
|
|
|
|
2019-12-13 16:31:09 +01:00
|
|
|
if (stepping < REVISION_B && isCcsUsed) {
|
2019-11-13 12:54:56 +01:00
|
|
|
EXPECT_EQ(defaultKernelStartOffset + additionalOffsetDueToFfid, kernelStartOffset);
|
|
|
|
} else {
|
|
|
|
EXPECT_EQ(defaultKernelStartOffset, kernelStartOffset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-23 15:52:49 +01:00
|
|
|
}
|