From 446f9c1964e180f44c2a51bc17fd032f55a8db8d Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Fri, 17 Jan 2025 16:26:19 +0000 Subject: [PATCH] refactor: change interfaces of walker region encoder Signed-off-by: Zbigniew Zdanowicz --- .../command_queue/hardware_interface_xehp_and_later.inl | 4 ++-- shared/source/command_container/command_encoder.h | 4 ++-- .../command_container/command_encoder_bdw_and_later.inl | 4 ++-- .../source/command_container/command_encoder_enablers.inl | 4 ++-- .../command_encoder_from_xe_hpg_core_to_xe3_core.inl | 4 ++-- .../command_container/command_encoder_xehp_and_later.inl | 4 ++-- .../command_container/walker_partition_xehp_and_later.h | 7 ++++++- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl index 9d1eefcdea..2a745eeee3 100644 --- a/opencl/source/command_queue/hardware_interface_xehp_and_later.inl +++ b/opencl/source/command_queue/hardware_interface_xehp_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -207,7 +207,7 @@ inline void HardwareInterface::programWalker( timestampPacketNode->setPacketsUsed(implicitScalingArgs.partitionCount); } } else { - EncodeDispatchKernel::setWalkerRegionSettings(walkerCmd, device, 1, workgroupSize, maxWgCountPerTile, requiredWalkOrder != 0); + EncodeDispatchKernel::setWalkerRegionSettings(walkerCmd, device, 1, workgroupSize, threadGroupCount, maxWgCountPerTile, requiredWalkOrder != 0); auto computeWalkerOnStream = commandStream.getSpaceForCmd(); *computeWalkerOnStream = walkerCmd; } diff --git a/shared/source/command_container/command_encoder.h b/shared/source/command_container/command_encoder.h index 7a879f0a17..fcb5f4d37f 100644 --- a/shared/source/command_container/command_encoder.h +++ b/shared/source/command_container/command_encoder.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -197,7 +197,7 @@ struct EncodeDispatchKernel { static void setupPostSyncForRegularEvent(WalkerType &walkerCmd, const EncodeDispatchKernelArgs &args); template - static void setWalkerRegionSettings(WalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, uint32_t workgroupSize, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder); + static void setWalkerRegionSettings(WalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, uint32_t workgroupSize, uint32_t threadGroupCount, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder); template static void setupPostSyncForInOrderExec(WalkerType &walkerCmd, const EncodeDispatchKernelArgs &args); diff --git a/shared/source/command_container/command_encoder_bdw_and_later.inl b/shared/source/command_container/command_encoder_bdw_and_later.inl index ff4be687e5..c63c9c8ae4 100644 --- a/shared/source/command_container/command_encoder_bdw_and_later.inl +++ b/shared/source/command_container/command_encoder_bdw_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -683,7 +683,7 @@ void EncodeDispatchKernel::encodeEuSchedulingPolicy(InterfaceDescriptorT template template -void EncodeDispatchKernel::setWalkerRegionSettings(WalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, uint32_t workgroupSize, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder) {} +void EncodeDispatchKernel::setWalkerRegionSettings(WalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, uint32_t workgroupSize, uint32_t threadGroupCount, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder) {} template template diff --git a/shared/source/command_container/command_encoder_enablers.inl b/shared/source/command_container/command_encoder_enablers.inl index 0d361da417..67fa4d3d08 100644 --- a/shared/source/command_container/command_encoder_enablers.inl +++ b/shared/source/command_container/command_encoder_enablers.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Intel Corporation + * Copyright (C) 2023-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -30,7 +30,7 @@ template uint64_t NEO::EncodeDispatchKernel::getScratchAddressForImmedia template void NEO::EncodeDispatchKernel::patchScratchAddressInImplicitArgs(ImplicitArgs &implicitArgs, uint64_t scratchAddress, bool scratchPtrPatchingRequired); template void NEO::EncodeDispatchKernel::forceComputeWalkerPostSyncFlushWithWrite(Family::DefaultWalkerType &walkerCmd); template void NEO::EncodeDispatchKernel::setWalkerRegionSettings(Family::DefaultWalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, - uint32_t workgroupSize, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder); + uint32_t workgroupSize, uint32_t threadGroupCount, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder); template void NEO::EncodeDispatchKernel::overrideDefaultValues(Family::DefaultWalkerType &walkerCmd, Family::DefaultWalkerType::InterfaceDescriptorType &interfaceDescriptor); template void NEO::EncodeDispatchKernel::encodeWalkerPostSyncFields(Family::DefaultWalkerType &walkerCmd, const EncodeWalkerArgs &walkerArgs); template void NEO::EncodeDispatchKernel::encodeComputeDispatchAllWalker(Family::DefaultWalkerType &walkerCmd, const EncodeWalkerArgs &walkerArgs); diff --git a/shared/source/command_container/command_encoder_from_xe_hpg_core_to_xe3_core.inl b/shared/source/command_container/command_encoder_from_xe_hpg_core_to_xe3_core.inl index 259e2e8b57..3e4e7dc1ac 100644 --- a/shared/source/command_container/command_encoder_from_xe_hpg_core_to_xe3_core.inl +++ b/shared/source/command_container/command_encoder_from_xe_hpg_core_to_xe3_core.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -90,6 +90,6 @@ void EncodeDispatchKernel::adjustTimestampPacket(WalkerType &walkerCmd, template template -void EncodeDispatchKernel::setWalkerRegionSettings(WalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, uint32_t workgroupSize, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder) {} +void EncodeDispatchKernel::setWalkerRegionSettings(WalkerType &walkerCmd, const NEO::Device &device, uint32_t partitionCount, uint32_t workgroupSize, uint32_t threadGroupCount, uint32_t maxWgCountPerTile, bool requiredDispatchWalkOrder) {} } // namespace NEO diff --git a/shared/source/command_container/command_encoder_xehp_and_later.inl b/shared/source/command_container/command_encoder_xehp_and_later.inl index 2a8f7726f6..27857deeab 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2024 Intel Corporation + * Copyright (C) 2020-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -442,7 +442,7 @@ void EncodeDispatchKernel::encode(CommandContainer &container, EncodeDis args.partitionCount = implicitScalingArgs.partitionCount; } else { args.partitionCount = 1; - EncodeDispatchKernel::setWalkerRegionSettings(walkerCmd, *args.device, args.partitionCount, workgroupSize, args.maxWgCountPerTile, isRequiredDispatchWorkGroupOrder); + EncodeDispatchKernel::setWalkerRegionSettings(walkerCmd, *args.device, args.partitionCount, workgroupSize, threadGroupCount, args.maxWgCountPerTile, isRequiredDispatchWorkGroupOrder); if (!args.makeCommandView) { auto buffer = listCmdBufferStream->getSpaceForCmd(); diff --git a/shared/source/command_container/walker_partition_xehp_and_later.h b/shared/source/command_container/walker_partition_xehp_and_later.h index 3a9e21b8cd..f3d9628143 100644 --- a/shared/source/command_container/walker_partition_xehp_and_later.h +++ b/shared/source/command_container/walker_partition_xehp_and_later.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2024 Intel Corporation + * Copyright (C) 2021-2025 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -526,10 +526,15 @@ void *programPartitionedWalker(void *&inputAddress, uint32_t &totalBytesProgramm inputWalker->setPartitionSize(Math::divideAndRoundUp(workgroupCount, args.partitionCount)); } + uint32_t threadGroupCount = inputWalker->getThreadGroupIdXDimension() * + inputWalker->getThreadGroupIdYDimension() * + inputWalker->getThreadGroupIdZDimension(); + NEO::EncodeDispatchKernel::setWalkerRegionSettings(*inputWalker, device, args.partitionCount, args.workgroupSize, + threadGroupCount, args.maxWgCountPerTile, args.isRequiredDispatchWorkGroupOrder);