/* * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * */ #include "shared/source/command_stream/linear_stream.h" #include "shared/source/command_stream/preemption.h" #include "shared/source/device/device.h" #include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/aligned_memory.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/preamble.h" #include "shared/source/helpers/register_offsets.h" #include "reg_configs_common.h" #include namespace NEO { template std::vector PreambleHelper::getSupportedThreadArbitrationPolicies() { return {}; } template void PreambleHelper::programGenSpecificPreambleWorkArounds(LinearStream *pCommandStream, const HardwareInfo &hwInfo) { } template void PreambleHelper::programSemaphoreDelay(LinearStream *pCommandStream) { if (DebugManager.flags.ForceSemaphoreDelayBetweenWaits.get() > -1) { uint32_t valueOfNewSemaphoreDelay = DebugManager.flags.ForceSemaphoreDelayBetweenWaits.get(); LriHelper::program(pCommandStream, SEMA_WAIT_POLL, valueOfNewSemaphoreDelay, true); }; } template size_t PreambleHelper::getSemaphoreDelayCommandSize() { return sizeof(MI_LOAD_REGISTER_IMM); } template size_t PreambleHelper::getAdditionalCommandsSize(const Device &device) { size_t totalSize = PreemptionHelper::getRequiredPreambleSize(device); bool debuggingEnabled = device.getDebugger() != nullptr; totalSize += getKernelDebuggingCommandsSize(debuggingEnabled); return totalSize; } template size_t PreambleHelper::getCmdSizeForPipelineSelect(const RootDeviceEnvironment &rootDeviceEnvironment) { size_t size = 0; using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT; size += sizeof(PIPELINE_SELECT); if (MemorySynchronizationCommands::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) { size += sizeof(PIPE_CONTROL); } return size; } template void PreambleHelper::programPreamble(LinearStream *pCommandStream, Device &device, uint32_t l3Config, GraphicsAllocation *preemptionCsr) { programL3(pCommandStream, l3Config); programPreemption(pCommandStream, device, preemptionCsr); programGenSpecificPreambleWorkArounds(pCommandStream, device.getHardwareInfo()); programSemaphoreDelay(pCommandStream); } template void PreambleHelper::programPreemption(LinearStream *pCommandStream, Device &device, GraphicsAllocation *preemptionCsr) { PreemptionHelper::programCsrBaseAddress(*pCommandStream, device, preemptionCsr); } template size_t PreambleHelper::getKernelDebuggingCommandsSize(bool debuggingActive) { if (debuggingActive) { return 2 * sizeof(MI_LOAD_REGISTER_IMM); } return 0; } template void PreambleHelper::appendProgramVFEState(const RootDeviceEnvironment &rootDeviceEnvironment, const StreamProperties &streamProperties, void *cmd) {} template uint32_t PreambleHelper::getScratchSizeValueToProgramMediaVfeState(uint32_t scratchSize) { scratchSize >>= static_cast(MemoryConstants::kiloByteShiftSize); uint32_t valueToProgram = 0; while (scratchSize >>= 1) { valueToProgram++; } return valueToProgram; } template bool PreambleHelper::isSystolicModeConfigurable(const RootDeviceEnvironment &rootDeviceEnvironment) { const auto &productHelper = rootDeviceEnvironment.getHelper(); auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); return productHelper.isSystolicModeConfigurable(hwInfo); } } // namespace NEO