diff --git a/shared/source/command_container/CMakeLists.txt b/shared/source/command_container/CMakeLists.txt index 98b849c872..524d47ad54 100644 --- a/shared/source/command_container/CMakeLists.txt +++ b/shared/source/command_container/CMakeLists.txt @@ -19,6 +19,7 @@ set(NEO_CORE_COMMAND_CONTAINER ${CMAKE_CURRENT_SOURCE_DIR}/encode_surface_state.h ${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling.cpp ${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling.h + ${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_before_xe_hp.inl ${CMAKE_CURRENT_SOURCE_DIR}/definitions/encode_surface_state_args_base.h ${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}encode_surface_state.inl ${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}encode_surface_state_args.h diff --git a/shared/source/command_container/implicit_scaling_before_xe_hp.inl b/shared/source/command_container/implicit_scaling_before_xe_hp.inl new file mode 100644 index 0000000000..9375cb9e27 --- /dev/null +++ b/shared/source/command_container/implicit_scaling_before_xe_hp.inl @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2023 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#include "shared/source/command_container/implicit_scaling.h" +#include "shared/source/helpers/gfx_core_helper.h" + +namespace NEO { + +template +template +size_t ImplicitScalingDispatch::getSize(bool apiSelfCleanup, bool preferStaticPartitioning, const DeviceBitfield &devices, const Vec3 &groupStart, const Vec3 &groupCount) { + return 0; +} + +template +template +void ImplicitScalingDispatch::dispatchCommands(LinearStream &commandStream, WalkerType &walkerCmd, void **outWalkerPtr, const DeviceBitfield &devices, NEO::RequiredPartitionDim requiredPartitionDim, + uint32_t &partitionCount, bool useSecondaryBatchBuffer, bool apiSelfCleanup, bool dcFlush, bool forceExecutionOnSingleTile, uint64_t workPartitionAllocationGpuVa, + const HardwareInfo &hwInfo) { +} + +template +bool &ImplicitScalingDispatch::getPipeControlStallRequired() { + return ImplicitScalingDispatch::pipeControlStallRequired; +} + +template +size_t ImplicitScalingDispatch::getBarrierSize(const RootDeviceEnvironment &rootDeviceEnvironment, bool apiSelfCleanup, bool usePostSync) { + return 0; +} + +template +void ImplicitScalingDispatch::dispatchBarrierCommands(LinearStream &commandStream, const DeviceBitfield &devices, PipeControlArgs &flushArgs, const RootDeviceEnvironment &rootDeviceEnvironment, + uint64_t gpuAddress, uint64_t immediateData, bool apiSelfCleanup, bool useSecondaryBatchBuffer) { +} + +template +inline size_t ImplicitScalingDispatch::getRegisterConfigurationSize() { + return 0; +} + +template +inline void ImplicitScalingDispatch::dispatchRegisterConfiguration(LinearStream &commandStream, uint64_t workPartitionSurfaceAddress, uint32_t addressOffset) { +} + +template +inline size_t ImplicitScalingDispatch::getOffsetRegisterSize() { + return 0; +} + +template +inline void ImplicitScalingDispatch::dispatchOffsetRegister(LinearStream &commandStream, uint32_t addressOffset) { +} + +template +inline uint32_t ImplicitScalingDispatch::getImmediateWritePostSyncOffset() { + return sizeof(uint64_t); +} + +template +inline uint32_t ImplicitScalingDispatch::getTimeStampPostSyncOffset() { + return static_cast(GfxCoreHelperHw::getSingleTimestampPacketSizeHw()); +} + +template +inline bool ImplicitScalingDispatch::platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment) { + return false; +} + +template <> +bool ImplicitScalingDispatch::pipeControlStallRequired = true; + +template struct ImplicitScalingDispatch; +template void ImplicitScalingDispatch::dispatchCommands(LinearStream &commandStream, Family::DefaultWalkerType &walkerCmd, void **outWalkerPtr, const DeviceBitfield &devices, NEO::RequiredPartitionDim requiredPartitionDim, uint32_t &partitionCount, bool useSecondaryBatchBuffer, bool apiSelfCleanup, bool dcFlush, bool forceExecutionOnSingleTile, uint64_t workPartitionAllocationGpuVa, const HardwareInfo &hwInfo); +template size_t ImplicitScalingDispatch::getSize(bool apiSelfCleanup, bool preferStaticPartitioning, const DeviceBitfield &devices, const Vec3 &groupStart, const Vec3 &groupCount); + +} // namespace NEO diff --git a/shared/source/gen11/command_encoder_gen11.cpp b/shared/source/gen11/command_encoder_gen11.cpp index 1743472a65..5e60d8b102 100644 --- a/shared/source/gen11/command_encoder_gen11.cpp +++ b/shared/source/gen11/command_encoder_gen11.cpp @@ -81,3 +81,5 @@ template struct EncodeL3State; template void EncodeDispatchKernel::programBarrierEnable(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo); template void InOrderPatchCommandHelpers::PatchCmd::patchComputeWalker(uint64_t appendCounterValue); } // namespace NEO + +#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl" \ No newline at end of file diff --git a/shared/source/gen12lp/command_encoder_gen12lp.cpp b/shared/source/gen12lp/command_encoder_gen12lp.cpp index dcdd2e6d42..456d6c5f9e 100644 --- a/shared/source/gen12lp/command_encoder_gen12lp.cpp +++ b/shared/source/gen12lp/command_encoder_gen12lp.cpp @@ -121,3 +121,5 @@ template struct EncodeL3State; template void EncodeDispatchKernel::programBarrierEnable(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo); template void InOrderPatchCommandHelpers::PatchCmd::patchComputeWalker(uint64_t appendCounterValue); } // namespace NEO + +#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl" \ No newline at end of file diff --git a/shared/source/gen8/command_encoder_gen8.cpp b/shared/source/gen8/command_encoder_gen8.cpp index f0820e2229..3fb59b776b 100644 --- a/shared/source/gen8/command_encoder_gen8.cpp +++ b/shared/source/gen8/command_encoder_gen8.cpp @@ -65,3 +65,5 @@ template struct EncodeL3State; template void EncodeDispatchKernel::programBarrierEnable(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo); template void InOrderPatchCommandHelpers::PatchCmd::patchComputeWalker(uint64_t appendCounterValue); } // namespace NEO + +#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl" \ No newline at end of file diff --git a/shared/source/gen9/command_encoder_gen9.cpp b/shared/source/gen9/command_encoder_gen9.cpp index 9718ee11a0..0547a04688 100644 --- a/shared/source/gen9/command_encoder_gen9.cpp +++ b/shared/source/gen9/command_encoder_gen9.cpp @@ -66,3 +66,5 @@ template struct EncodeL3State; template void EncodeDispatchKernel::programBarrierEnable(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo); template void InOrderPatchCommandHelpers::PatchCmd::patchComputeWalker(uint64_t appendCounterValue); } // namespace NEO + +#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl" diff --git a/shared/test/unit_test/command_container/command_encoder_tests.cpp b/shared/test/unit_test/command_container/command_encoder_tests.cpp index 9dca3aaacf..3e8b64606e 100644 --- a/shared/test/unit_test/command_container/command_encoder_tests.cpp +++ b/shared/test/unit_test/command_container/command_encoder_tests.cpp @@ -7,12 +7,14 @@ #include "shared/source/command_container/command_encoder.h" #include "shared/source/command_container/encode_surface_state.h" +#include "shared/source/command_container/implicit_scaling.h" #include "shared/source/command_stream/linear_stream.h" #include "shared/source/gmm_helper/gmm_helper.h" #include "shared/source/gmm_helper/gmm_lib.h" #include "shared/source/helpers/definitions/command_encoder_args.h" #include "shared/source/helpers/gfx_core_helper.h" #include "shared/source/helpers/in_order_cmd_helpers.h" +#include "shared/source/helpers/pipe_control_args.h" #include "shared/source/memory_manager/graphics_allocation.h" #include "shared/source/memory_manager/memory_manager.h" #include "shared/source/os_interface/product_helper.h" @@ -475,4 +477,51 @@ HWTEST2_F(CommandEncoderTests, whenForcingLowQualityFilteringAndAppendSamplerSta EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter()); productHelper.adjustSamplerState(&state, *defaultHwInfo); EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter()); +} + +HWTEST2_F(CommandEncoderTests, whenAskingForImplicitScalingValuesThenAlwaysReturnStubs, IsAtMostGen12lp) { + using WalkerType = typename FamilyType::DefaultWalkerType; + + MockExecutionEnvironment executionEnvironment{}; + auto rootExecEnv = executionEnvironment.rootDeviceEnvironments[0].get(); + + uint8_t buffer[128] = {}; + LinearStream linearStream(buffer, sizeof(buffer)); + + WalkerType walkerCmd = {}; + + DeviceBitfield deviceBitField = 1; + uint32_t partitionCount = 1; + + Vec3 vec3 = {1, 1, 1}; + + EXPECT_EQ(0u, ImplicitScalingDispatch::template getSize(false, false, deviceBitField, vec3, vec3)); + + void *ptr = nullptr; + ImplicitScalingDispatch::dispatchCommands(linearStream, walkerCmd, &ptr, deviceBitField, RequiredPartitionDim::x, partitionCount, false, false, false, false, 0, *defaultHwInfo); + EXPECT_EQ(0u, linearStream.getUsed()); + + EXPECT_TRUE(ImplicitScalingDispatch::getPipeControlStallRequired()); + + EXPECT_EQ(0u, ImplicitScalingDispatch::getBarrierSize(*rootExecEnv, false, false)); + + PipeControlArgs pcArgs = {}; + ImplicitScalingDispatch::dispatchBarrierCommands(linearStream, deviceBitField, pcArgs, *rootExecEnv, 0, 0, false, false); + EXPECT_EQ(0u, linearStream.getUsed()); + + EXPECT_EQ(0u, ImplicitScalingDispatch::getRegisterConfigurationSize()); + + ImplicitScalingDispatch::dispatchRegisterConfiguration(linearStream, 0, 0); + EXPECT_EQ(0u, linearStream.getUsed()); + + EXPECT_EQ(0u, ImplicitScalingDispatch::getOffsetRegisterSize()); + + ImplicitScalingDispatch::dispatchOffsetRegister(linearStream, 0); + EXPECT_EQ(0u, linearStream.getUsed()); + + EXPECT_EQ(static_cast(sizeof(uint64_t)), ImplicitScalingDispatch::getImmediateWritePostSyncOffset()); + + EXPECT_EQ(static_cast(GfxCoreHelperHw::getSingleTimestampPacketSizeHw()), ImplicitScalingDispatch::getTimeStampPostSyncOffset()); + + EXPECT_FALSE(ImplicitScalingDispatch::platformSupportsImplicitScaling(*rootExecEnv)); } \ No newline at end of file