refactor: dedicated prefetch cmd list method

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2025-06-09 11:38:56 +00:00
committed by Compute-Runtime-Automation
parent 2174389c4e
commit 17a15a3d9d
3 changed files with 14 additions and 5 deletions

View File

@@ -419,6 +419,8 @@ struct CommandListCoreFamily : public CommandListImp {
virtual void addKernelIndirectDataMemoryPrefetchPadding(NEO::LinearStream &cmdStream, const Kernel &kernel, uint64_t cmdId) {}
virtual uint64_t getPrefetchCmdId() const { return std::numeric_limits<uint64_t>::max(); }
virtual uint32_t getIohSizeForPrefetch(const Kernel &kernel, uint32_t reserveExtraSpace) const;
virtual void ensureCmdBufferSpaceForPrefetch() {}
bool kernelMemoryPrefetchEnabled() const { return NEO::debugManager.flags.EnableMemoryPrefetch.get() == 1; }
NEO::InOrderPatchCommandsContainer<GfxFamily> inOrderPatchCmds;

View File

@@ -396,7 +396,7 @@ void CommandListCoreFamily<gfxCoreFamily>::programL3(bool isSLMused) {}
template <GFXCORE_FAMILY gfxCoreFamily>
void CommandListCoreFamily<gfxCoreFamily>::prefetchKernelMemory(NEO::LinearStream &cmdStream, const Kernel &kernel, const NEO::GraphicsAllocation &ioh, size_t iohOffset, CommandToPatchContainer *outListCommands, uint64_t cmdId) {
if (NEO::debugManager.flags.EnableMemoryPrefetch.get() != 1) {
if (!kernelMemoryPrefetchEnabled()) {
return;
}
@@ -447,6 +447,7 @@ ze_result_t CommandListCoreFamily<gfxCoreFamily>::appendLaunchKernel(ze_kernel_h
auto kernel = Kernel::fromHandle(kernelHandle);
auto ioh = commandContainer.getHeapWithRequiredSizeAndAlignment(NEO::IndirectHeapType::indirectObject, getIohSizeForPrefetch(*kernel, launchParams.reserveExtraPayloadSpace), GfxFamily::indirectDataAlignment);
ensureCmdBufferSpaceForPrefetch();
prefetchKernelMemory(*commandContainer.getCommandStream(), *kernel, *ioh->getGraphicsAllocation(), ioh->getUsed(), launchParams.outListCommands, getPrefetchCmdId());
ze_result_t ret = addEventsToCmdList(numWaitEvents, phWaitEvents, launchParams.outListCommands, launchParams.relaxedOrderingDispatch, true, true, launchParams.omitAddingWaitEventsResidency, false);