Skip to content

Commit 7fbf724

Browse files
refactor: update Implicit Scaling interface
Signed-off-by: Dunajski, Bartosz <[email protected]>
1 parent 6d53bd5 commit 7fbf724

File tree

7 files changed

+36
-15
lines changed

7 files changed

+36
-15
lines changed

shared/source/command_container/implicit_scaling.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -90,6 +90,9 @@ struct ImplicitScalingDispatch {
9090

9191
static bool platformSupportsImplicitScaling(const RootDeviceEnvironment &rootDeviceEnvironment);
9292

93+
template <typename WalkerType>
94+
static void appendWalkerFields(WalkerType &walkerCmd, uint32_t tileCount);
95+
9396
private:
9497
static bool pipeControlStallRequired;
9598
};

shared/source/command_container/implicit_scaling_before_xe_hp.inl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2023 Intel Corporation
2+
* Copyright (C) 2023-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -71,11 +71,17 @@ inline bool ImplicitScalingDispatch<GfxFamily>::platformSupportsImplicitScaling(
7171
return false;
7272
}
7373

74+
template <typename GfxFamily>
75+
template <typename WalkerType>
76+
void ImplicitScalingDispatch<GfxFamily>::appendWalkerFields(WalkerType &walkerCmd, uint32_t tileCount) {
77+
}
78+
7479
template <>
7580
bool ImplicitScalingDispatch<Family>::pipeControlStallRequired = true;
7681

7782
template struct ImplicitScalingDispatch<Family>;
7883
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);
7984
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);
85+
template void ImplicitScalingDispatch<Family>::appendWalkerFields<Family::DefaultWalkerType>(Family::DefaultWalkerType &walkerCmd, uint32_t tileCount);
8086

8187
} // namespace NEO

shared/source/command_container/implicit_scaling_xehp_and_later.inl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -254,4 +254,9 @@ inline bool ImplicitScalingDispatch<GfxFamily>::platformSupportsImplicitScaling(
254254
return false;
255255
}
256256

257+
template <typename GfxFamily>
258+
template <typename WalkerType>
259+
void ImplicitScalingDispatch<GfxFamily>::appendWalkerFields(WalkerType &walkerCmd, uint32_t tileCount) {
260+
}
261+
257262
} // namespace NEO

shared/source/command_container/walker_partition_xehp_and_later.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -8,6 +8,7 @@
88
#pragma once
99

1010
#include "shared/source/command_container/command_encoder.h"
11+
#include "shared/source/command_container/implicit_scaling.h"
1112
#include "shared/source/command_container/walker_partition_interface.h"
1213
#include "shared/source/debug_settings/debug_settings_manager.h"
1314
#include "shared/source/helpers/aligned_memory.h"
@@ -492,6 +493,7 @@ template <typename GfxFamily, typename WalkerType>
492493
void *programPartitionedWalker(void *&inputAddress, uint32_t &totalBytesProgrammed,
493494
WalkerType *inputWalker,
494495
uint32_t partitionCount,
496+
uint32_t tileCount,
495497
bool forceExecutionOnSingleTile) {
496498
auto computeWalker = putCommand<WalkerType>(inputAddress, totalBytesProgrammed);
497499
WalkerType cmd = *inputWalker;
@@ -521,6 +523,9 @@ void *programPartitionedWalker(void *&inputAddress, uint32_t &totalBytesProgramm
521523
cmd.setPartitionSize(Math::divideAndRoundUp(workgroupCount, partitionCount));
522524
}
523525
}
526+
527+
NEO::ImplicitScalingDispatch<GfxFamily>::appendWalkerFields(cmd, tileCount);
528+
524529
*computeWalker = cmd;
525530

526531
return computeWalker;
@@ -633,7 +638,7 @@ void constructDynamicallyPartitionedCommandBuffer(void *cpuPointer,
633638
args.secondaryBatchBuffer);
634639

635640
// Walker section
636-
auto walkerPtr = programPartitionedWalker<GfxFamily, WalkerType>(currentBatchBufferPointer, totalBytesProgrammed, inputWalker, args.partitionCount, args.forceExecutionOnSingleTile);
641+
auto walkerPtr = programPartitionedWalker<GfxFamily, WalkerType>(currentBatchBufferPointer, totalBytesProgrammed, inputWalker, args.partitionCount, args.tileCount, args.forceExecutionOnSingleTile);
637642
if (outWalkerPtr) {
638643
*outWalkerPtr = walkerPtr;
639644
}
@@ -727,7 +732,7 @@ void constructStaticallyPartitionedCommandBuffer(void *cpuPointer,
727732
if (args.initializeWparidRegister) {
728733
programMiLoadRegisterMem<GfxFamily>(currentBatchBufferPointer, totalBytesProgrammed, args.workPartitionAllocationGpuVa, wparidCCSOffset);
729734
}
730-
auto walkerPtr = programPartitionedWalker<GfxFamily>(currentBatchBufferPointer, totalBytesProgrammed, inputWalker, args.partitionCount, args.forceExecutionOnSingleTile);
735+
auto walkerPtr = programPartitionedWalker<GfxFamily>(currentBatchBufferPointer, totalBytesProgrammed, inputWalker, args.partitionCount, args.tileCount, args.forceExecutionOnSingleTile);
731736
if (outWalkerPtr) {
732737
*outWalkerPtr = walkerPtr;
733738
}

shared/source/xe_hpc_core/implicit_scaling_xe_hpc_core.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -32,5 +32,6 @@ bool ImplicitScalingDispatch<Family>::platformSupportsImplicitScaling(const Root
3232
template struct ImplicitScalingDispatch<Family>;
3333
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);
3434
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);
35+
template void ImplicitScalingDispatch<Family>::appendWalkerFields<Family::DefaultWalkerType>(Family::DefaultWalkerType &walkerCmd, uint32_t tileCount);
3536

