Skip to content

Commit 364f2e9

Browse files
refactor: add ImplicitScaling stubs
Related-To: NEO-8210 Signed-off-by: Dunajski, Bartosz <[email protected]>
1 parent 611b847 commit 364f2e9

File tree

7 files changed

+139
-0
lines changed

7 files changed

+139
-0
lines changed

shared/source/command_container/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ set(NEO_CORE_COMMAND_CONTAINER
1919
${CMAKE_CURRENT_SOURCE_DIR}/encode_surface_state.h
2020
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling.cpp
2121
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling.h
22+
${CMAKE_CURRENT_SOURCE_DIR}/implicit_scaling_before_xe_hp.inl
2223
${CMAKE_CURRENT_SOURCE_DIR}/definitions/encode_surface_state_args_base.h
2324
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}encode_surface_state.inl
2425
${CMAKE_CURRENT_SOURCE_DIR}/definitions${BRANCH_DIR_SUFFIX}encode_surface_state_args.h
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
* Copyright (C) 2023 Intel Corporation
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
*/
7+
8+
#include "shared/source/command_container/implicit_scaling.h"
9+
#include "shared/source/helpers/gfx_core_helper.h"
10+
11+
namespace NEO {
12+
13+
template <typename GfxFamily>
14+
template <typename WalkerType>
15+
size_t ImplicitScalingDispatch<GfxFamily>::getSize(bool apiSelfCleanup, bool preferStaticPartitioning, const DeviceBitfield &devices, const Vec3<size_t> &groupStart, const Vec3<size_t> &groupCount) {
16+
return 0;
17+
}
18+
19+
template <typename GfxFamily>
20+
template <typename WalkerType>
21+
void ImplicitScalingDispatch<GfxFamily>::dispatchCommands(LinearStream &commandStream, WalkerType &walkerCmd, void **outWalkerPtr, const DeviceBitfield &devices, NEO::RequiredPartitionDim requiredPartitionDim,
22+
uint32_t &partitionCount, bool useSecondaryBatchBuffer, bool apiSelfCleanup, bool dcFlush, bool forceExecutionOnSingleTile, uint64_t workPartitionAllocationGpuVa,
23+
const HardwareInfo &hwInfo) {
24+
}
25+
26+
template <typename GfxFamily>
27+
bool &ImplicitScalingDispatch<GfxFamily>::getPipeControlStallRequired() {
28+
return ImplicitScalingDispatch<GfxFamily>::pipeControlStallRequired;
29+
}
30+
31+
template <typename GfxFamily>
32+
size_t ImplicitScalingDispatch<GfxFamily>::getBarrierSize(const RootDeviceEnvironment &rootDeviceEnvironment, bool apiSelfCleanup, bool usePostSync) {
33+
return 0;
34+
}
35+
36+
template <typename GfxFamily>
37+
void ImplicitScalingDispatch<GfxFamily>::dispatchBarrierCommands(LinearStream &commandStream, const DeviceBitfield &devices, PipeControlArgs &flushArgs, const RootDeviceEnvironment &rootDeviceEnvironment,
38+
uint64_t gpuAddress, uint64_t immediateData, bool apiSelfCleanup, bool useSecondaryBatchBuffer) {
39+
}
40+
41+
template <typename GfxFamily>
42+
inline size_t ImplicitScalingDispatch<GfxFamily>::getRegisterConfigurationSize() {
43+
return 0;
44+
}
45+
46+
template <typename GfxFamily>
47+
inline void ImplicitScalingDispatch<GfxFamily>::dispatchRegisterConfiguration(LinearStream &commandStream, uint64_t workPartitionSurfaceAddress, uint32_t addressOffset) {
48+
}
49+
50+
template <typename GfxFamily>
51+
inline size_t ImplicitScalingDispatch<GfxFamily>::getOffsetRegisterSize() {
52+
return 0;
53+
}
54+
55+
template <typename GfxFamily>
56+
inline void ImplicitScalingDispatch<GfxFamily>::dispatchOffsetRegister(LinearStream &commandStream, uint32_t addressOffset) {
57+
}
58+
59+
template <typename GfxFamily>
60+
inline uint32_t ImplicitScalingDispatch<GfxFamily>::getImmediateWritePostSyncOffset() {
61+
return sizeof(uint64_t);
62+
}
63+
64+
template <typename GfxFamily>
65+
inline uint32_t ImplicitScalingDispatch<GfxFamily>::getTimeStampPostSyncOffset() {
66+
return static_cast<uint32_t>(GfxCoreHelperHw<GfxFamily>::getSingleTimestampPacketSizeHw());
67+
}
68+
69+
template <typename GfxFamily>
70+
inline bool ImplicitScalingDispatch<GfxFamily>::platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment) {
71+
return false;
72+
}
73+
74+
template <>
75+
bool ImplicitScalingDispatch<Family>::pipeControlStallRequired = true;
76+
77+
template struct ImplicitScalingDispatch<Family>;
78+
template void ImplicitScalingDispatch<Family>::dispatchCommands<Family::DefaultWalkerType>(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);
79+
template size_t ImplicitScalingDispatch<Family>::getSize<Family::DefaultWalkerType>(bool apiSelfCleanup, bool preferStaticPartitioning, const DeviceBitfield &devices, const Vec3<size_t> &groupStart, const Vec3<size_t> &groupCount);
80+
81+
} // namespace NEO

