| 1 | /* |
| 2 | * Copyright (C) 2023 Intel Corporation |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "shared/source/command_stream/linear_stream.h"cxx . . $ `<file>/shared/source/command_stream/linear_stream.h`/ |
| 9 | #include "shared/source/command_stream/stream_properties.h"cxx . . $ `<file>/shared/source/command_stream/stream_properties.h`/ |
| 10 | #include "shared/source/debug_settings/debug_settings_manager.h"cxx . . $ `<file>/shared/source/debug_settings/debug_settings_manager.h`/ |
| 11 | #include "shared/source/helpers/gfx_core_helper.h"cxx . . $ `<file>/shared/source/helpers/gfx_core_helper.h`/ |
| 12 | #include "shared/source/helpers/pipe_control_args.h"cxx . . $ `<file>/shared/source/helpers/pipe_control_args.h`/ |
| 13 | #include "shared/source/helpers/pipeline_select_args.h"cxx . . $ `<file>/shared/source/helpers/pipeline_select_args.h`/ |
| 14 | #include "shared/source/helpers/pipeline_select_helper.h"cxx . . $ `<file>/shared/source/helpers/pipeline_select_helper.h`/ |
| 15 | #include "shared/source/helpers/preamble.h"cxx . . $ `<file>/shared/source/helpers/preamble.h`/ |
| 16 | |
| 17 | namespace NEOcxx . . $ NEO/ { |
| 18 | |
| 19 | template <typename Family> |
| 20 | void PreambleHelpercxx . . $ NEO/PreambleHelper#<Family>::programPipelineSelectcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).(LinearStreamcxx . . $ NEO/LinearStream# *pCommandStream, |
| 21 | const PipelineSelectArgscxx . . $ NEO/PipelineSelectArgs# &pipelineSelectArgs, |
| 22 | const RootDeviceEnvironmentcxx . . $ NEO/RootDeviceEnvironment# &rootDeviceEnvironment) { |
| 23 | |
| 24 | using PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).PIPELINE_SELECT# = typename Family::PIPELINE_SELECT; |
| 25 | |
| 26 | PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).PIPELINE_SELECT# cmd = Family::cmdInitPipelineSelect; |
| 27 | |
| 28 | if (MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) { |
| 29 | PipeControlArgscxx . . $ NEO/PipeControlArgs# argscxx . . $ NEO/PipeControlArgs#PipeControlArgs(ced63f7c635d850d).; |
| 30 | args.csStallOnlycxx . . $ NEO/PipeControlArgs#csStallOnly. = true; |
| 31 | args.renderTargetCacheFlushEnablecxx . . $ NEO/PipeControlArgs#renderTargetCacheFlushEnable. = true; |
| 32 | MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::addSingleBarrier(*pCommandStream, args); |
| 33 | } |
| 34 | |
| 35 | if (debugManagercxx . . $ NEO/debugManager..flagscxx . . $ NEO/DebugSettingsManager#flags..CleanStateInPreamblecxx . . $ NEO/DebugVariables#CleanStateInPreamble..getcxx . . $ NEO/DebugVarBase#get(8f5363d873dd4781).()) { |
| 36 | auto cmdBuffer = pCommandStream->getSpaceForCmdcxx . . $ NEO/LinearStream#getSpaceForCmd(155dc7f103cdb9db).<PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).PIPELINE_SELECT#>(); |
| 37 | cmd.setPipelineSelection(PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).PIPELINE_SELECT#::PIPELINE_SELECTION_3D); |
| 38 | *cmdBuffer = cmd; |
| 39 | |
| 40 | PipeControlArgscxx . . $ NEO/PipeControlArgs# args = {}; |
| 41 | args.stateCacheInvalidationEnablecxx . . $ NEO/PipeControlArgs#stateCacheInvalidationEnable. = true; |
| 42 | MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::addSingleBarrier(*pCommandStream, args); |
| 43 | } |
| 44 | |
| 45 | auto cmdBuffer = pCommandStream->getSpaceForCmdcxx . . $ NEO/LinearStream#getSpaceForCmd(155dc7f103cdb9db).<PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).PIPELINE_SELECT#>(); |
| 46 | |
| 47 | auto mask = pipelineSelectEnablePipelineSelectMaskBitscxx . . $ NEO/pipelineSelectEnablePipelineSelectMaskBits.; |
| 48 | |
| 49 | cmd.setPipelineSelection(PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#programPipelineSelect(c6a1db16c909f365).PIPELINE_SELECT#::PIPELINE_SELECTION_GPGPU); |
| 50 | if constexpr (Family::isUsingMediaSamplerDopClockGate) { |
| 51 | mask |= pipelineSelectMediaSamplerDopClockGateMaskBitscxx . . $ NEO/pipelineSelectMediaSamplerDopClockGateMaskBits.; |
| 52 | cmd.setMediaSamplerDopClockGateEnable(!pipelineSelectArgs.mediaSamplerRequiredcxx . . $ NEO/PipelineSelectArgs#mediaSamplerRequired.); |
| 53 | } |
| 54 | |
| 55 | bool systolicSupport = pipelineSelectArgs.systolicPipelineSelectSupportcxx . . $ NEO/PipelineSelectArgs#systolicPipelineSelectSupport.; |
| 56 | bool systolicValue = pipelineSelectArgs.systolicPipelineSelectModecxx . . $ NEO/PipelineSelectArgs#systolicPipelineSelectMode.; |
| 57 | int32_tcxx . . $ int32_t# overrideSystolic = debugManagercxx . . $ NEO/debugManager..flagscxx . . $ NEO/DebugSettingsManager#flags..OverrideSystolicPipelineSelectcxx . . $ NEO/DebugVariables#OverrideSystolicPipelineSelect..getcxx . . $ NEO/DebugVarBase#get(8f5363d873dd4781).(); |
| 58 | |
| 59 | if (overrideSystolic != -1) { |
| 60 | systolicSupport = true; |
| 61 | systolicValue = !!overrideSystolic; |
| 62 | } |
| 63 | |
| 64 | if (systolicSupport) { |
| 65 | cmd.setSystolicModeEnable(systolicValue); |
| 66 | mask |= pipelineSelectSystolicModeEnableMaskBitscxx . . $ NEO/pipelineSelectSystolicModeEnableMaskBits.; |
| 67 | } |
| 68 | |
| 69 | cmd.setMaskBits(mask); |
| 70 | |
| 71 | *cmdBuffer = cmd; |
| 72 | |
| 73 | if (debugManagercxx . . $ NEO/debugManager..flagscxx . . $ NEO/DebugSettingsManager#flags..CleanStateInPreamblecxx . . $ NEO/DebugVariables#CleanStateInPreamble..getcxx . . $ NEO/DebugVarBase#get(8f5363d873dd4781).()) { |
| 74 | PipeControlArgscxx . . $ NEO/PipeControlArgs# args = {}; |
| 75 | args.stateCacheInvalidationEnablecxx . . $ NEO/PipeControlArgs#stateCacheInvalidationEnable. = true; |
| 76 | MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::addSingleBarrier(*pCommandStream, args); |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | template <typename Family> |
| 81 | size_t PreambleHelpercxx . . $ NEO/PreambleHelper#<Family>::getCmdSizeForPipelineSelectcxx . . $ NEO/PreambleHelper#getCmdSizeForPipelineSelect(c458e1e3bc882193).(const RootDeviceEnvironmentcxx . . $ NEO/RootDeviceEnvironment# &rootDeviceEnvironment) { |
| 82 | size_t size = 0; |
| 83 | using PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#getCmdSizeForPipelineSelect(c458e1e3bc882193).PIPELINE_SELECT# = typename Family::PIPELINE_SELECT; |
| 84 | size += sizeof(PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#getCmdSizeForPipelineSelect(c458e1e3bc882193).PIPELINE_SELECT#); |
| 85 | if (MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::isBarrierPriorToPipelineSelectWaRequired(rootDeviceEnvironment)) { |
| 86 | size += MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::getSizeForSingleBarrier(false); |
| 87 | } |
| 88 | if (debugManagercxx . . $ NEO/debugManager..flagscxx . . $ NEO/DebugSettingsManager#flags..CleanStateInPreamblecxx . . $ NEO/DebugVariables#CleanStateInPreamble..getcxx . . $ NEO/DebugVarBase#get(8f5363d873dd4781).()) { |
| 89 | size += sizeof(PIPELINE_SELECTcxx . . $ NEO/PreambleHelper#getCmdSizeForPipelineSelect(c458e1e3bc882193).PIPELINE_SELECT#); |
| 90 | size += 2 * MemorySynchronizationCommandscxx . . $ NEO/MemorySynchronizationCommands#<Family>::getSizeForSingleBarrier(false); |
| 91 | } |
| 92 | return size; |
| 93 | } |
| 94 | |
| 95 | } // namespace NEO |