3637
} // namespace NEO

shared/source/xe_hpg_core/implicit_scaling_xe_hpg_core.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -19,5 +19,6 @@ bool ImplicitScalingDispatch<Family>::pipeControlStallRequired = true;
1919
template struct ImplicitScalingDispatch<Family>;
2020
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);
2121
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);
22+
template void ImplicitScalingDispatch<Family>::appendWalkerFields<Family::DefaultWalkerType>(Family::DefaultWalkerType &walkerCmd, uint32_t tileCount);
2223

2324
} // namespace NEO

shared/test/unit_test/encoders/walker_partition_tests_xehp_and_later_2.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2021-2023 Intel Corporation
2+
* Copyright (C) 2021-2024 Intel Corporation
33
*
44
* SPDX-License-Identifier: MIT
55
*
@@ -426,7 +426,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenProgramComputeWalkerWhen
426426

427427
walker.setPartitionType(WalkerType::PARTITION_TYPE::PARTITION_TYPE_X);
428428
void *walkerCommandAddress = cmdBufferAddress;
429-
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, false);
429+
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, 2, false);
430430
auto walkerCommand = genCmdCast<WalkerType *>(walkerCommandAddress);
431431

432432
ASSERT_NE(nullptr, walkerCommand);
@@ -437,7 +437,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenProgramComputeWalkerWhen
437437

438438
walker.setPartitionType(WalkerType::PARTITION_TYPE::PARTITION_TYPE_Y);
439439
walkerCommandAddress = cmdBufferAddress;
440-
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, false);
440+
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, 2, false);
441441
walkerCommand = genCmdCast<WalkerType *>(walkerCommandAddress);
442442

443443
ASSERT_NE(nullptr, walkerCommand);
@@ -446,7 +446,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenProgramComputeWalkerWhen
446446

447447
walker.setPartitionType(WalkerType::PARTITION_TYPE::PARTITION_TYPE_Z);
448448
walkerCommandAddress = cmdBufferAddress;
449-
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, false);
449+
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, 2, false);
450450
walkerCommand = genCmdCast<WalkerType *>(walkerCommandAddress);
451451

452452
ASSERT_NE(nullptr, walkerCommand);
@@ -456,7 +456,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenProgramComputeWalkerWhen
456456
// if we program with partition Count == 1 then do not trigger partition stuff
457457
walker.setPartitionType(WalkerType::PARTITION_TYPE::PARTITION_TYPE_DISABLED);
458458
walkerCommandAddress = cmdBufferAddress;
459-
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 1u, false);
459+
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 1u, 2, false);
460460
walkerCommand = genCmdCast<WalkerType *>(walkerCommandAddress);
461461

462462
ASSERT_NE(nullptr, walkerCommand);
@@ -1758,7 +1758,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenForceExecutionOnSingleTi
17581758
bool forceExecutionOnSingleTile = false;
17591759
walker.setPartitionType(WalkerType::PARTITION_TYPE::PARTITION_TYPE_X);
17601760
void *walkerCommandAddress = cmdBufferAddress;
1761-
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, forceExecutionOnSingleTile);
1761+
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, 2, forceExecutionOnSingleTile);
17621762
auto walkerCommand = genCmdCast<WalkerType *>(walkerCommandAddress);
17631763

17641764
ASSERT_NE(nullptr, walkerCommand);
@@ -1768,7 +1768,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, WalkerPartitionTests, givenForceExecutionOnSingleTi
17681768

17691769
forceExecutionOnSingleTile = true;
17701770
walkerCommandAddress = cmdBufferAddress;
1771-
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, forceExecutionOnSingleTile);
1771+
programPartitionedWalker<FamilyType>(cmdBufferAddress, totalBytesProgrammed, &walker, 2u, 2, forceExecutionOnSingleTile);
17721772
walkerCommand = genCmdCast<WalkerType *>(walkerCommandAddress);
17731773

17741774
ASSERT_NE(nullptr, walkerCommand);

0 commit comments

Comments
 (0)