| 1 |
/* |
| 2 |
* Copyright (C) 2020-2025 Intel Corporation |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: MIT |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include "shared/source/command_stream/linear_stream.h" |
| 9 |
#include "shared/source/command_stream/preemption.h" |
| 10 |
#include "shared/source/direct_submission/dispatchers/render_dispatcher.h" |
| 11 |
#include "shared/source/helpers/gfx_core_helper.h" |
| 12 |
#include "shared/source/helpers/pipe_control_args.h" |
| 13 |
|
| 14 |
namespace NEO { |
| 15 |
|
| 16 |
template <typename GfxFamily> |
| 17 |
inline void RenderDispatcher<GfxFamily>::dispatchPreemption(LinearStream &cmdBuffer) { |
| 18 |
PreemptionHelper::programCmdStream<GfxFamily>(cmdBuffer, PreemptionMode::MidBatch, PreemptionMode::Disabled, nullptr); |
| 19 |
} |
| 20 |
|
| 21 |
template <typename GfxFamily> |
| 22 |
inline size_t RenderDispatcher<GfxFamily>::getSizePreemption() { |
| 23 |
size_t size = PreemptionHelper::getRequiredCmdStreamSize<GfxFamily>(PreemptionMode::MidBatch, PreemptionMode::Disabled); |
| 24 |
return size; |
| 25 |
} |
| 26 |
|
| 27 |
template <typename GfxFamily> |
| 28 |
inline void RenderDispatcher<GfxFamily>::dispatchMonitorFence(LinearStream &cmdBuffer, |
| 29 |
uint64_t gpuAddress, |
| 30 |
uint64_t immediateData, |
| 31 |
const RootDeviceEnvironment &rootDeviceEnvironment, |
| 32 |
bool partitionedWorkload, |
| 33 |
bool dcFlushRequired, |
| 34 |
bool notifyKmd) { |
| 35 |
PipeControlArgs args; |
| 36 |
args.dcFlushEnable = dcFlushRequired; |
| 37 |
args.workloadPartitionOffset = partitionedWorkload; |
| 38 |
args.notifyEnable = notifyKmd; |
| 39 |
args.textureCacheInvalidationEnable = true; |
| 40 |
|
| 41 |
MemorySynchronizationCommands<GfxFamily>::addBarrierWithPostSyncOperation( |
| 42 |
cmdBuffer, |
| 43 |
PostSyncMode::immediateData, |
| 44 |
gpuAddress, |
| 45 |
immediateData, |
| 46 |
rootDeviceEnvironment, |
| 47 |
args); |
| 48 |
} |
| 49 |
|
| 50 |
template <typename GfxFamily> |
| 51 |
inline size_t RenderDispatcher<GfxFamily>::getSizeMonitorFence(const RootDeviceEnvironment &rootDeviceEnvironment) { |
| 52 |
return MemorySynchronizationCommands<GfxFamily>::getSizeForBarrierWithPostSyncOperation(rootDeviceEnvironment, NEO::PostSyncMode::immediateData); |
| 53 |
} |
| 54 |
|
| 55 |
template <typename GfxFamily> |
| 56 |
inline void RenderDispatcher<GfxFamily>::dispatchTlbFlush(LinearStream &cmdBuffer, uint64_t address, const RootDeviceEnvironment &rootDeviceEnvironment) { |
| 57 |
PipeControlArgs args; |
| 58 |
args.tlbInvalidation = true; |
| 59 |
args.pipeControlFlushEnable = true; |
| 60 |
args.textureCacheInvalidationEnable = true; |
| 61 |
|
| 62 |
MemorySynchronizationCommands<GfxFamily>::addSingleBarrier(cmdBuffer, args); |
| 63 |
} |
| 64 |
|
| 65 |
template <typename GfxFamily> |
| 66 |
inline size_t RenderDispatcher<GfxFamily>::getSizeTlbFlush(const RootDeviceEnvironment &rootDeviceEnvironment) { |
| 67 |
return MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier(); |
| 68 |
} |
| 69 |
|
| 70 |
} // namespace NEO |