/* * Copyright (C) 2022-2024 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/helpers/hw_info.h" #include "shared/source/kernel/kernel_descriptor.h" #include "shared/test/common/cmd_parse/gen_cmd_parse.h" #include "shared/test/common/helpers/unit_test_helper.h" namespace NEO { template uint64_t UnitTestHelper::getAtomicMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic) { return atomic.getMemoryAddress() | ((static_cast(atomic.getMemoryAddressHigh())) << 32); } template const uint32_t UnitTestHelper::smallestTestableSimdSize = 8; template uint32_t UnitTestHelper::getAppropriateThreadArbitrationPolicy(int32_t policy) { return static_cast(policy); } template void UnitTestHelper::setExtraMidThreadPreemptionFlag(HardwareInfo &hwInfo, bool value) { hwInfo.featureTable.flags.ftrGpGpuMidThreadLevelPreempt = value; } template bool UnitTestHelper::isAdditionalMiSemaphoreWaitRequired(const RootDeviceEnvironment &rootDeviceEnvironment) { return false; } template uint32_t UnitTestHelper::getDebugModeRegisterValue() { return (1u << 5) | (1u << 21); } template bool UnitTestHelper::isAdditionalSynchronizationRequired() { return false; } template bool UnitTestHelper::requiresTimestampPacketsInSystemMemory(HardwareInfo &hwInfo) { return !hwInfo.featureTable.flags.ftrLocalMemory; } template const AuxTranslationMode UnitTestHelper::requiredAuxTranslationMode = AuxTranslationMode::builtin; template uint32_t UnitTestHelper::getTdCtlRegisterValue() { return (1u << 7) | (1u << 4); } template bool UnitTestHelper::isL3ConfigProgrammable() { return true; }; template bool UnitTestHelper::timestampRegisterHighAddress() { return false; } template bool UnitTestHelper::evaluateDshUsage(size_t sizeBeforeEnqueue, size_t sizeAfterEnqueue, const KernelDescriptor *kernelDescriptor, uint32_t rootDeviceIndex) { if (sizeBeforeEnqueue != sizeAfterEnqueue) { return true; } return false; } template bool UnitTestHelper::isTimestampPacketWriteSupported() { return false; } template bool UnitTestHelper::isExpectMemoryNotEqualSupported() { return false; } template uint32_t UnitTestHelper::getDefaultSshUsage() { return sizeof(typename GfxFamily::RENDER_SURFACE_STATE); } template bool UnitTestHelper::isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait) { return false; } template bool UnitTestHelper::evaluateGshAddressForScratchSpace(uint64_t usedScratchGpuAddress, uint64_t retrievedGshAddress) { return usedScratchGpuAddress == retrievedGshAddress; } template auto UnitTestHelper::getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType) { return coherencyType; } template inline bool UnitTestHelper::getPipeControlHdcPipelineFlush(const typename GfxFamily::PIPE_CONTROL &pipeControl) { return false; } template inline void UnitTestHelper::setPipeControlHdcPipelineFlush(typename GfxFamily::PIPE_CONTROL &pipeControl, bool hdcPipelineFlush) {} template inline void UnitTestHelper::adjustKernelDescriptorForImplicitArgs(KernelDescriptor &kernelDescriptor) { kernelDescriptor.kernelAttributes.flags.requiresImplicitArgs = true; kernelDescriptor.payloadMappings.implicitArgs.implicitArgsBuffer = 0u; } template std::vector UnitTestHelper::getProgrammedLargeGrfValues(CommandStreamReceiver &csr, LinearStream &linearStream) { return {}; } template inline bool UnitTestHelper::getWorkloadPartitionForStoreRegisterMemCmd(typename GfxFamily::MI_STORE_REGISTER_MEM &storeRegisterMem) { return false; } template GenCmdList::iterator UnitTestHelper::findCsrBaseAddressCommand(GenCmdList::iterator begin, GenCmdList::iterator end) { return find(begin, end); } template std::vector UnitTestHelper::findAllMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end) { return findAll(begin, end); } template bool UnitTestHelper::getSystolicFlagValueFromPipelineSelectCommand(const typename GfxFamily::PIPELINE_SELECT &pipelineSelectCmd) { return false; } template size_t UnitTestHelper::getAdditionalDshSize(uint32_t iddCount) { return iddCount * sizeof(typename GfxFamily::INTERFACE_DESCRIPTOR_DATA); } template void UnitTestHelper::verifyDummyBlitWa(const RootDeviceEnvironment *rootDeviceEnvironment, GenCmdList::iterator &cmdIterator) { } template GenCmdList::iterator UnitTestHelper::findWalkerTypeCmd(GenCmdList::iterator begin, GenCmdList::iterator end) { return find(begin, end); } template std::vector UnitTestHelper::findAllWalkerTypeCmds(GenCmdList::iterator begin, GenCmdList::iterator end) { return findAll(begin, end); } template uint64_t UnitTestHelper::getWalkerPartitionEstimateSpaceRequiredInCommandBuffer(bool isHeaplessEnabled, WalkerPartition::WalkerPartitionArgs &testArgs) { UNRECOVERABLE_IF(true); return 0u; } template void UnitTestHelper::getSpaceAndInitWalkerCmd(LinearStream &stream, bool heapless) { using GPGPU_WALKER = typename GfxFamily::GPGPU_WALKER; *stream.getSpaceForCmd() = GfxFamily::template getInitGpuWalker(); } template void *UnitTestHelper::getInitWalkerCmd(bool heapless) { using GPGPU_WALKER = typename GfxFamily::GPGPU_WALKER; return new GPGPU_WALKER; } } // namespace NEO