| 1 | /* |
| 2 | * Copyright (C) 2020-2024 Intel Corporation |
| 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include "shared/source/device/device.h"cxx . . $ `<file>/shared/source/device/device.h`/ |
| 9 | #include "shared/source/direct_submission/windows/wddm_direct_submission.h"cxx . . $ `<file>/shared/source/direct_submission/windows/wddm_direct_submission.h`/ |
| 10 | #include "shared/source/execution_environment/root_device_environment.h"cxx . . $ `<file>/shared/source/execution_environment/root_device_environment.h`/ |
| 11 | #include "shared/source/gmm_helper/gmm_helper.h"cxx . . $ `<file>/shared/source/gmm_helper/gmm_helper.h`/ |
| 12 | #include "shared/source/os_interface/windows/os_context_win.h"cxx . . $ `<file>/shared/source/os_interface/windows/os_context_win.h`/ |
| 13 | #include "shared/source/os_interface/windows/wddm/wddm.h"cxx . . $ `<file>/shared/source/os_interface/windows/wddm/wddm.h`/ |
| 14 | #include "shared/source/os_interface/windows/wddm/wddm_interface.h"cxx . . $ `<file>/shared/source/os_interface/windows/wddm/wddm_interface.h`/ |
| 15 | #include "shared/source/os_interface/windows/wddm/wddm_residency_logger.h"cxx . . $ `<file>/shared/source/os_interface/windows/wddm/wddm_residency_logger.h`/ |
| 16 | #include "shared/source/os_interface/windows/wddm_allocation.h"cxx . . $ `<file>/shared/source/os_interface/windows/wddm_allocation.h`/ |
| 17 | #include "shared/source/os_interface/windows/wddm_memory_operations_handler.h"cxx . . $ `<file>/shared/source/os_interface/windows/wddm_memory_operations_handler.h`/ |
| 18 | #include "shared/source/utilities/arrayref.h"cxx . . $ `<file>/shared/source/utilities/arrayref.h`/ |
| 19 | |
| 20 | namespace NEOcxx . . $ NEO/ { |
| 21 | |
| 22 | // Initialize COMMAND_BUFFER_HEADER Type PatchList Streamer Perf Tag |
| 23 | DECLARE_COMMAND_BUFFERcxx . . $ `shared/source/os_interface/windows/sharedata_wrapper.h:199:9`!(CommandBufferHeader, UMD_OCL, FALSEcxx . . $ `third_party/DirectX-Headers/include/wsl/winadapter.h:70:9`!, FALSEcxx . . $ `third_party/DirectX-Headers/include/wsl/winadapter.h:70:9`!, PERFTAG_OCL); |
| 24 | |
| 25 | template <typename GfxFamily, typename Dispatcher> |
| 26 | WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#`WddmDirectSubmission<GfxFamily, Dispatcher>`(9dacb84653224d00).(const DirectSubmissionInputParamscxx . . $ NEO/DirectSubmissionInputParams# &inputParams) |
| 27 | : DirectSubmissionHwcxx . . $ NEO/DirectSubmissionHw#<GfxFamily, Dispatcher>(inputParams) { |
| 28 | osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin. = reinterpret_cast<OsContextWincxx . . $ NEO/OsContextWin# *>(&this->osContextcxx . . $ NEO/DirectSubmissionHw#osContext.); |
| 29 | wddmcxx . . $ NEO/WddmDirectSubmission#wddm. = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getWddmcxx . . $ NEO/OsContextWin#getWddm(e26eeda1599642a2).(); |
| 30 | commandBufferHeadercxx . . $ NEO/WddmDirectSubmission#commandBufferHeader. =cxx . . $ std/unique_ptr#`operator=`(1b63e42eaa758a73). stdcxx . . $ std/::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<COMMAND_BUFFER_HEADER_RECcxx . . $ COMMAND_BUFFER_HEADER_REC#>(); |
| 31 | *(commandBufferHeadercxx . . $ NEO/WddmDirectSubmission#commandBufferHeader..getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).()) =cxx . . $ COMMAND_BUFFER_HEADER_REC#`operator=`(bb12758021f412ba). CommandBufferHeadercxx . . $ NEO/CommandBufferHeader.; |
| 32 | if (osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getPreemptionModecxx . . $ NEO/OsContext#getPreemptionMode(dfcd043db24c22c7).() != PreemptionModecxx . . $ NEO/PreemptionMode#::Disabledcxx . . $ NEO/Disabled.) { |
| 33 | commandBufferHeadercxx . . $ NEO/WddmDirectSubmission#commandBufferHeader.->cxx . . $ std/unique_ptr#`operator->`(ea7391e9eeeaf20e).NeedsMidBatchPreEmptionSupportcxx . . $ COMMAND_BUFFER_HEADER_REC#NeedsMidBatchPreEmptionSupport. = true; |
| 34 | } |
| 35 | perfLogResidencyVariadicLogcxx . . $ NEO/perfLogResidencyVariadicLog(f3188e5b9e892ea6).(wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getResidencyLoggercxx . . $ NEO/Wddm#getResidencyLogger(dc61ef9df563b96a).(), "Starting Wddm ULLS. Placement ring buffer: %d semaphore %d\n", |
| 36 | debugManagercxx . . $ NEO/debugManager..flagscxx . . $ NEO/DebugSettingsManager#flags..DirectSubmissionBufferPlacementcxx . . $ NEO/DebugVariables#DirectSubmissionBufferPlacement..getcxx . . $ NEO/DebugVarBase#get(8f5363d873dd4781).(), |
| 37 | debugManagercxx . . $ NEO/debugManager..flagscxx . . $ NEO/DebugSettingsManager#flags..DirectSubmissionSemaphorePlacementcxx . . $ NEO/DebugVariables#DirectSubmissionSemaphorePlacement..getcxx . . $ NEO/DebugVarBase#get(8f5363d873dd4781).()); |
| 38 | |
| 39 | this->completionFenceAllocationcxx . . $ NEO/DirectSubmissionHw#completionFenceAllocation. = inputParams.completionFenceAllocationcxx . . $ NEO/DirectSubmissionInputParams#completionFenceAllocation.; |
| 40 | UNRECOVERABLE_IFcxx . . $ `shared/source/helpers/debug_helpers.h:11:9`!(!this->completionFenceAllocation); |
| 41 | if (this->miMemFenceRequiredcxx . . $ NEO/DirectSubmissionHw#miMemFenceRequired.) { |
| 42 | this->gpuVaForAdditionalSynchronizationWAcxx . . $ NEO/DirectSubmissionHw#gpuVaForAdditionalSynchronizationWA. = this->completionFenceAllocationcxx . . $ NEO/DirectSubmissionHw#completionFenceAllocation.->getGpuAddress() + 8u; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | template <typename GfxFamily, typename Dispatcher> |
| 47 | WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::~cxx . . $ NEO/WddmDirectSubmission#`~WddmDirectSubmission<GfxFamily, Dispatcher>`(49f6e7a06ebc5aa8).WddmDirectSubmission() { |
| 48 | perfLogResidencyVariadicLogcxx . . $ NEO/perfLogResidencyVariadicLog(f3188e5b9e892ea6).(wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getResidencyLoggercxx . . $ NEO/Wddm#getResidencyLogger(dc61ef9df563b96a).(), "Stopping Wddm ULLS\n"); |
| 49 | if (this->ringStartcxx . . $ NEO/DirectSubmissionHw#ringStart.) { |
| 50 | this->stopRingBuffercxx . . $ NEO/DirectSubmissionHw#stopRingBuffer(efaadfb7dc14930a).(true); |
| 51 | } |
| 52 | this->deallocateResourcescxx . . $ NEO/DirectSubmissionHw#deallocateResources(49f6e7a06ebc5aa8).(); |
| 53 | wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getWddmInterfacecxx . . $ NEO/Wddm#getWddmInterface(a5f059b1ac91ee72).()->destroyMonitorFencecxx . . $ NEO/WddmInterface#destroyMonitorFence(d5011594a2f3dff8).(ringFencecxx . . $ NEO/WddmDirectSubmission#ringFence.); |
| 54 | } |
| 55 | |
| 56 | template <typename GfxFamily, typename Dispatcher> |
| 57 | inline void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::flushMonitorFencecxx . . $ NEO/WddmDirectSubmission#flushMonitorFence(49f6e7a06ebc5aa8).() { |
| 58 | auto needStart = !this->ringStartcxx . . $ NEO/DirectSubmissionHw#ringStart.; |
| 59 | |
| 60 | size_tcxx . . $ size_t# requiredMinimalSize = this->getSizeSemaphoreSectioncxx . . $ NEO/DirectSubmissionHw#getSizeSemaphoreSection(d7dbff2071f933c9).(false) + |
| 61 | Dispatcher::getSizeMonitorFence(this->rootDeviceEnvironmentcxx . . $ NEO/DirectSubmissionHw#rootDeviceEnvironment.) + |
| 62 | this->getSizeNewResourceHandlercxx . . $ NEO/DirectSubmissionHw#getSizeNewResourceHandler(f708dce9a8856c70).() + |
| 63 | this->getSizeSwitchRingBufferSectioncxx . . $ NEO/DirectSubmissionHw#getSizeSwitchRingBufferSection(f708dce9a8856c70).() + |
| 64 | this->getSizeEndcxx . . $ NEO/DirectSubmissionHw#getSizeEnd(d7dbff2071f933c9).(false); |
| 65 | this->switchRingBuffersNeededcxx . . $ NEO/DirectSubmissionHw#switchRingBuffersNeeded(54547d6e548350a3).(requiredMinimalSize, nullptr); |
| 66 | |
| 67 | auto startVA = this->ringCommandStreamcxx . . $ NEO/DirectSubmissionHw#ringCommandStream..getCurrentGpuAddressPosition(); |
| 68 | |
| 69 | this->handleNewResourcesSubmissioncxx . . $ NEO/DirectSubmissionHw#handleNewResourcesSubmission(49f6e7a06ebc5aa8).(); |
| 70 | |
| 71 | TagDatacxx . . $ NEO/TagData# currentTagData = {}; |
| 72 | this->getTagAddressValuecxx . . $ NEO/WddmDirectSubmission#getTagAddressValue(ee89d51bc922f968).(currentTagData); |
| 73 | Dispatcher::dispatchMonitorFence(this->ringCommandStreamcxx . . $ NEO/DirectSubmissionHw#ringCommandStream., currentTagData.tagAddresscxx . . $ NEO/TagData#tagAddress., currentTagData.tagValuecxx . . $ NEO/TagData#tagValue., this->rootDeviceEnvironmentcxx . . $ NEO/DirectSubmissionHw#rootDeviceEnvironment., this->useNotifyForPostSynccxx . . $ NEO/DirectSubmissionHw#useNotifyForPostSync., this->partitionedModecxx . . $ NEO/DirectSubmissionHw#partitionedMode., this->dcFlushRequiredcxx . . $ NEO/DirectSubmissionHw#dcFlushRequired.); |
| 74 | |
| 75 | this->dispatchSemaphoreSectioncxx . . $ NEO/DirectSubmissionHw#dispatchSemaphoreSection(cb2f890c2fdad230).(this->currentQueueWorkCountcxx . . $ NEO/DirectSubmissionHw#currentQueueWorkCount. + 1); |
| 76 | this->submitCommandBufferToGpucxx . . $ NEO/DirectSubmissionHw#submitCommandBufferToGpu(d6c88be27b27666f).(needStart, startVA, requiredMinimalSize, true); |
| 77 | this->currentQueueWorkCountcxx . . $ NEO/DirectSubmissionHw#currentQueueWorkCount.++; |
| 78 | |
| 79 | this->updateTagValueImplcxx . . $ NEO/WddmDirectSubmission#updateTagValueImpl(1892545c1754497d).(this->currentRingBuffercxx . . $ NEO/DirectSubmissionHw#currentRingBuffer.); |
| 80 | } |
| 81 | |
| 82 | template <typename GfxFamily, typename Dispatcher> |
| 83 | void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::ensureRingCompletioncxx . . $ NEO/WddmDirectSubmission#ensureRingCompletion(49f6e7a06ebc5aa8).() { |
| 84 | WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::handleCompletionFencecxx . . $ NEO/WddmDirectSubmission#handleCompletionFence(ca23cb3e9a779a30).(ringFencecxx . . $ NEO/WddmDirectSubmission#ringFence..lastSubmittedFencecxx . . $ NEO/MonitoredFence#lastSubmittedFence., ringFencecxx . . $ NEO/WddmDirectSubmission#ringFence.); |
| 85 | } |
| 86 | |
| 87 | template <typename GfxFamily, typename Dispatcher> |
| 88 | bool WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::allocateOsResourcescxx . . $ NEO/WddmDirectSubmission#allocateOsResources(c9857a73d68e59ba).() { |
| 89 | bool ret = wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getWddmInterfacecxx . . $ NEO/Wddm#getWddmInterface(a5f059b1ac91ee72).()->createMonitoredFenceForDirectSubmissioncxx . . $ NEO/WddmInterface#createMonitoredFenceForDirectSubmission(7296746210d74aec).(ringFencecxx . . $ NEO/WddmDirectSubmission#ringFence., *this->osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.); |
| 90 | perfLogResidencyVariadicLogcxx . . $ NEO/perfLogResidencyVariadicLog(f3188e5b9e892ea6).(wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getResidencyLoggercxx . . $ NEO/Wddm#getResidencyLogger(dc61ef9df563b96a).(), "ULLS resource allocation finished with: %d\n", ret); |
| 91 | return ret; |
| 92 | } |
| 93 | |
| 94 | template <typename GfxFamily, typename Dispatcher> |
| 95 | bool WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::submitcxx . . $ NEO/WddmDirectSubmission#submit(7dc03904b9dbe7ff).(uint64_tcxx . . $ uint64_t# gpuAddress, size_tcxx . . $ size_t# size) { |
| 96 | perfLogResidencyVariadicLogcxx . . $ NEO/perfLogResidencyVariadicLog(f3188e5b9e892ea6).(wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getResidencyLoggercxx . . $ NEO/Wddm#getResidencyLogger(dc61ef9df563b96a).(), "ULLS Submit to GPU\n"); |
| 97 | COMMAND_BUFFER_HEADERcxx . . $ COMMAND_BUFFER_HEADER# *pHeader = reinterpret_cast<COMMAND_BUFFER_HEADERcxx . . $ COMMAND_BUFFER_HEADER# *>(commandBufferHeadercxx . . $ NEO/WddmDirectSubmission#commandBufferHeader..getcxx . . $ std/unique_ptr#get(ea7391e9eeeaf20e).()); |
| 98 | pHeader->RequiresCoherencycxx . . $ COMMAND_BUFFER_HEADER_REC#RequiresCoherency. = false; |
| 99 | |
| 100 | pHeader->UmdRequestedSliceStatecxx . . $ COMMAND_BUFFER_HEADER_REC#UmdRequestedSliceState. = 0; |
| 101 | pHeader->UmdRequestedEUCountcxx . . $ COMMAND_BUFFER_HEADER_REC#UmdRequestedEUCount. = wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getRequestedEUCountcxx . . $ NEO/Wddm#getRequestedEUCount(ddd8539a2fcdd4ce).(); |
| 102 | |
| 103 | pHeader->UmdRequestedSubsliceCountcxx . . $ COMMAND_BUFFER_HEADER_REC#UmdRequestedSubsliceCount. = 0; |
| 104 | pHeader->NeedsMidBatchPreEmptionSupportcxx . . $ COMMAND_BUFFER_HEADER_REC#NeedsMidBatchPreEmptionSupport. = true; |
| 105 | |
| 106 | WddmSubmitArgumentscxx . . $ NEO/WddmSubmitArguments# submitArgs = {}; |
| 107 | submitArgs.contextHandlecxx . . $ NEO/WddmSubmitArguments#contextHandle. = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getWddmContextHandlecxx . . $ NEO/OsContextWin#getWddmContextHandle(ddd8539a2fcdd4ce).(); |
| 108 | submitArgs.hwQueueHandlecxx . . $ NEO/WddmSubmitArguments#hwQueueHandle. = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getHwQueuecxx . . $ NEO/OsContextWin#getHwQueue(99e9acc1d61906ba).().handlecxx . . $ NEO/HardwareQueue#handle.; |
| 109 | submitArgs.monitorFencecxx . . $ NEO/WddmSubmitArguments#monitorFence. = &ringFencecxx . . $ NEO/WddmDirectSubmission#ringFence.; |
| 110 | |
| 111 | return wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->submitcxx . . $ NEO/Wddm#submit(e49e344b9e263e15).(gpuAddress, size, pHeader, submitArgs); |
| 112 | } |
| 113 | |
| 114 | template <typename GfxFamily, typename Dispatcher> |
| 115 | bool WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::handleResidencycxx . . $ NEO/WddmDirectSubmission#handleResidency(c9857a73d68e59ba).() { |
| 116 | wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->waitOnPagingFenceFromCpucxx . . $ NEO/Wddm#waitOnPagingFenceFromCpu(b45ddcbc8423892c).(this->lastSubmittedThrottlecxx . . $ NEO/DirectSubmissionHw#lastSubmittedThrottle. ==cxx . . $ NEO/`operator==`(793481dfc5bdc27e). QueueThrottlecxx . . $ NEO/QueueThrottle#::LOWcxx . . $ NEO/LOW.); |
| 117 | perfLogResidencyVariadicLogcxx . . $ NEO/perfLogResidencyVariadicLog(f3188e5b9e892ea6).(wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getResidencyLoggercxx . . $ NEO/Wddm#getResidencyLogger(dc61ef9df563b96a).(), "ULLS residency wait exit\n"); |
| 118 | return true; |
| 119 | } |
| 120 | |
| 121 | template <typename GfxFamily, typename Dispatcher> |
| 122 | void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::handleStopRingBuffercxx . . $ NEO/WddmDirectSubmission#handleStopRingBuffer(49f6e7a06ebc5aa8).() { |
| 123 | if (this->disableMonitorFencecxx . . $ NEO/DirectSubmissionHw#disableMonitorFence.) { |
| 124 | updateTagValueImplcxx . . $ NEO/WddmDirectSubmission#updateTagValueImpl(1892545c1754497d).(this->currentRingBuffercxx . . $ NEO/DirectSubmissionHw#currentRingBuffer.); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | template <typename GfxFamily, typename Dispatcher> |
| 129 | void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::handleSwitchRingBufferscxx . . $ NEO/WddmDirectSubmission#handleSwitchRingBuffers(a3d659f6478503d8).(ResidencyContainercxx . . $ NEO/ResidencyContainer# *allocationsForResidency) { |
| 130 | if (this->disableMonitorFencecxx . . $ NEO/DirectSubmissionHw#disableMonitorFence.) { |
| 131 | auto lock = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getResidencyControllercxx . . $ NEO/OsContextWin#getResidencyController(ed32c15bc90210ee).().acquireLockcxx . . $ NEO/WddmResidencyController#acquireLock(56a48cfc19cd06b3).(); |
| 132 | updateTagValueImplcxx . . $ NEO/WddmDirectSubmission#updateTagValueImpl(1892545c1754497d).(this->previousRingBuffercxx . . $ NEO/DirectSubmissionHw#previousRingBuffer.); |
| 133 | updateMonitorFenceValueForResidencyListcxx . . $ NEO/WddmDirectSubmission#updateMonitorFenceValueForResidencyList(a3d659f6478503d8).(allocationsForResidency); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | template <typename GfxFamily, typename Dispatcher> |
| 138 | uint64_tcxx . . $ uint64_t# WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::updateTagValuecxx . . $ NEO/WddmDirectSubmission#updateTagValue(d7dbff2071f933c9).(bool requireMonitorFence) { |
| 139 | if (this->detectGpuHangcxx . . $ NEO/DirectSubmissionHw#detectGpuHang.) { |
| 140 | bool osHang = wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->isGpuHangDetectedcxx . . $ NEO/Wddm#isGpuHangDetected(551bb30b8f8643ac).(*osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.); |
| 141 | bool ringHang = *ringFencecxx . . $ NEO/WddmDirectSubmission#ringFence..cpuAddresscxx . . $ NEO/MonitoredFence#cpuAddress. == Wddmcxx . . $ NEO/Wddm#::gpuHangIndicationcxx . . $ NEO/Wddm#gpuHangIndication.; |
| 142 | |
| 143 | if (osHang || ringHang) { |
| 144 | wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getDeviceStatecxx . . $ NEO/Wddm#getDeviceState(c9857a73d68e59ba).(); |
| 145 | return DirectSubmissionHwcxx . . $ NEO/DirectSubmissionHw#<GfxFamily, Dispatcher>::updateTagValueFail; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | if (requireMonitorFence) { |
| 150 | return this->updateTagValueImplcxx . . $ NEO/WddmDirectSubmission#updateTagValueImpl(1892545c1754497d).(this->currentRingBuffercxx . . $ NEO/DirectSubmissionHw#currentRingBuffer.); |
| 151 | } |
| 152 | MonitoredFencecxx . . $ NEO/MonitoredFence# ¤tFence = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getResidencyControllercxx . . $ NEO/OsContextWin#getResidencyController(ed32c15bc90210ee).().getMonitoredFencecxx . . $ NEO/WddmResidencyController#getMonitoredFence(9ae7525b34612760).(); |
| 153 | return currentFence.currentFenceValuecxx . . $ NEO/MonitoredFence#currentFenceValue.; |
| 154 | } |
| 155 | |
| 156 | template <typename GfxFamily, typename Dispatcher> |
| 157 | bool WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::dispatchMonitorFenceRequiredcxx . . $ NEO/WddmDirectSubmission#dispatchMonitorFenceRequired(efaadfb7dc14930a).(bool requireMonitorFence) { |
| 158 | return !this->disableMonitorFencecxx . . $ NEO/DirectSubmissionHw#disableMonitorFence. || requireMonitorFence; |
| 159 | } |
| 160 | |
| 161 | template <typename GfxFamily, typename Dispatcher> |
| 162 | uint64_tcxx . . $ uint64_t# WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::updateTagValueImplcxx . . $ NEO/WddmDirectSubmission#updateTagValueImpl(1892545c1754497d).(uint32_tcxx . . $ uint32_t# completionBufferIndex) { |
| 163 | MonitoredFencecxx . . $ NEO/MonitoredFence# ¤tFence = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getResidencyControllercxx . . $ NEO/OsContextWin#getResidencyController(ed32c15bc90210ee).().getMonitoredFencecxx . . $ NEO/WddmResidencyController#getMonitoredFence(9ae7525b34612760).(); |
| 164 | |
| 165 | currentFence.lastSubmittedFencecxx . . $ NEO/MonitoredFence#lastSubmittedFence. = currentFence.currentFenceValuecxx . . $ NEO/MonitoredFence#currentFenceValue.; |
| 166 | currentFence.currentFenceValuecxx . . $ NEO/MonitoredFence#currentFenceValue.++; |
| 167 | this->ringBufferscxx . . $ NEO/DirectSubmissionHw#ringBuffers.[completionBufferIndex].completionFence = currentFence.lastSubmittedFencecxx . . $ NEO/MonitoredFence#lastSubmittedFence.; |
| 168 | |
| 169 | return currentFence.lastSubmittedFencecxx . . $ NEO/MonitoredFence#lastSubmittedFence.; |
| 170 | } |
| 171 | |
| 172 | template <typename GfxFamily, typename Dispatcher> |
| 173 | void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::handleCompletionFencecxx . . $ NEO/WddmDirectSubmission#handleCompletionFence(ca23cb3e9a779a30).(uint64_tcxx . . $ uint64_t# completionValue, MonitoredFencecxx . . $ NEO/MonitoredFence# &fence) { |
| 174 | wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->waitFromCpucxx . . $ NEO/Wddm#waitFromCpu(cd324a6b0fb73fcf).(completionValue, fence, false); |
| 175 | } |
| 176 | |
| 177 | template <typename GfxFamily, typename Dispatcher> |
| 178 | void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::getTagAddressValuecxx . . $ NEO/WddmDirectSubmission#getTagAddressValue(ee89d51bc922f968).(TagDatacxx . . $ NEO/TagData# &tagData) { |
| 179 | MonitoredFencecxx . . $ NEO/MonitoredFence# ¤tFence = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getResidencyControllercxx . . $ NEO/OsContextWin#getResidencyController(ed32c15bc90210ee).().getMonitoredFencecxx . . $ NEO/WddmResidencyController#getMonitoredFence(9ae7525b34612760).(); |
| 180 | auto gmmHelper = wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getRootDeviceEnvironmentcxx . . $ NEO/Wddm#getRootDeviceEnvironment(2732b17aa1502521).().getGmmHelpercxx . . $ NEO/RootDeviceEnvironment#getGmmHelper(9738faa4e4bf1fcc).(); |
| 181 | |
| 182 | tagData.tagAddresscxx . . $ NEO/TagData#tagAddress. = gmmHelper->canonizecxx . . $ NEO/GmmHelper#canonize(611be0c07d97f8b8).(currentFence.gpuAddresscxx . . $ NEO/MonitoredFence#gpuAddress.); |
| 183 | tagData.tagValuecxx . . $ NEO/TagData#tagValue. = currentFence.currentFenceValuecxx . . $ NEO/MonitoredFence#currentFenceValue.; |
| 184 | } |
| 185 | |
| 186 | template <typename GfxFamily, typename Dispatcher> |
| 187 | inline bool WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::isCompletedcxx . . $ NEO/WddmDirectSubmission#isCompleted(dfa6e707f7696010).(uint32_tcxx . . $ uint32_t# ringBufferIndex) { |
| 188 | MonitoredFencecxx . . $ NEO/MonitoredFence# ¤tFence = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getResidencyControllercxx . . $ NEO/OsContextWin#getResidencyController(ed32c15bc90210ee).().getMonitoredFencecxx . . $ NEO/WddmResidencyController#getMonitoredFence(9ae7525b34612760).(); |
| 189 | auto lastSubmittedFence = this->ringBufferscxx . . $ NEO/DirectSubmissionHw#ringBuffers.[ringBufferIndex].completionFence; |
| 190 | if (lastSubmittedFence > *currentFence.cpuAddresscxx . . $ NEO/MonitoredFence#cpuAddress.) { |
| 191 | return false; |
| 192 | } |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | template <typename GfxFamily, typename Dispatcher> |
| 197 | void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::updateMonitorFenceValueForResidencyListcxx . . $ NEO/WddmDirectSubmission#updateMonitorFenceValueForResidencyList(a3d659f6478503d8).(ResidencyContainercxx . . $ NEO/ResidencyContainer# *allocationsForResidency) { |
| 198 | if (allocationsForResidency == nullptr) { |
| 199 | return; |
| 200 | } |
| 201 | const auto currentFence = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getResidencyControllercxx . . $ NEO/OsContextWin#getResidencyController(ed32c15bc90210ee).().getMonitoredFencecxx . . $ NEO/WddmResidencyController#getMonitoredFence(9ae7525b34612760).().currentFenceValuecxx . . $ NEO/MonitoredFence#currentFenceValue.; |
| 202 | auto contextId = osContextWincxx . . $ NEO/WddmDirectSubmission#osContextWin.->getContextIdcxx . . $ NEO/OsContext#getContextId(ddd8539a2fcdd4ce).(); |
| 203 | for (uint32_tcxx . . $ uint32_t# i = 0; i < allocationsForResidency->sizecxx . . $ std/vector#size(c9b1e749b64d5edc).(); i++) { |
| 204 | WddmAllocationcxx . . $ NEO/WddmAllocation# *allocation = static_cast<WddmAllocationcxx . . $ NEO/WddmAllocation# *>((*allocationsForResidency)[cxx . . $ std/vector#`operator[]`(81207c53da4b73ce).i]); |
| 205 | // Update fence value not to early destroy / evict allocation |
| 206 | allocation->updateCompletionDataForAllocationAndFragmentscxx . . $ NEO/GraphicsAllocation#updateCompletionDataForAllocationAndFragments(34e6b58f48c1be0a).(currentFence, contextId); |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * @brief Unblocks pipeline by waiting for paging fence value and signals semaphore with latest value. |
| 212 | * Signals semaphore with latest fence value instead of passed one to unblock immediately subsequent semaphores. |
| 213 | * |
| 214 | * @param[in] pagingFenceValue paging fence submitted from user thread to wait for. |
| 215 | */ |
| 216 | template <typename GfxFamily, typename Dispatcher> |
| 217 | inline void WddmDirectSubmissioncxx . . $ NEO/WddmDirectSubmission#<GfxFamily, Dispatcher>::unblockPagingFenceSemaphorecxx . . $ NEO/WddmDirectSubmission#unblockPagingFenceSemaphore(2c44cd906ae4e829).(uint64_tcxx . . $ uint64_t# pagingFenceValue) { |
| 218 | this->wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->waitOnPagingFenceFromCpucxx . . $ NEO/Wddm#waitOnPagingFenceFromCpu(62a5225ebb2f873).(pagingFenceValue, true); |
| 219 | this->semaphoreDatacxx . . $ NEO/DirectSubmissionHw#semaphoreData.->pagingFenceCounter = static_cast<uint32_tcxx . . $ uint32_t#>(*this->wddmcxx . . $ NEO/WddmDirectSubmission#wddm.->getPagingFenceAddresscxx . . $ NEO/Wddm#getPagingFenceAddress(e33fd0f87a6aeee1).()); |
| 220 | } |
| 221 | |
| 222 | } // namespace NEO |