shared/source/gen11/command_encoder_gen11.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ template struct EncodeL3State<Family>;
8181
template void EncodeDispatchKernel<Family>::programBarrierEnable<Family::INTERFACE_DESCRIPTOR_DATA>(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
8282
template void InOrderPatchCommandHelpers::PatchCmd<Family>::patchComputeWalker(uint64_t appendCounterValue);
8383
} // namespace NEO
84+
85+
#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl"

shared/source/gen12lp/command_encoder_gen12lp.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,5 @@ template struct EncodeL3State<Family>;
121121
template void EncodeDispatchKernel<Family>::programBarrierEnable<Family::INTERFACE_DESCRIPTOR_DATA>(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
122122
template void InOrderPatchCommandHelpers::PatchCmd<Family>::patchComputeWalker(uint64_t appendCounterValue);
123123
} // namespace NEO
124+
125+
#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl"

shared/source/gen8/command_encoder_gen8.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,5 @@ template struct EncodeL3State<Family>;
6565
template void EncodeDispatchKernel<Family>::programBarrierEnable<Family::INTERFACE_DESCRIPTOR_DATA>(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
6666
template void InOrderPatchCommandHelpers::PatchCmd<Family>::patchComputeWalker(uint64_t appendCounterValue);
6767
} // namespace NEO
68+
69+
#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl"

shared/source/gen9/command_encoder_gen9.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ template struct EncodeL3State<Family>;
6666
template void EncodeDispatchKernel<Family>::programBarrierEnable<Family::INTERFACE_DESCRIPTOR_DATA>(Family::INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, uint32_t value, const HardwareInfo &hwInfo);
6767
template void InOrderPatchCommandHelpers::PatchCmd<Family>::patchComputeWalker(uint64_t appendCounterValue);
6868
} // namespace NEO
69+
70+
#include "shared/source/command_container/implicit_scaling_before_xe_hp.inl"

shared/test/unit_test/command_container/command_encoder_tests.cpp

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77

