From ead001360b89370921350b7cee4bfb473bc417da Mon Sep 17 00:00:00 2001 From: Zbigniew Zdanowicz Date: Wed, 6 Nov 2024 18:54:41 +0000 Subject: [PATCH] refactor: reorganize command encode classes 3/n - shift xe hpg inl file methods into specialization and generic inl files - remove gen12lp specific implementation from main inl file - remove not needed xe hpg inl file - remove not needed compression inl files - remove not used raytracing inl file Signed-off-by: Zbigniew Zdanowicz --- .../source/command_container/CMakeLists.txt | 7 ---- .../command_container/command_encoder.inl | 6 --- ...mand_encoder_raytracing_xehp_and_later.inl | 17 -------- .../command_encoder_xe_hpg_core_and_later.inl | 42 ------------------- .../command_encoder_xehp_and_later.inl | 29 +++++++++++++ .../gen12lp/command_encoder_gen12lp.cpp | 6 +++ .../command_encoder_xe2_hpg_core.cpp | 1 - .../command_encoder_xe_hpc_core.cpp | 1 - .../command_encoder_xe_hpg_core.cpp | 1 - 9 files changed, 35 insertions(+), 75 deletions(-) delete mode 100644 shared/source/command_container/command_encoder_raytracing_xehp_and_later.inl delete mode 100644 shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl diff --git a/shared/source/command_container/CMakeLists.txt b/shared/source/command_container/CMakeLists.txt index ede0f55bb1..d51ea874bb 100644 --- a/shared/source/command_container/CMakeLists.txt +++ b/shared/source/command_container/CMakeLists.txt @@ -26,7 +26,6 @@ set(NEO_CORE_COMMAND_CONTAINER if(SUPPORT_XEHP_AND_LATER) list(APPEND NEO_CORE_COMMAND_CONTAINER - ${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_raytracing_xehp_and_later.inl ${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_xehp_and_later.inl ${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_xehp_and_later.inl ${CMAKE_CURRENT_SOURCE_DIR}/walker_partition_interface.h @@ -41,12 +40,6 @@ if(SUPPORT_XE_HPG OR SUPPORT_XE_HPC) ) endif() -if(SUPPORT_DG2_AND_LATER) - list(APPEND NEO_CORE_COMMAND_CONTAINER - ${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_xe_hpg_core_and_later.inl - ) -endif() - if(SUPPORT_PVC_AND_LATER) list(APPEND NEO_CORE_COMMAND_CONTAINER ${CMAKE_CURRENT_SOURCE_DIR}/command_encoder_xe_hpc_core_and_later.inl diff --git a/shared/source/command_container/command_encoder.inl b/shared/source/command_container/command_encoder.inl index 15e7883726..f3ba561355 100644 --- a/shared/source/command_container/command_encoder.inl +++ b/shared/source/command_container/command_encoder.inl @@ -525,9 +525,6 @@ size_t EncodeSurfaceState::pushBindingTableAndSurfaceStates(IndirectHeap return ptrDiff(dstBtiTableBase, dstHeap.getCpuBase()); } -template -inline void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) {} - template void EncodeSurfaceState::setImageAuxParamsForCCS(R_SURFACE_STATE *surfaceState, Gmm *gmm) { using AUXILIARY_SURFACE_MODE = typename Family::RENDER_SURFACE_STATE::AUXILIARY_SURFACE_MODE; @@ -1132,9 +1129,6 @@ inline void EncodeStoreMemory::programStoreDataImm(LinearStream &command template void EncodeEnableRayTracing::append3dStateBtd(void *ptr3dStateBtd) {} -template -inline void EncodeWA::setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args) {} - template size_t EncodeMemoryFence::getSystemMemoryFenceSize() { return 0; diff --git a/shared/source/command_container/command_encoder_raytracing_xehp_and_later.inl b/shared/source/command_container/command_encoder_raytracing_xehp_and_later.inl deleted file mode 100644 index 03fc92cf9a..0000000000 --- a/shared/source/command_container/command_encoder_raytracing_xehp_and_later.inl +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (C) 2020-2022 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/command_container/command_encoder.h" -#include "shared/source/helpers/hw_info.h" - -namespace NEO { - -template -void EncodeEnableRayTracing::programEnableRayTracing(LinearStream &commandStream, uint64_t backBuffer) { -} - -} // namespace NEO diff --git a/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl b/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl deleted file mode 100644 index 81118385c4..0000000000 --- a/shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2021-2023 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#include "shared/source/command_container/command_encoder.h" -#include "shared/source/xe_hpg_core/hw_cmds.h" - -#include "encode_surface_state_args.h" - -namespace NEO { - -template <> -void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) { - using L1_CACHE_POLICY = typename R_SURFACE_STATE::L1_CACHE_POLICY; - auto &productHelper = args.gmmHelper->getRootDeviceEnvironment().getHelper(); - - auto cachePolicy = static_cast(productHelper.getL1CachePolicy(args.isDebuggerActive)); - if (debugManager.flags.OverrideL1CacheControlInSurfaceState.get() != -1 && - debugManager.flags.ForceAllResourcesUncached.get() == false) { - cachePolicy = static_cast(debugManager.flags.OverrideL1CacheControlInSurfaceState.get()); - } - surfaceState->setL1CachePolicyL1CacheControl(cachePolicy); -} - -template -void EncodeEnableRayTracing::programEnableRayTracing(LinearStream &commandStream, uint64_t backBuffer) { - auto cmd = GfxFamily::cmd3dStateBtd; - cmd.getBtdStateBody().setPerDssMemoryBackedBufferSize(static_cast(RayTracingHelper::getMemoryBackedFifoSizeToPatch())); - cmd.getBtdStateBody().setMemoryBackedBufferBasePointer(backBuffer); - append3dStateBtd(&cmd); - *commandStream.getSpaceForCmd() = cmd; -} - -template <> -inline void EncodeWA::setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args) { - args.unTypedDataPortCacheFlush = true; -} - -} // 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 7ae9d08af1..e25e600816 100644 --- a/shared/source/command_container/command_encoder_xehp_and_later.inl +++ b/shared/source/command_container/command_encoder_xehp_and_later.inl @@ -34,6 +34,8 @@ #include "shared/source/os_interface/product_helper.h" #include "shared/source/release_helper/release_helper.h" +#include "encode_surface_state_args.h" + #include #include @@ -1254,4 +1256,31 @@ template template void EncodeDispatchKernel::encodeAdditionalWalkerFields(const RootDeviceEnvironment &rootDeviceEnvironment, WalkerType &walkerCmd, const EncodeWalkerArgs &walkerArgs) {} +template +void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) { + using L1_CACHE_POLICY = typename R_SURFACE_STATE::L1_CACHE_POLICY; + auto &productHelper = args.gmmHelper->getRootDeviceEnvironment().getHelper(); + + auto cachePolicy = static_cast(productHelper.getL1CachePolicy(args.isDebuggerActive)); + if (debugManager.flags.OverrideL1CacheControlInSurfaceState.get() != -1 && + debugManager.flags.ForceAllResourcesUncached.get() == false) { + cachePolicy = static_cast(debugManager.flags.OverrideL1CacheControlInSurfaceState.get()); + } + surfaceState->setL1CachePolicyL1CacheControl(cachePolicy); +} + +template +void EncodeEnableRayTracing::programEnableRayTracing(LinearStream &commandStream, uint64_t backBuffer) { + auto cmd = Family::cmd3dStateBtd; + cmd.getBtdStateBody().setPerDssMemoryBackedBufferSize(static_cast(RayTracingHelper::getMemoryBackedFifoSizeToPatch())); + cmd.getBtdStateBody().setMemoryBackedBufferBasePointer(backBuffer); + append3dStateBtd(&cmd); + *commandStream.getSpaceForCmd() = cmd; +} + +template +inline void EncodeWA::setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args) { + args.unTypedDataPortCacheFlush = true; +} + } // namespace NEO diff --git a/shared/source/gen12lp/command_encoder_gen12lp.cpp b/shared/source/gen12lp/command_encoder_gen12lp.cpp index 46cefb3c38..d729880abd 100644 --- a/shared/source/gen12lp/command_encoder_gen12lp.cpp +++ b/shared/source/gen12lp/command_encoder_gen12lp.cpp @@ -116,6 +116,12 @@ void EncodeSurfaceState::appendImageCompressionParams(R_SURFACE_STATE *s GmmHelper *gmmHelper, bool imageFromBuffer, GMM_YUV_PLANE_ENUM plane) { } +template <> +inline void EncodeSurfaceState::encodeExtraCacheSettings(R_SURFACE_STATE *surfaceState, const EncodeSurfaceStateArgs &args) {} + +template <> +inline void EncodeWA::setAdditionalPipeControlFlagsForNonPipelineStateCommand(PipeControlArgs &args) {} + } // namespace NEO #include "shared/source/command_container/command_encoder_enablers.inl" diff --git a/shared/source/xe2_hpg_core/command_encoder_xe2_hpg_core.cpp b/shared/source/xe2_hpg_core/command_encoder_xe2_hpg_core.cpp index 3229fa1259..5341525a06 100644 --- a/shared/source/xe2_hpg_core/command_encoder_xe2_hpg_core.cpp +++ b/shared/source/xe2_hpg_core/command_encoder_xe2_hpg_core.cpp @@ -22,7 +22,6 @@ using Family = NEO::Xe2HpgCoreFamily; #include "shared/source/command_container/command_encoder_xe_hpc_core_and_later.inl" -#include "shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl" namespace NEO { diff --git a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp index 1c43d697ef..a7e3ffe2ec 100644 --- a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp @@ -23,7 +23,6 @@ using Family = NEO::XeHpcCoreFamily; #include "shared/source/command_container/command_encoder_heap_addressing.inl" #include "shared/source/command_container/command_encoder_xe_hpc_core_and_later.inl" -#include "shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl" namespace NEO { diff --git a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp index cfb8c43521..9d4cea2f2e 100644 --- a/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/command_encoder_xe_hpg_core.cpp @@ -22,7 +22,6 @@ using Family = NEO::XeHpgCoreFamily; #include "shared/source/command_container/command_encoder_heap_addressing.inl" -#include "shared/source/command_container/command_encoder_xe_hpg_core_and_later.inl" namespace NEO {