Files
compute-runtime/shared/source/command_container/implicit_scaling_xehp_plus.inl
Bartosz Dunajski 96d14967ac Partial support for XE_HP_SDV
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
2021-06-24 18:35:54 +02:00

84 lines
5.5 KiB
C++

/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/source/command_container/walker_partition_xehp_plus.h"
#include "shared/source/command_stream/linear_stream.h"
namespace NEO {
template <typename GfxFamily>
size_t ImplicitScalingDispatch<GfxFamily>::getSize(bool nativeCrossTileAtomicSync,
bool preferStaticPartitioning,
const DeviceBitfield &devices,
Vec3<size_t> groupStart,
Vec3<size_t> groupCount) {
typename GfxFamily::COMPUTE_WALKER::PARTITION_TYPE partitionType{};
bool staticPartitioning = false;
const uint32_t tileCount = static_cast<uint32_t>(devices.count());
const uint32_t partitionCount = WalkerPartition::computePartitionCountAndPartitionType<GfxFamily>(tileCount,
preferStaticPartitioning,
groupStart,
groupCount,
{},
&partitionType,
&staticPartitioning);
UNRECOVERABLE_IF(staticPartitioning && (tileCount != partitionCount));
auto synchronizeBeforeExecution = ImplicitScalingHelper::isSynchronizeBeforeExecutionRequired();
return static_cast<size_t>(WalkerPartition::estimateSpaceRequiredInCommandBuffer<GfxFamily>(
false, 16u, synchronizeBeforeExecution, nativeCrossTileAtomicSync, staticPartitioning));
}
template <typename GfxFamily>
void ImplicitScalingDispatch<GfxFamily>::dispatchCommands(LinearStream &commandStream,
WALKER_TYPE &walkerCmd,
const DeviceBitfield &devices,
uint32_t &partitionCount,
bool useSecondaryBatchBuffer,
bool nativeCrossTileAtomicSync,
bool usesImages,
uint64_t workPartitionAllocationGpuVa) {
uint32_t totalProgrammedSize = 0u;
const uint32_t tileCount = static_cast<uint32_t>(devices.count());
const bool preferStaticPartitioning = workPartitionAllocationGpuVa != 0u;
bool staticPartitioning = false;
partitionCount = WalkerPartition::computePartitionCountAndSetPartitionType<GfxFamily>(&walkerCmd, tileCount, preferStaticPartitioning, usesImages, &staticPartitioning);
const bool synchronizeBeforeExecution = ImplicitScalingHelper::isSynchronizeBeforeExecutionRequired();
if (staticPartitioning) {
UNRECOVERABLE_IF(tileCount != partitionCount);
WalkerPartition::constructStaticallyPartitionedCommandBuffer<GfxFamily>(commandStream.getSpace(0u),
commandStream.getGraphicsAllocation()->getGpuAddress() + commandStream.getUsed(),
&walkerCmd,
totalProgrammedSize,
partitionCount,
tileCount,
synchronizeBeforeExecution,
useSecondaryBatchBuffer,
nativeCrossTileAtomicSync,
workPartitionAllocationGpuVa);
} else {
if (DebugManager.flags.ExperimentalSetWalkerPartitionCount.get()) {
partitionCount = DebugManager.flags.ExperimentalSetWalkerPartitionCount.get();
if (partitionCount == 1u) {
walkerCmd.setPartitionType(GfxFamily::COMPUTE_WALKER::PARTITION_TYPE::PARTITION_TYPE_DISABLED);
}
}
WalkerPartition::constructDynamicallyPartitionedCommandBuffer<GfxFamily>(commandStream.getSpace(0u),
commandStream.getGraphicsAllocation()->getGpuAddress() + commandStream.getUsed(),
&walkerCmd, totalProgrammedSize,
partitionCount, tileCount,
false, synchronizeBeforeExecution, useSecondaryBatchBuffer,
nativeCrossTileAtomicSync);
}
commandStream.getSpace(totalProgrammedSize);
}
} // namespace NEO