88
#include "shared/source/command_container/command_encoder.h"
99
#include "shared/source/command_container/encode_surface_state.h"
10+
#include "shared/source/command_container/implicit_scaling.h"
1011
#include "shared/source/command_stream/linear_stream.h"
1112
#include "shared/source/gmm_helper/gmm_helper.h"
1213
#include "shared/source/gmm_helper/gmm_lib.h"
1314
#include "shared/source/helpers/definitions/command_encoder_args.h"
1415
#include "shared/source/helpers/gfx_core_helper.h"
1516
#include "shared/source/helpers/in_order_cmd_helpers.h"
17+
#include "shared/source/helpers/pipe_control_args.h"
1618
#include "shared/source/memory_manager/graphics_allocation.h"
1719
#include "shared/source/memory_manager/memory_manager.h"
1820
#include "shared/source/os_interface/product_helper.h"
@@ -475,4 +477,51 @@ HWTEST2_F(CommandEncoderTests, whenForcingLowQualityFilteringAndAppendSamplerSta
475477
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_DISABLE, state.getLowQualityFilter());
476478
productHelper.adjustSamplerState(&state, *defaultHwInfo);
477479
EXPECT_EQ(SAMPLER_STATE::LOW_QUALITY_FILTER_ENABLE, state.getLowQualityFilter());
480+
}
481+
482+
HWTEST2_F(CommandEncoderTests, whenAskingForImplicitScalingValuesThenAlwaysReturnStubs, IsAtMostGen12lp) {
483+
using WalkerType = typename FamilyType::DefaultWalkerType;
484+
485+
MockExecutionEnvironment executionEnvironment{};
486+
auto rootExecEnv = executionEnvironment.rootDeviceEnvironments[0].get();
487+
488+
uint8_t buffer[128] = {};
489+
LinearStream linearStream(buffer, sizeof(buffer));
490+
491+
WalkerType walkerCmd = {};
492+
493+
DeviceBitfield deviceBitField = 1;
494+
uint32_t partitionCount = 1;
495+
496+
Vec3<size_t> vec3 = {1, 1, 1};
497+
498+
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::template getSize<WalkerType>(false, false, deviceBitField, vec3, vec3));
499+
500+
void *ptr = nullptr;
501+
ImplicitScalingDispatch<FamilyType>::dispatchCommands(linearStream, walkerCmd, &ptr, deviceBitField, RequiredPartitionDim::x, partitionCount, false, false, false, false, 0, *defaultHwInfo);
502+
EXPECT_EQ(0u, linearStream.getUsed());
503+
504+
EXPECT_TRUE(ImplicitScalingDispatch<FamilyType>::getPipeControlStallRequired());
505+
506+
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::getBarrierSize(*rootExecEnv, false, false));
507+
508+
PipeControlArgs pcArgs = {};
509+
ImplicitScalingDispatch<FamilyType>::dispatchBarrierCommands(linearStream, deviceBitField, pcArgs, *rootExecEnv, 0, 0, false, false);
510+
EXPECT_EQ(0u, linearStream.getUsed());
511+
512+
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::getRegisterConfigurationSize());
513+
514+
ImplicitScalingDispatch<FamilyType>::dispatchRegisterConfiguration(linearStream, 0, 0);
515+
EXPECT_EQ(0u, linearStream.getUsed());
516+
517+
EXPECT_EQ(0u, ImplicitScalingDispatch<FamilyType>::getOffsetRegisterSize());
518+
519+
ImplicitScalingDispatch<FamilyType>::dispatchOffsetRegister(linearStream, 0);
520+
EXPECT_EQ(0u, linearStream.getUsed());
521+
522+
EXPECT_EQ(static_cast<uint32_t>(sizeof(uint64_t)), ImplicitScalingDispatch<FamilyType>::getImmediateWritePostSyncOffset());
523+
524+
EXPECT_EQ(static_cast<uint32_t>(GfxCoreHelperHw<FamilyType>::getSingleTimestampPacketSizeHw()), ImplicitScalingDispatch<FamilyType>::getTimeStampPostSyncOffset());
525+
526+
EXPECT_FALSE(ImplicitScalingDispatch<FamilyType>::platformSupportsImplicitScaling(*rootExecEnv));
478527
}

0 commit comments

Comments
 (0)