Use LogicalStateHelper to encode SystemMemoryFence

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2022-06-23 09:44:45 +00:00
committed by Compute-Runtime-Automation
parent 281c98dcf9
commit 61b2ee45cd
9 changed files with 21 additions and 6 deletions

View File

@@ -27,6 +27,7 @@ namespace NEO {
class BindlessHeapsHelper;
class GmmHelper;
class LogicalStateHelper;
class IndirectHeap;
class Gmm;
struct HardwareInfo;
@@ -455,7 +456,7 @@ template <typename GfxFamily>
struct EncodeMemoryFence {
static size_t getSystemMemoryFenceSize();
static void encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation);
static void encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation, LogicalStateHelper *logicalStateHelper);
};
} // namespace NEO

View File

@@ -884,7 +884,7 @@ size_t EncodeMemoryFence<Family>::getSystemMemoryFenceSize() {
}
template <typename Family>
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation) {
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation, LogicalStateHelper *logicalStateHelper) {
}
} // namespace NEO

View File

@@ -19,7 +19,7 @@ size_t EncodeMemoryFence<Family>::getSystemMemoryFenceSize() {
}
template <>
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation) {
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation, LogicalStateHelper *logicalStateHelper) {
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename Family::STATE_SYSTEM_MEM_FENCE_ADDRESS;
auto stateSystemFenceAddressSpace = commandStream.getSpaceForCmd<STATE_SYSTEM_MEM_FENCE_ADDRESS>();

View File

@@ -1053,6 +1053,10 @@ std::optional<uint32_t> CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const B
pageTableManagerInitialized = pageTableManager->initPageTableManagerRegisters(this);
}
if (logicalStateHelper) {
logicalStateHelper->writeStreamInline(commandStream);
}
for (auto &blitProperties : blitPropertiesContainer) {
TimestampPacketHelper::programCsrDependenciesForTimestampPacketContainer<GfxFamily>(commandStream, blitProperties.csrDependencies);
TimestampPacketHelper::programCsrDependenciesForForTaskCountContainer<GfxFamily>(commandStream, blitProperties.csrDependencies);

View File

@@ -12,6 +12,7 @@
namespace NEO {
DirectSubmissionInputParams::DirectSubmissionInputParams(const CommandStreamReceiver &commandStreamReceiver) : osContext(commandStreamReceiver.getOsContext()), rootDeviceEnvironment(commandStreamReceiver.peekRootDeviceEnvironment()), rootDeviceIndex(commandStreamReceiver.getRootDeviceIndex()) {
memoryManager = commandStreamReceiver.getMemoryManager();
logicalStateHelper = commandStreamReceiver.getLogicalStateHelper();
globalFenceAllocation = commandStreamReceiver.getGlobalFenceAllocation();
workPartitionAllocation = commandStreamReceiver.getWorkPartitionAllocation();
completionFenceAllocation = commandStreamReceiver.getTagAllocation();

View File

@@ -54,6 +54,7 @@ struct BatchBuffer;
class DirectSubmissionDiagnosticsCollector;
class FlushStampTracker;
class GraphicsAllocation;
class LogicalStateHelper;
struct HardwareInfo;
class OsContext;
class MemoryOperationsHandler;
@@ -62,6 +63,7 @@ struct DirectSubmissionInputParams : NonCopyableClass {
DirectSubmissionInputParams(const CommandStreamReceiver &commandStreamReceiver);
OsContext &osContext;
const RootDeviceEnvironment &rootDeviceEnvironment;
LogicalStateHelper *logicalStateHelper = nullptr;
MemoryManager *memoryManager = nullptr;
const GraphicsAllocation *globalFenceAllocation = nullptr;
GraphicsAllocation *workPartitionAllocation = nullptr;
@@ -170,6 +172,7 @@ class DirectSubmissionHw {
OsContext &osContext;
const uint32_t rootDeviceIndex;
MemoryManager *memoryManager = nullptr;
LogicalStateHelper *logicalStateHelper = nullptr;
MemoryOperationsHandler *memoryOperationHandler = nullptr;
const HardwareInfo *hwInfo = nullptr;
const GraphicsAllocation *globalFenceAllocation = nullptr;

View File

@@ -13,6 +13,7 @@
#include "shared/source/direct_submission/direct_submission_hw.h"
#include "shared/source/direct_submission/direct_submission_hw_diagnostic_mode.h"
#include "shared/source/helpers/flush_stamp.h"
#include "shared/source/helpers/logical_state_helper.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/source/memory_manager/allocation_properties.h"
#include "shared/source/memory_manager/graphics_allocation.h"
@@ -34,6 +35,7 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
: ringBuffers(RingBufferUse::initialRingBufferCount), osContext(inputParams.osContext), rootDeviceIndex(inputParams.rootDeviceIndex) {
memoryManager = inputParams.memoryManager;
globalFenceAllocation = inputParams.globalFenceAllocation;
logicalStateHelper = inputParams.logicalStateHelper;
hwInfo = inputParams.rootDeviceEnvironment.getHardwareInfo();
memoryOperationHandler = inputParams.rootDeviceEnvironment.memoryOperationsInterface.get();
@@ -642,7 +644,11 @@ size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getDiagnosticModeSection() {
template <typename GfxFamily, typename Dispatcher>
void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSystemMemoryFenceAddress() {
UNRECOVERABLE_IF(!this->globalFenceAllocation);
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation);
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation, this->logicalStateHelper);
if (logicalStateHelper) {
logicalStateHelper->writeStreamInline(ringCommandStream);
}
}
template <typename GfxFamily, typename Dispatcher>

View File

@@ -34,7 +34,7 @@ template <>
void CommandStreamReceiverHw<Family>::programEnginePrologue(LinearStream &csr) {
if (!this->isEnginePrologueSent) {
if (globalFenceAllocation) {
EncodeMemoryFence<Family>::encodeSystemMemoryFence(csr, globalFenceAllocation);
EncodeMemoryFence<Family>::encodeSystemMemoryFence(csr, globalFenceAllocation, nullptr);
}
this->isEnginePrologueSent = true;
}

View File

@@ -154,7 +154,7 @@ HWTEST_F(CommandEncoderTest, givenPlatformSupportingMiMemFenceWhenEncodingThenPr
size_t size = EncodeMemoryFence<FamilyType>::getSystemMemoryFenceSize();
EncodeMemoryFence<FamilyType>::encodeSystemMemoryFence(cmdStream, &allocation);
EncodeMemoryFence<FamilyType>::encodeSystemMemoryFence(cmdStream, &allocation, nullptr);
if constexpr (FamilyType::isUsingMiMemFence) {
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;