Skip to content

Commit 61b2ee4

Browse files
Use LogicalStateHelper to encode SystemMemoryFence
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
1 parent 281c98d commit 61b2ee4

File tree

9 files changed

+21
-6
lines changed

9 files changed

+21
-6
lines changed

shared/source/command_container/command_encoder.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace NEO {
2727

2828
class BindlessHeapsHelper;
2929
class GmmHelper;
30+
class LogicalStateHelper;
3031
class IndirectHeap;
3132
class Gmm;
3233
struct HardwareInfo;
@@ -455,7 +456,7 @@ template <typename GfxFamily>
455456
struct EncodeMemoryFence {
456457
static size_t getSystemMemoryFenceSize();
457458

458-
static void encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation);
459+
static void encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation, LogicalStateHelper *logicalStateHelper);
459460
};
460461

461462
} // namespace NEO

shared/source/command_container/command_encoder.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ size_t EncodeMemoryFence<Family>::getSystemMemoryFenceSize() {
884884
}
885885

886886
template <typename Family>
887-
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation) {
887+
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation, LogicalStateHelper *logicalStateHelper) {
888888
}
889889

890890
} // namespace NEO

shared/source/command_container/command_encoder_xe_hpc_core_and_later.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ size_t EncodeMemoryFence<Family>::getSystemMemoryFenceSize() {
1919
}
2020

