2018-05-08 13:51:31 +02:00
|
|
|
/*
|
2025-03-07 10:07:22 +00:00
|
|
|
* Copyright (C) 2018-2025 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
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2020-02-23 22:44:01 +01:00
|
|
|
#include "shared/source/helpers/aux_translation.h"
|
2022-07-27 15:35:15 +00:00
|
|
|
#include "shared/test/common/cmd_parse/gen_cmd_parse.h"
|
2020-02-24 10:22:30 +01:00
|
|
|
|
2022-06-25 22:24:42 +00:00
|
|
|
#include <cstddef>
|
|
|
|
|
#include <vector>
|
2020-07-30 15:02:11 +02:00
|
|
|
|
2024-07-30 15:03:54 +00:00
|
|
|
class DebugManagerStateRestore;
|
|
|
|
|
|
2024-08-13 16:10:23 +00:00
|
|
|
namespace WalkerPartition {
|
|
|
|
|
|
|
|
|
|
struct WalkerPartitionArgs;
|
|
|
|
|
|
|
|
|
|
} // namespace WalkerPartition
|
|
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
namespace NEO {
|
2018-05-08 13:51:31 +02:00
|
|
|
|
2022-04-26 14:28:18 +00:00
|
|
|
class CommandStreamReceiver;
|
|
|
|
|
class LinearStream;
|
2023-01-26 14:33:36 +00:00
|
|
|
struct DeviceInfo;
|
2021-04-13 11:03:51 +00:00
|
|
|
struct KernelDescriptor;
|
2018-10-02 10:10:29 -07:00
|
|
|
struct HardwareInfo;
|
2023-01-26 13:39:28 +00:00
|
|
|
struct RootDeviceEnvironment;
|
2018-08-21 19:55:20 +02:00
|
|
|
|
2024-07-30 15:03:54 +00:00
|
|
|
struct UnitTestSetter {
|
|
|
|
|
static void disableHeapless(const DebugManagerStateRestore &restorer);
|
|
|
|
|
static void disableHeaplessStateInit(const DebugManagerStateRestore &restorer);
|
2024-08-23 13:20:08 +00:00
|
|
|
static void setCcsExposure(RootDeviceEnvironment &rootDeviceEnvironment);
|
|
|
|
|
static void setRcsExposure(RootDeviceEnvironment &rootDeviceEnvironment);
|
2024-07-30 15:03:54 +00:00
|
|
|
};
|
|
|
|
|
|
2018-05-08 13:51:31 +02:00
|
|
|
template <typename GfxFamily>
|
2025-03-18 00:28:35 +00:00
|
|
|
struct UnitTestHelperWithHeap {
|
|
|
|
|
static bool getDisableFusionStateFromFrontEndCommand(const typename GfxFamily::FrontEndStateCommand &feCmd);
|
|
|
|
|
static bool getComputeDispatchAllWalkerFromFrontEndCommand(const typename GfxFamily::FrontEndStateCommand &feCmd);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct UnitTestHelperNoHeap {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
using UnitTestHelperBase = std::conditional_t<GfxFamily::isHeaplessRequired(), UnitTestHelperNoHeap<GfxFamily>, UnitTestHelperWithHeap<GfxFamily>>;
|
|
|
|
|
|
|
|
|
|
template <typename GfxFamily>
|
|
|
|
|
struct UnitTestHelper : public UnitTestHelperBase<GfxFamily> {
|
2021-04-13 00:36:24 +00:00
|
|
|
using COHERENCY_TYPE = typename GfxFamily::RENDER_SURFACE_STATE::COHERENCY_TYPE;
|
|
|
|
|
|
2018-05-08 13:51:31 +02:00
|
|
|
static bool isL3ConfigProgrammable();
|
2018-08-21 19:55:20 +02:00
|
|
|
|
2021-04-13 11:03:51 +00:00
|
|
|
static bool evaluateDshUsage(size_t sizeBeforeEnqueue, size_t sizeAfterEnqueue, const KernelDescriptor *kernelDescriptor, uint32_t rootDeviceIndex);
|
2018-10-02 10:10:29 -07:00
|
|
|
|
|
|
|
|
static bool isPageTableManagerSupported(const HardwareInfo &hwInfo);
|
2018-10-18 13:40:53 +02:00
|
|
|
|
2018-11-14 15:29:10 +01:00
|
|
|
static bool isTimestampPacketWriteSupported();
|
2018-11-28 15:32:13 +01:00
|
|
|
|
|
|
|
|
static bool isExpectMemoryNotEqualSupported();
|
2019-01-03 17:52:08 +01:00
|
|
|
|
|
|
|
|
static uint32_t getDefaultSshUsage();
|
|
|
|
|
|
2022-03-07 17:00:26 +00:00
|
|
|
static uint32_t getAppropriateThreadArbitrationPolicy(int32_t policy);
|
2019-11-12 13:59:37 +01:00
|
|
|
|
2021-04-13 00:36:24 +00:00
|
|
|
static auto getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType);
|
|
|
|
|
|
2019-01-03 17:52:08 +01:00
|
|
|
static bool evaluateGshAddressForScratchSpace(uint64_t usedScratchGpuAddress, uint64_t retrievedGshAddress);
|
2019-08-14 09:33:51 +02:00
|
|
|
|
|
|
|
|
static bool isPipeControlWArequired(const HardwareInfo &hwInfo);
|
2019-08-29 10:42:17 +02:00
|
|
|
|
2020-11-30 18:32:05 +00:00
|
|
|
static bool isAdditionalSynchronizationRequired();
|
2020-04-25 11:09:57 +02:00
|
|
|
|
2023-01-26 13:39:28 +00:00
|
|
|
static bool isAdditionalMiSemaphoreWaitRequired(const RootDeviceEnvironment &rootDeviceEnvironment);
|
2020-02-04 20:26:04 +01:00
|
|
|
|
|
|
|
|
static bool isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait);
|
|
|
|
|
|
2021-06-09 10:00:13 +00:00
|
|
|
static uint64_t getAtomicMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic);
|
2019-09-06 10:25:14 +02:00
|
|
|
|
2021-10-26 07:42:53 +00:00
|
|
|
static bool requiresTimestampPacketsInSystemMemory(HardwareInfo &hwInfo);
|
2020-05-27 17:39:43 +02:00
|
|
|
|
2021-09-23 16:46:42 +00:00
|
|
|
static uint32_t getDebugModeRegisterOffset();
|
|
|
|
|
static uint32_t getDebugModeRegisterValue();
|
|
|
|
|
static uint32_t getTdCtlRegisterOffset();
|
|
|
|
|
static uint32_t getTdCtlRegisterValue();
|
|
|
|
|
|
2023-04-27 14:13:51 +00:00
|
|
|
static uint32_t getMiLoadRegisterImmProgrammedCmdsCount(bool debuggingEnabled);
|
|
|
|
|
|
2019-10-01 08:35:02 +02:00
|
|
|
static const uint32_t smallestTestableSimdSize;
|
2019-11-22 09:50:10 +01:00
|
|
|
|
|
|
|
|
static const AuxTranslationMode requiredAuxTranslationMode;
|
2020-02-04 17:58:41 +01:00
|
|
|
|
|
|
|
|
static const bool useFullRowForLocalIdsGeneration;
|
2020-03-12 10:49:20 +01:00
|
|
|
|
|
|
|
|
static const bool additionalMiFlushDwRequired;
|
2021-11-08 16:50:31 +00:00
|
|
|
|
|
|
|
|
static uint64_t getPipeControlPostSyncAddress(const typename GfxFamily::PIPE_CONTROL &pipeControl);
|
2022-01-17 12:54:53 +00:00
|
|
|
static bool getPipeControlHdcPipelineFlush(const typename GfxFamily::PIPE_CONTROL &pipeControl);
|
|
|
|
|
static void setPipeControlHdcPipelineFlush(typename GfxFamily::PIPE_CONTROL &pipeControl, bool hdcPipelineFlush);
|
2022-02-23 13:27:24 +00:00
|
|
|
|
|
|
|
|
static void adjustKernelDescriptorForImplicitArgs(KernelDescriptor &kernelDescriptor);
|
2022-04-26 14:28:18 +00:00
|
|
|
|
|
|
|
|
static std::vector<bool> getProgrammedLargeGrfValues(CommandStreamReceiver &csr, LinearStream &linearStream);
|
2022-04-08 18:48:45 +00:00
|
|
|
|
2025-03-07 10:07:22 +00:00
|
|
|
static std::vector<bool> getProgrammedLargeGrfValues(LinearStream &linearStream);
|
|
|
|
|
|
2023-04-20 13:28:57 +00:00
|
|
|
static uint32_t getProgrammedGrfValue(CommandStreamReceiver &csr, LinearStream &linearStream);
|
|
|
|
|
|
2022-04-08 18:48:45 +00:00
|
|
|
static bool getWorkloadPartitionForStoreRegisterMemCmd(typename GfxFamily::MI_STORE_REGISTER_MEM &storeRegisterMem);
|
|
|
|
|
|
|
|
|
|
static bool timestampRegisterHighAddress();
|
2022-06-28 18:52:33 +00:00
|
|
|
|
|
|
|
|
static void validateSbaMocs(uint32_t expectedMocs, CommandStreamReceiver &csr);
|
2022-07-27 15:35:15 +00:00
|
|
|
|
2024-07-01 19:50:09 +00:00
|
|
|
static GenCmdList::iterator findCsrBaseAddressCommand(GenCmdList::iterator begin, GenCmdList::iterator end);
|
2022-07-27 15:35:15 +00:00
|
|
|
|
|
|
|
|
static std::vector<GenCmdList::iterator> findAllMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end);
|
2024-08-13 16:14:56 +00:00
|
|
|
static uint32_t getInlineDataSize(bool isHeaplessEnabled);
|
2022-09-19 13:09:56 +00:00
|
|
|
static bool getSystolicFlagValueFromPipelineSelectCommand(const typename GfxFamily::PIPELINE_SELECT &pipelineSelectCmd);
|
2023-02-02 18:57:24 +00:00
|
|
|
static size_t getAdditionalDshSize(uint32_t iddCount);
|
2023-01-26 14:33:36 +00:00
|
|
|
static bool expectNullDsh(const DeviceInfo &deviceInfo);
|
2023-03-27 21:37:18 +00:00
|
|
|
|
2024-05-06 09:27:41 +00:00
|
|
|
static bool findStateCacheFlushPipeControl(CommandStreamReceiver &csr, LinearStream &csrStream);
|
2024-02-06 10:17:14 +00:00
|
|
|
static void verifyDummyBlitWa(const RootDeviceEnvironment *rootDeviceEnvironment, GenCmdList::iterator &cmdIterator);
|
2024-08-13 16:10:23 +00:00
|
|
|
static uint64_t getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(bool isHeaplessEnabled, WalkerPartition::WalkerPartitionArgs &testArgs);
|
2024-06-25 15:47:26 +00:00
|
|
|
static GenCmdList::iterator findWalkerTypeCmd(GenCmdList::iterator begin, GenCmdList::iterator end);
|
2024-07-22 16:53:38 +00:00
|
|
|
static std::vector<GenCmdList::iterator> findAllWalkerTypeCmds(GenCmdList::iterator begin, GenCmdList::iterator end);
|
2024-08-26 08:40:34 +00:00
|
|
|
static void getSpaceAndInitWalkerCmd(LinearStream &stream, bool heapless);
|
2024-08-28 14:29:58 +00:00
|
|
|
static void *getInitWalkerCmd(bool heapless);
|
2024-08-13 14:35:13 +00:00
|
|
|
static size_t getWalkerSize(bool isHeaplessEnabled);
|
2025-06-02 23:34:38 +00:00
|
|
|
template <typename WalkerType>
|
|
|
|
|
static uint64_t getWalkerActivePostSyncAddress(WalkerType *walkerCmd);
|
2025-06-09 16:37:11 +00:00
|
|
|
static void skipStatePrefetch(GenCmdList::iterator &iter);
|
2024-10-25 15:10:17 +00:00
|
|
|
|
|
|
|
|
static bool isHeaplessAllowed();
|
2018-05-08 13:51:31 +02:00
|
|
|
};
|
2020-02-04 20:26:04 +01:00
|
|
|
|
2019-03-26 11:59:46 +01:00
|
|
|
} // namespace NEO
|