2018-05-08 13:51:31 +02:00
|
|
|
/*
|
2024-04-26 08:03:52 +00:00
|
|
|
* Copyright (C) 2018-2024 Intel Corporation
|
2018-05-08 13:51:31 +02:00
|
|
|
*
|
2018-09-18 09:11:08 +02:00
|
|
|
* SPDX-License-Identifier: MIT
|
2018-05-08 13:51:31 +02:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-27 21:37:18 +00:00
|
|
|
#include "shared/source/command_stream/linear_stream.h"
|
2023-01-26 14:33:36 +00:00
|
|
|
#include "shared/source/device/device_info.h"
|
2022-06-28 10:58:12 +00:00
|
|
|
#include "shared/source/helpers/hw_info.h"
|
2022-06-28 18:52:33 +00:00
|
|
|
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
|
|
|
|
#include "shared/test/common/cmd_parse/hw_parse.h"
|
|
|
|
|
|
|
|
|
|
#include "gtest/gtest.h"
|
2024-08-13 14:35:13 +00:00
|
|
|
#include "unit_test_helper.h"
|
2022-06-28 10:58:12 +00:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-05-08 13:51:31 +02:00
|
|
|
|
2018-10-02 10:10:29 -07:00
|
|
|
template <typename GfxFamily>
|
2023-04-12 21:33:35 +00:00
|
|
|
uint32_t UnitTestHelper<GfxFamily>::getTdCtlRegisterOffset() {
|
|
|
|
|
return 0xe400;
|
2019-11-12 13:59:37 +01:00
|
|
|
}
|
|
|
|
|
|
2019-08-14 09:33:51 +02:00
|
|
|
template <typename GfxFamily>
|
2023-04-12 21:33:35 +00:00
|
|
|
bool UnitTestHelper<GfxFamily>::isPageTableManagerSupported(const HardwareInfo &hwInfo) {
|
2020-04-25 11:09:57 +02:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-04 20:26:04 +01:00
|
|
|
template <typename GfxFamily>
|
2023-04-12 21:33:35 +00:00
|
|
|
bool UnitTestHelper<GfxFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) {
|
2020-02-04 20:26:04 +01:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-04 17:58:41 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
const bool UnitTestHelper<GfxFamily>::useFullRowForLocalIdsGeneration = false;
|
|
|
|
|
|
2020-03-12 10:49:20 +01:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
const bool UnitTestHelper<GfxFamily>::additionalMiFlushDwRequired = false;
|
|
|
|
|
|
2021-11-08 16:50:31 +00:00
|
|
|
template <typename GfxFamily>
|
2021-11-15 17:18:09 +00:00
|
|
|
inline uint64_t UnitTestHelper<GfxFamily>::getPipeControlPostSyncAddress(const typename GfxFamily::PIPE_CONTROL &pipeControl) {
|
2021-11-08 16:50:31 +00:00
|
|
|
uint64_t gpuAddress = pipeControl.getAddress();
|
|
|
|
|
uint64_t gpuAddressHigh = pipeControl.getAddressHigh();
|
|
|
|
|
|
|
|
|
|
return (gpuAddressHigh << 32) | gpuAddress;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-28 18:52:33 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
void UnitTestHelper<GfxFamily>::validateSbaMocs(uint32_t expectedMocs, CommandStreamReceiver &csr) {
|
|
|
|
|
using STATE_BASE_ADDRESS = typename GfxFamily::STATE_BASE_ADDRESS;
|
|
|
|
|
|
|
|
|
|
HardwareParse hwParse;
|
|
|
|
|
hwParse.parseCommands<GfxFamily>(csr.getCS(0), 0);
|
|
|
|
|
auto itorCmd = reverseFind<STATE_BASE_ADDRESS *>(hwParse.cmdList.rbegin(), hwParse.cmdList.rend());
|
|
|
|
|
EXPECT_NE(hwParse.cmdList.rend(), itorCmd);
|
|
|
|
|
auto sba = genCmdCast<STATE_BASE_ADDRESS *>(*itorCmd);
|
|
|
|
|
EXPECT_NE(nullptr, sba);
|
|
|
|
|
|
|
|
|
|
auto mocs = sba->getStatelessDataPortAccessMemoryObjectControlState();
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(expectedMocs, mocs);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-02 13:15:59 +00:00
|
|
|
template <typename GfxFamily>
|
2023-12-05 12:44:46 +00:00
|
|
|
bool UnitTestHelper<GfxFamily>::getDisableFusionStateFromFrontEndCommand(const typename GfxFamily::FrontEndStateCommand &feCmd) {
|
2022-09-02 13:15:59 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
2023-12-05 12:44:46 +00:00
|
|
|
bool UnitTestHelper<GfxFamily>::getComputeDispatchAllWalkerFromFrontEndCommand(const typename GfxFamily::FrontEndStateCommand &feCmd) {
|
2022-09-02 13:15:59 +00:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-26 14:33:36 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
bool UnitTestHelper<GfxFamily>::expectNullDsh(const DeviceInfo &deviceInfo) {
|
|
|
|
|
if constexpr (GfxFamily::supportsSampler) {
|
|
|
|
|
return !deviceInfo.imageSupport;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-13 16:14:56 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
uint32_t UnitTestHelper<GfxFamily>::getInlineDataSize(bool isHeaplessEnabled) {
|
|
|
|
|
using DefaultWalkerType = typename GfxFamily::DefaultWalkerType;
|
|
|
|
|
return DefaultWalkerType::getInlineDataSize();
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-27 21:37:18 +00:00
|
|
|
template <typename GfxFamily>
|
2024-05-06 09:27:41 +00:00
|
|
|
bool UnitTestHelper<GfxFamily>::findStateCacheFlushPipeControl(CommandStreamReceiver &csr, LinearStream &csrStream) {
|
2023-03-27 21:37:18 +00:00
|
|
|
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
|
|
|
|
|
|
|
|
|
|
HardwareParse hwParserCsr;
|
|
|
|
|
hwParserCsr.parsePipeControl = true;
|
|
|
|
|
hwParserCsr.parseCommands<GfxFamily>(csrStream, 0);
|
|
|
|
|
hwParserCsr.findHardwareCommands<GfxFamily>();
|
|
|
|
|
|
|
|
|
|
bool stateCacheFlushFound = false;
|
|
|
|
|
auto itorPipeControl = hwParserCsr.pipeControlList.begin();
|
|
|
|
|
while (itorPipeControl != hwParserCsr.pipeControlList.end()) {
|
|
|
|
|
auto pipeControl = reinterpret_cast<PIPE_CONTROL *>(*itorPipeControl);
|
|
|
|
|
|
|
|
|
|
if (pipeControl->getRenderTargetCacheFlushEnable() &&
|
|
|
|
|
pipeControl->getStateCacheInvalidationEnable() &&
|
2024-05-06 09:27:41 +00:00
|
|
|
pipeControl->getTextureCacheInvalidationEnable() &&
|
|
|
|
|
((csr.isTlbFlushRequiredForStateCacheFlush() && pipeControl->getTlbInvalidate()) || (!csr.isTlbFlushRequiredForStateCacheFlush() && !pipeControl->getTlbInvalidate()))) {
|
2023-03-27 21:37:18 +00:00
|
|
|
stateCacheFlushFound = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
itorPipeControl++;
|
|
|
|
|
}
|
|
|
|
|
return stateCacheFlushFound;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-20 13:28:57 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
uint32_t UnitTestHelper<GfxFamily>::getProgrammedGrfValue(CommandStreamReceiver &csr, LinearStream &linearStream) {
|
|
|
|
|
return 0u;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-27 14:13:51 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
uint32_t UnitTestHelper<GfxFamily>::getMiLoadRegisterImmProgrammedCmdsCount(bool debuggingEnabled) {
|
|
|
|
|
return (debuggingEnabled ? 2u : 0u);
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-03 14:44:03 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
typename GfxFamily::WalkerVariant UnitTestHelper<GfxFamily>::getWalkerVariant(void *walkerItor) {
|
|
|
|
|
if (auto walker = genCmdCast<typename GfxFamily::DefaultWalkerType *>(walkerItor); walker) {
|
|
|
|
|
return walker;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UNRECOVERABLE_IF(true);
|
|
|
|
|
return {};
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-13 14:35:13 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
size_t UnitTestHelper<GfxFamily>::getWalkerSize(bool isHeaplessEnabled) {
|
|
|
|
|
using DefaultWalkerType = typename GfxFamily::DefaultWalkerType;
|
|
|
|
|
return sizeof(DefaultWalkerType);
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-25 15:10:17 +00:00
|
|
|
template <typename GfxFamily>
|
|
|
|
|
bool UnitTestHelper<GfxFamily>::isHeaplessAllowed() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|