2121
template <>
22-
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation) {
22+
void EncodeMemoryFence<Family>::encodeSystemMemoryFence(LinearStream &commandStream, const GraphicsAllocation *globalFenceAllocation, LogicalStateHelper *logicalStateHelper) {
2323
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename Family::STATE_SYSTEM_MEM_FENCE_ADDRESS;
2424

2525
auto stateSystemFenceAddressSpace = commandStream.getSpaceForCmd<STATE_SYSTEM_MEM_FENCE_ADDRESS>();

shared/source/command_stream/command_stream_receiver_hw_base.inl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,10 @@ std::optional<uint32_t> CommandStreamReceiverHw<GfxFamily>::flushBcsTask(const B
10531053
pageTableManagerInitialized = pageTableManager->initPageTableManagerRegisters(this);
10541054
}
10551055

1056+
if (logicalStateHelper) {
1057+
logicalStateHelper->writeStreamInline(commandStream);
1058+
}
1059+
10561060
for (auto &blitProperties : blitPropertiesContainer) {
10571061
TimestampPacketHelper::programCsrDependenciesForTimestampPacketContainer<GfxFamily>(commandStream, blitProperties.csrDependencies);
10581062
TimestampPacketHelper::programCsrDependenciesForForTaskCountContainer<GfxFamily>(commandStream, blitProperties.csrDependencies);

shared/source/direct_submission/direct_submission_hw.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace NEO {
1313
DirectSubmissionInputParams::DirectSubmissionInputParams(const CommandStreamReceiver &commandStreamReceiver) : osContext(commandStreamReceiver.getOsContext()), rootDeviceEnvironment(commandStreamReceiver.peekRootDeviceEnvironment()), rootDeviceIndex(commandStreamReceiver.getRootDeviceIndex()) {
1414
memoryManager = commandStreamReceiver.getMemoryManager();
15+
logicalStateHelper = commandStreamReceiver.getLogicalStateHelper();
1516
globalFenceAllocation = commandStreamReceiver.getGlobalFenceAllocation();
1617
workPartitionAllocation = commandStreamReceiver.getWorkPartitionAllocation();
1718
completionFenceAllocation = commandStreamReceiver.getTagAllocation();

shared/source/direct_submission/direct_submission_hw.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct BatchBuffer;
5454
class DirectSubmissionDiagnosticsCollector;
5555
class FlushStampTracker;
5656
class GraphicsAllocation;
57+
class LogicalStateHelper;
5758
struct HardwareInfo;
5859
class OsContext;
5960
class MemoryOperationsHandler;
@@ -62,6 +63,7 @@ struct DirectSubmissionInputParams : NonCopyableClass {
6263
DirectSubmissionInputParams(const CommandStreamReceiver &commandStreamReceiver);
6364
OsContext &osContext;
6465
const RootDeviceEnvironment &rootDeviceEnvironment;
66+
LogicalStateHelper *logicalStateHelper = nullptr;
6567
MemoryManager *memoryManager = nullptr;
6668
const GraphicsAllocation *globalFenceAllocation = nullptr;
6769
GraphicsAllocation *workPartitionAllocation = nullptr;
@@ -170,6 +172,7 @@ class DirectSubmissionHw {
170172
OsContext &osContext;
171173
const uint32_t rootDeviceIndex;
172174
MemoryManager *memoryManager = nullptr;
175+
LogicalStateHelper *logicalStateHelper = nullptr;
173176
MemoryOperationsHandler *memoryOperationHandler = nullptr;
174177
const HardwareInfo *hwInfo = nullptr;
175178
const GraphicsAllocation *globalFenceAllocation = nullptr;

shared/source/direct_submission/direct_submission_hw.inl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "shared/source/direct_submission/direct_submission_hw.h"
1414
#include "shared/source/direct_submission/direct_submission_hw_diagnostic_mode.h"
1515
#include "shared/source/helpers/flush_stamp.h"
16+
#include "shared/source/helpers/logical_state_helper.h"
1617
#include "shared/source/helpers/ptr_math.h"
1718
#include "shared/source/memory_manager/allocation_properties.h"
1819
#include "shared/source/memory_manager/graphics_allocation.h"
@@ -34,6 +35,7 @@ DirectSubmissionHw<GfxFamily, Dispatcher>::DirectSubmissionHw(const DirectSubmis
3435
: ringBuffers(RingBufferUse::initialRingBufferCount), osContext(inputParams.osContext), rootDeviceIndex(inputParams.rootDeviceIndex) {
3536
memoryManager = inputParams.memoryManager;
3637
globalFenceAllocation = inputParams.globalFenceAllocation;
38+
logicalStateHelper = inputParams.logicalStateHelper;
3739
hwInfo = inputParams.rootDeviceEnvironment.getHardwareInfo();
3840
memoryOperationHandler = inputParams.rootDeviceEnvironment.memoryOperationsInterface.get();
3941

@@ -642,7 +644,11 @@ size_t DirectSubmissionHw<GfxFamily, Dispatcher>::getDiagnosticModeSection() {
642644
template <typename GfxFamily, typename Dispatcher>
643645
void DirectSubmissionHw<GfxFamily, Dispatcher>::dispatchSystemMemoryFenceAddress() {
644646
UNRECOVERABLE_IF(!this->globalFenceAllocation);
645-
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation);
647+
EncodeMemoryFence<GfxFamily>::encodeSystemMemoryFence(ringCommandStream, this->globalFenceAllocation, this->logicalStateHelper);
648+
649+
if (logicalStateHelper) {
650+
logicalStateHelper->writeStreamInline(ringCommandStream);
651+
}
646652
}
647653

648654
template <typename GfxFamily, typename Dispatcher>

shared/source/xe_hpc_core/command_stream_receiver_hw_xe_hpc_core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ template <>
3434
void CommandStreamReceiverHw<Family>::programEnginePrologue(LinearStream &csr) {
3535
if (!this->isEnginePrologueSent) {
3636
if (globalFenceAllocation) {
37-
EncodeMemoryFence<Family>::encodeSystemMemoryFence(csr, globalFenceAllocation);
37+
EncodeMemoryFence<Family>::encodeSystemMemoryFence(csr, globalFenceAllocation, nullptr);
3838
}
3939
this->isEnginePrologueSent = true;
4040
}

shared/test/unit_test/encoders/test_command_encoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ HWTEST_F(CommandEncoderTest, givenPlatformSupportingMiMemFenceWhenEncodingThenPr
154154

155155
size_t size = EncodeMemoryFence<FamilyType>::getSystemMemoryFenceSize();
156156

157-
EncodeMemoryFence<FamilyType>::encodeSystemMemoryFence(cmdStream, &allocation);
157+
EncodeMemoryFence<FamilyType>::encodeSystemMemoryFence(cmdStream, &allocation, nullptr);
158158

159159
if constexpr (FamilyType::isUsingMiMemFence) {
160160
using STATE_SYSTEM_MEM_FENCE_ADDRESS = typename FamilyType::STATE_SYSTEM_MEM_FENCE_ADDRESS;

0 commit comments

Comments
 (0)