Revert TSP changes

This commit reverts:
a1d2bdc76666059653c79fe39a26113ce47c632a,
71a115129c1698ff15305fd0ea3828cba861be47,
e1a9087a466bfba54d84a64247e6596092034a91.

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-06-21 12:04:12 +00:00
committed by Compute-Runtime-Automation
parent 48feca4f44
commit 2e97aeccfd
25 changed files with 489 additions and 54 deletions

View File

@@ -17,6 +17,7 @@
#include "pipe_control_args.h"
#include <atomic>
#include <cstdint>
#include <vector>
@@ -48,6 +49,20 @@ class TimestampPackets : public TagTypeBase {
static constexpr size_t getSinglePacketSize() { return sizeof(Packet); }
bool isCompleted() const {
if (DebugManager.flags.DisableAtomicForPostSyncs.get()) {
return false;
}
for (uint32_t i = 0; i < packetsUsed; i++) {
if (packets[i].contextEnd == 1) {
return false;
}
}
return true;
}
void initialize() {
for (auto &packet : packets) {
packet.contextStart = 1u;
@@ -56,6 +71,7 @@ class TimestampPackets : public TagTypeBase {
packet.globalEnd = 1u;
}
packetsUsed = 1;
implicitGpuDependenciesCount = 0;
}
void assignDataToAllTimestamps(uint32_t packetIndex, void *source) {
@@ -66,6 +82,7 @@ class TimestampPackets : public TagTypeBase {
static constexpr size_t getContextStartOffset() { return offsetof(Packet, contextStart); }
static constexpr size_t getContextEndOffset() { return offsetof(Packet, contextEnd); }
static constexpr size_t getGlobalEndOffset() { return offsetof(Packet, globalEnd); }
size_t getImplicitGpuDependenciesCountOffset() const { return ptrDiff(&implicitGpuDependenciesCount, this); }
uint64_t getContextStartValue(uint32_t packetIndex) const { return static_cast<uint64_t>(packets[packetIndex].contextStart); }
uint64_t getGlobalStartValue(uint32_t packetIndex) const { return static_cast<uint64_t>(packets[packetIndex].globalStart); }
@@ -75,13 +92,16 @@ class TimestampPackets : public TagTypeBase {
void setPacketsUsed(uint32_t used) { packetsUsed = used; }
uint32_t getPacketsUsed() const { return packetsUsed; }
uint32_t getImplicitGpuDependenciesCount() const { return implicitGpuDependenciesCount; }
protected:
Packet packets[TimestampPacketSizeControl::preferredPacketCount];
uint32_t implicitGpuDependenciesCount = 0;
uint32_t packetsUsed = 1;
};
#pragma pack()
static_assert(((4 * TimestampPacketSizeControl::preferredPacketCount + 1) * sizeof(uint32_t)) == sizeof(TimestampPackets<uint32_t>),
static_assert(((4 * TimestampPacketSizeControl::preferredPacketCount + 2) * sizeof(uint32_t)) == sizeof(TimestampPackets<uint32_t>),
"This structure is consumed by GPU and has to follow specific restrictions for padding and size");
class TimestampPacketContainer : public NonCopyableClass {
@@ -124,24 +144,49 @@ struct TimestampPacketHelper {
return timestampPacketNode.getGpuAddress() + timestampPacketNode.getGlobalStartOffset();
}
static uint64_t getGpuDependenciesCountGpuAddress(const TagNodeBase &timestampPacketNode) {
return timestampPacketNode.getGpuAddress() + timestampPacketNode.getImplicitGpuDependenciesCountOffset();
}
static void overrideSupportedDevicesCount(uint32_t &numSupportedDevices);
template <typename GfxFamily>
static void programSemaphore(LinearStream &cmdStream, TagNodeBase &timestampPacketNode) {
static void programSemaphoreWithImplicitDependency(LinearStream &cmdStream, TagNodeBase &timestampPacketNode, uint32_t numSupportedDevices) {
using MI_ATOMIC = typename GfxFamily::MI_ATOMIC;
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
auto compareAddress = getContextEndGpuAddress(timestampPacketNode);
auto dependenciesCountAddress = getGpuDependenciesCountGpuAddress(timestampPacketNode);
for (uint32_t packetId = 0; packetId < timestampPacketNode.getPacketsUsed(); packetId++) {
uint64_t compareOffset = packetId * timestampPacketNode.getSinglePacketSize();
EncodeSempahore<GfxFamily>::addMiSemaphoreWaitCommand(cmdStream, compareAddress + compareOffset, 1, COMPARE_OPERATION::COMPARE_OPERATION_SAD_NOT_EQUAL_SDD);
}
bool trackPostSyncDependencies = true;
if (DebugManager.flags.DisableAtomicForPostSyncs.get()) {
trackPostSyncDependencies = false;
}
if (trackPostSyncDependencies) {
overrideSupportedDevicesCount(numSupportedDevices);
for (uint32_t i = 0; i < numSupportedDevices; i++) {
timestampPacketNode.incImplicitCpuDependenciesCount();
}
EncodeAtomic<GfxFamily>::programMiAtomic(cmdStream, dependenciesCountAddress,
MI_ATOMIC::ATOMIC_OPCODES::ATOMIC_4B_INCREMENT,
MI_ATOMIC::DATA_SIZE::DATA_SIZE_DWORD,
0u, 0u, 0x0u, 0x0u);
}
}
template <typename GfxFamily>
static void programCsrDependenciesForTimestampPacketContainer(LinearStream &cmdStream, const CsrDependencies &csrDependencies) {
static void programCsrDependenciesForTimestampPacketContainer(LinearStream &cmdStream, const CsrDependencies &csrDependencies, uint32_t numSupportedDevices) {
for (auto timestampPacketContainer : csrDependencies.timestampPacketContainer) {
for (auto &node : timestampPacketContainer->peekNodes()) {
TimestampPacketHelper::programSemaphore<GfxFamily>(cmdStream, *node);
TimestampPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(cmdStream, *node, numSupportedDevices);
}
}
}
@@ -162,9 +207,9 @@ struct TimestampPacketHelper {
}
template <typename GfxFamily, AuxTranslationDirection auxTranslationDirection>
static void programSemaphoreForAuxTranslation(LinearStream &cmdStream,
const TimestampPacketDependencies *timestampPacketDependencies,
const HardwareInfo &hwInfo) {
static void programSemaphoreWithImplicitDependencyForAuxTranslation(LinearStream &cmdStream,
const TimestampPacketDependencies *timestampPacketDependencies,
const HardwareInfo &hwInfo, uint32_t numSupportedDevices) {
auto &container = (auxTranslationDirection == AuxTranslationDirection::AuxToNonAux)
? timestampPacketDependencies->auxToNonAuxNodes
: timestampPacketDependencies->nonAuxToAuxNodes;
@@ -181,7 +226,7 @@ struct TimestampPacketHelper {
}
for (auto &node : container.peekNodes()) {
TimestampPacketHelper::programSemaphore<GfxFamily>(cmdStream, *node);
TimestampPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(cmdStream, *node, numSupportedDevices);
}
}
@@ -198,12 +243,14 @@ struct TimestampPacketHelper {
template <typename GfxFamily>
static size_t getRequiredCmdStreamSizeForNodeDependencyWithBlitEnqueue() {
return sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
return sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT) + sizeof(typename GfxFamily::MI_ATOMIC);
}
template <typename GfxFamily>
static size_t getRequiredCmdStreamSizeForNodeDependency(TagNodeBase &timestampPacketNode) {
return (timestampPacketNode.getPacketsUsed() * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT));
size_t totalMiSemaphoreWaitSize = timestampPacketNode.getPacketsUsed() * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
return totalMiSemaphoreWaitSize + sizeof(typename GfxFamily::MI_ATOMIC);
}
template <typename GfxFamily>