mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Use MI_SEMAPHORE_WAIT command for event synchronization
Related-To: NEO-5508 Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
2b956651a7
commit
b01b8ba5ac
@@ -327,7 +327,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
auto &commandStreamCSR = this->getCS(getRequiredCmdStreamSizeAligned(dispatchFlags, device));
|
||||
auto commandStreamStartCSR = commandStreamCSR.getUsed();
|
||||
|
||||
TimestampPacketHelper::programCsrDependencies<GfxFamily>(commandStreamCSR, dispatchFlags.csrDependencies, getOsContext().getNumSupportedDevices());
|
||||
TimestampPacketHelper::programCsrDependenciesForTimestampPacketContainer<GfxFamily>(commandStreamCSR, dispatchFlags.csrDependencies, getOsContext().getNumSupportedDevices());
|
||||
|
||||
if (stallingPipeControlOnNextFlushRequired) {
|
||||
programStallingPipeControlForBarrier(commandStreamCSR, dispatchFlags);
|
||||
@@ -1016,7 +1016,7 @@ uint32_t CommandStreamReceiverHw<GfxFamily>::blitBuffer(const BlitPropertiesCont
|
||||
programEnginePrologue(commandStream);
|
||||
|
||||
for (auto &blitProperties : blitPropertiesContainer) {
|
||||
TimestampPacketHelper::programCsrDependencies<GfxFamily>(commandStream, blitProperties.csrDependencies, getOsContext().getNumSupportedDevices());
|
||||
TimestampPacketHelper::programCsrDependenciesForTimestampPacketContainer<GfxFamily>(commandStream, blitProperties.csrDependencies, getOsContext().getNumSupportedDevices());
|
||||
|
||||
if (blitProperties.outputTimestampPacket && profilingEnabled) {
|
||||
BlitCommandsHelper<GfxFamily>::encodeProfilingStartMmios(commandStream, *blitProperties.outputTimestampPacket);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace NEO {
|
||||
|
||||
void CsrDependencies::makeResident(CommandStreamReceiver &commandStreamReceiver) const {
|
||||
for (auto ×tampPacketContainer : *this) {
|
||||
for (auto ×tampPacketContainer : timestampPacketContainer) {
|
||||
timestampPacketContainer->makeResident(commandStreamReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -13,7 +13,7 @@ namespace NEO {
|
||||
class TimestampPacketContainer;
|
||||
class CommandStreamReceiver;
|
||||
|
||||
class CsrDependencies : public StackVec<TimestampPacketContainer *, 32> {
|
||||
class CsrDependencies {
|
||||
public:
|
||||
enum class DependenciesType {
|
||||
OnCsr,
|
||||
@@ -21,6 +21,9 @@ class CsrDependencies : public StackVec<TimestampPacketContainer *, 32> {
|
||||
All
|
||||
};
|
||||
|
||||
StackVec<std::pair<uint32_t, uint64_t>, 32> taskCountContainer;
|
||||
StackVec<TimestampPacketContainer *, 32> timestampPacketContainer;
|
||||
|
||||
void makeResident(CommandStreamReceiver &commandStreamReceiver) const;
|
||||
};
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -144,15 +144,15 @@ void BlitProperties::setupDependenciesForAuxTranslation(BlitPropertiesContainer
|
||||
timestampPacketDependencies.barrierNodes.add(nodesAllocator->getTag());
|
||||
|
||||
// wait for barrier and events before AuxToNonAux
|
||||
blitPropertiesContainer[0].csrDependencies.push_back(×tampPacketDependencies.barrierNodes);
|
||||
blitPropertiesContainer[0].csrDependencies.timestampPacketContainer.push_back(×tampPacketDependencies.barrierNodes);
|
||||
|
||||
for (auto dep : depsFromEvents) {
|
||||
blitPropertiesContainer[0].csrDependencies.push_back(dep);
|
||||
for (auto dep : depsFromEvents.timestampPacketContainer) {
|
||||
blitPropertiesContainer[0].csrDependencies.timestampPacketContainer.push_back(dep);
|
||||
}
|
||||
|
||||
// wait for NDR before NonAuxToAux
|
||||
blitPropertiesContainer[numObjects].csrDependencies.push_back(×tampPacketDependencies.cacheFlushNodes);
|
||||
blitPropertiesContainer[numObjects].csrDependencies.push_back(&kernelTimestamps);
|
||||
blitPropertiesContainer[numObjects].csrDependencies.timestampPacketContainer.push_back(×tampPacketDependencies.cacheFlushNodes);
|
||||
blitPropertiesContainer[numObjects].csrDependencies.timestampPacketContainer.push_back(&kernelTimestamps);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/command_container/command_encoder.h"
|
||||
#include "shared/source/command_stream/command_stream_receiver.h"
|
||||
#include "shared/source/command_stream/csr_deps.h"
|
||||
#include "shared/source/helpers/aux_translation.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
@@ -183,14 +183,29 @@ struct TimestampPacketHelper {
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static void programCsrDependencies(LinearStream &cmdStream, const CsrDependencies &csrDependencies, uint32_t numSupportedDevices) {
|
||||
for (auto timestampPacketContainer : csrDependencies) {
|
||||
static void programCsrDependenciesForTimestampPacketContainer(LinearStream &cmdStream, const CsrDependencies &csrDependencies, uint32_t numSupportedDevices) {
|
||||
for (auto timestampPacketContainer : csrDependencies.timestampPacketContainer) {
|
||||
for (auto &node : timestampPacketContainer->peekNodes()) {
|
||||
TimestampPacketHelper::programSemaphoreWithImplicitDependency<GfxFamily>(cmdStream, *node, numSupportedDevices);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static void programCsrDependenciesForForTaskCountContainer(LinearStream &cmdStream, const CsrDependencies &csrDependencies) {
|
||||
auto taskCountContainer = csrDependencies.taskCountContainer;
|
||||
|
||||
for (auto &[taskCountPreviousRootDevice, tagAddressPreviousRootDevice] : taskCountContainer) {
|
||||
using COMPARE_OPERATION = typename GfxFamily::MI_SEMAPHORE_WAIT::COMPARE_OPERATION;
|
||||
using MI_SEMAPHORE_WAIT = typename GfxFamily::MI_SEMAPHORE_WAIT;
|
||||
|
||||
EncodeSempahore<GfxFamily>::addMiSemaphoreWaitCommand(cmdStream,
|
||||
static_cast<uint64_t>(tagAddressPreviousRootDevice),
|
||||
taskCountPreviousRootDevice,
|
||||
COMPARE_OPERATION::COMPARE_OPERATION_SAD_GREATER_THAN_OR_EQUAL_SDD);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename GfxFamily, AuxTranslationDirection auxTranslationDirection>
|
||||
static void programSemaphoreWithImplicitDependencyForAuxTranslation(LinearStream &cmdStream,
|
||||
const TimestampPacketDependencies *timestampPacketDependencies,
|
||||
@@ -241,7 +256,7 @@ struct TimestampPacketHelper {
|
||||
template <typename GfxFamily>
|
||||
static size_t getRequiredCmdStreamSize(const CsrDependencies &csrDependencies) {
|
||||
size_t totalCommandsSize = 0;
|
||||
for (auto timestampPacketContainer : csrDependencies) {
|
||||
for (auto timestampPacketContainer : csrDependencies.timestampPacketContainer) {
|
||||
for (auto &node : timestampPacketContainer->peekNodes()) {
|
||||
totalCommandsSize += getRequiredCmdStreamSizeForNodeDependency<GfxFamily>(*node);
|
||||
}
|
||||
@@ -249,6 +264,11 @@ struct TimestampPacketHelper {
|
||||
|
||||
return totalCommandsSize;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
static size_t getRequiredCmdStreamSizeForTaskCountContainer(const CsrDependencies &csrDependencies) {
|
||||
return csrDependencies.taskCountContainer.size() * sizeof(typename GfxFamily::MI_SEMAPHORE_WAIT);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
Reference in New Issue
Block a user