mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-31 12:11:31 +08:00
Improve PipeControlHelper
Change-Id: I8d553ec82026399225e452529044a0470afe7963 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
8a3f215dff
commit
878928caee
@@ -65,7 +65,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
||||
using MI_BATCH_BUFFER_START = typename GfxFamily::MI_BATCH_BUFFER_START;
|
||||
|
||||
bool dcFlush = false;
|
||||
PipeControlHelper<GfxFamily>::addPipeControl(commandStream, dcFlush);
|
||||
PipeControlHelper<GfxFamily>::addPipeControlWithWA(commandStream, dcFlush);
|
||||
|
||||
uint32_t interfaceDescriptorIndex = devQueueHw.schedulerIDIndex;
|
||||
const size_t offsetInterfaceDescriptorTable = devQueueHw.colorCalcStateSize;
|
||||
@@ -155,7 +155,7 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchScheduler(
|
||||
// Do not put BB_START only when returning in first Scheduler run
|
||||
if (devQueueHw.getSchedulerReturnInstance() != 1) {
|
||||
|
||||
PipeControlHelper<GfxFamily>::addPipeControl(commandStream, true);
|
||||
PipeControlHelper<GfxFamily>::addPipeControlWithWA(commandStream, true);
|
||||
|
||||
// Add BB Start Cmd to the SLB in the Primary Batch Buffer
|
||||
auto *bbStart = static_cast<MI_BATCH_BUFFER_START *>(commandStream.getSpace(sizeof(MI_BATCH_BUFFER_START)));
|
||||
|
||||
@@ -348,7 +348,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
|
||||
// Add a PC if we have a dependency on a previous walker to avoid concurrency issues.
|
||||
if (taskLevel > this->taskLevel) {
|
||||
if (!timestampPacketWriteEnabled) {
|
||||
PipeControlHelper<GfxFamily>::addPipeControl(commandStreamCSR, false);
|
||||
PipeControlHelper<GfxFamily>::addPipeControlWithWA(commandStreamCSR, false);
|
||||
}
|
||||
this->taskLevel = taskLevel;
|
||||
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "this->taskCount", this->taskCount);
|
||||
@@ -493,7 +493,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
|
||||
|
||||
ResidencyContainer surfacesForSubmit;
|
||||
ResourcePackage resourcePackage;
|
||||
auto pipeControlLocationSize = PipeControlHelper<GfxFamily>::getRequiredPipeControlSize();
|
||||
auto pipeControlLocationSize = PipeControlHelper<GfxFamily>::getRequiredPipeControlSize(true);
|
||||
void *currentPipeControlForNooping = nullptr;
|
||||
void *epiloguePipeControlLocation = nullptr;
|
||||
|
||||
@@ -582,7 +582,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredCmdStreamSize(const Dispat
|
||||
if (!this->isStateSipSent || device.isSourceLevelDebuggerActive()) {
|
||||
size += PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(device);
|
||||
}
|
||||
size += PipeControlHelper<GfxFamily>::getRequiredPipeControlSize();
|
||||
size += PipeControlHelper<GfxFamily>::getRequiredPipeControlSize(true);
|
||||
size += sizeof(typename GfxFamily::MI_BATCH_BUFFER_START);
|
||||
|
||||
size += getCmdSizeForL3Config();
|
||||
|
||||
@@ -27,9 +27,9 @@ void HwHelperHw<Family>::setupHardwareCapabilities(HardwareCapabilities *caps, c
|
||||
}
|
||||
|
||||
template <>
|
||||
void PipeControlHelper<Family>::addPipeControl(LinearStream &commandStream, bool dcFlush) {
|
||||
auto pCmd = PipeControlHelper<Family>::addPipeControlBase(commandStream, dcFlush);
|
||||
pCmd->setDcFlushEnable(true);
|
||||
void PipeControlHelper<Family>::addPipeControlWithWA(LinearStream &commandStream, bool dcFlush) {
|
||||
PipeControlHelper<Family>::addPipeControlWA(commandStream);
|
||||
PipeControlHelper<Family>::addPipeControl(commandStream, true);
|
||||
}
|
||||
|
||||
template class AubHelperHw<Family>;
|
||||
|
||||
@@ -198,9 +198,9 @@ struct PipeControlHelper {
|
||||
uint64_t immediateData,
|
||||
bool dcFlush);
|
||||
static void addPipeControlWA(LinearStream &commandStream);
|
||||
static PIPE_CONTROL *addPipeControlBase(LinearStream &commandStream, bool dcFlush);
|
||||
static void addPipeControl(LinearStream &commandStream, bool dcFlush);
|
||||
static int getRequiredPipeControlSize();
|
||||
static PIPE_CONTROL *addPipeControl(LinearStream &commandStream, bool dcFlush);
|
||||
static void addPipeControlWithWA(LinearStream &commandStream, bool dcFlush);
|
||||
static size_t getRequiredPipeControlSize(bool withWA);
|
||||
};
|
||||
|
||||
union SURFACE_STATE_BUFFER_LENGTH {
|
||||
|
||||
@@ -154,13 +154,11 @@ typename Family::PIPE_CONTROL *PipeControlHelper<Family>::obtainPipeControlAndPr
|
||||
uint64_t gpuAddress,
|
||||
uint64_t immediateData,
|
||||
bool dcFlush) {
|
||||
auto pipeControl = reinterpret_cast<PIPE_CONTROL *>(commandStream->getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pipeControl = Family::cmdInitPipeControl;
|
||||
pipeControl->setCommandStreamerStallEnable(true);
|
||||
auto pipeControl = addPipeControl(*commandStream, dcFlush);
|
||||
|
||||
pipeControl->setPostSyncOperation(operation);
|
||||
pipeControl->setAddress(static_cast<uint32_t>(gpuAddress & 0x0000FFFFFFFFULL));
|
||||
pipeControl->setAddressHigh(static_cast<uint32_t>(gpuAddress >> 32));
|
||||
pipeControl->setDcFlushEnable(dcFlush);
|
||||
if (operation == POST_SYNC_OPERATION::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA) {
|
||||
pipeControl->setImmediateData(immediateData);
|
||||
}
|
||||
@@ -168,9 +166,7 @@ typename Family::PIPE_CONTROL *PipeControlHelper<Family>::obtainPipeControlAndPr
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
typename GfxFamily::PIPE_CONTROL *PipeControlHelper<GfxFamily>::addPipeControlBase(LinearStream &commandStream, bool dcFlush) {
|
||||
PipeControlHelper<GfxFamily>::addPipeControlWA(commandStream);
|
||||
|
||||
typename GfxFamily::PIPE_CONTROL *PipeControlHelper<GfxFamily>::addPipeControl(LinearStream &commandStream, bool dcFlush) {
|
||||
auto pCmd = reinterpret_cast<PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));
|
||||
*pCmd = GfxFamily::cmdInitPipeControl;
|
||||
pCmd->setCommandStreamerStallEnable(true);
|
||||
@@ -194,13 +190,14 @@ void PipeControlHelper<GfxFamily>::addPipeControlWA(LinearStream &commandStream)
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
void PipeControlHelper<GfxFamily>::addPipeControl(LinearStream &commandStream, bool dcFlush) {
|
||||
PipeControlHelper<GfxFamily>::addPipeControlBase(commandStream, dcFlush);
|
||||
void PipeControlHelper<GfxFamily>::addPipeControlWithWA(LinearStream &commandStream, bool dcFlush) {
|
||||
PipeControlHelper<GfxFamily>::addPipeControlWA(commandStream);
|
||||
PipeControlHelper<GfxFamily>::addPipeControl(commandStream, dcFlush);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
int PipeControlHelper<GfxFamily>::getRequiredPipeControlSize() {
|
||||
const auto pipeControlCount = HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired() ? 2u : 1u;
|
||||
size_t PipeControlHelper<GfxFamily>::getRequiredPipeControlSize(bool withWA) {
|
||||
const auto pipeControlCount = (withWA && HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired()) ? 2u : 1u;
|
||||
return pipeControlCount * sizeof(typename GfxFamily::PIPE_CONTROL);
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCsrInBatchingModeWhenTaskIsSu
|
||||
|
||||
//we do level change that will emit PPC, fill all the space so only BB end fits.
|
||||
taskLevel++;
|
||||
auto ppcSize = PipeControlHelper<FamilyType>::getRequiredPipeControlSize();
|
||||
auto ppcSize = PipeControlHelper<FamilyType>::getRequiredPipeControlSize(true);
|
||||
auto fillSize = MemoryConstants::cacheLineSize - ppcSize - sizeof(typename FamilyType::MI_BATCH_BUFFER_END);
|
||||
csrCommandStream.getSpace(fillSize);
|
||||
auto expectedUsedSize = 2 * MemoryConstants::cacheLineSize;
|
||||
@@ -928,7 +928,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, FlushTaskBlockingHasPipeControlWit
|
||||
|
||||
auto &commandStreamReceiver = commandQueue.getCommandStreamReceiver();
|
||||
|
||||
size_t pipeControlCount = PipeControlHelper<FamilyType>::getRequiredPipeControlSize() / sizeof(PIPE_CONTROL);
|
||||
size_t pipeControlCount = PipeControlHelper<FamilyType>::getRequiredPipeControlSize(true) / sizeof(PIPE_CONTROL);
|
||||
|
||||
auto &commandStreamTask = commandQueue.getCS(1024);
|
||||
|
||||
|
||||
@@ -754,7 +754,7 @@ HWTEST_F(UltCommandStreamReceiverTest, addPipeControlWithFlushAllCaches) {
|
||||
char buff[sizeof(PIPE_CONTROL) * 3];
|
||||
LinearStream stream(buff, sizeof(PIPE_CONTROL) * 3);
|
||||
|
||||
PipeControlHelper<FamilyType>::addPipeControl(stream, false);
|
||||
PipeControlHelper<FamilyType>::addPipeControlWithWA(stream, false);
|
||||
|
||||
parseCommands<FamilyType>(stream, 0);
|
||||
|
||||
|
||||
@@ -1466,7 +1466,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDcFlushArgumentIsTrueWhenCall
|
||||
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
||||
LinearStream commandStream(buffer.get(), 128);
|
||||
|
||||
PipeControlHelper<FamilyType>::addPipeControl(commandStream, true);
|
||||
PipeControlHelper<FamilyType>::addPipeControlWithWA(commandStream, true);
|
||||
auto pipeControlOffset = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u;
|
||||
auto pipeControlAddress = buffer.get() + pipeControlOffset;
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(pipeControlAddress);
|
||||
@@ -1480,7 +1480,7 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenDcFlushArgumentIsFalseWhenCal
|
||||
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
||||
LinearStream commandStream(buffer.get(), 128);
|
||||
|
||||
PipeControlHelper<FamilyType>::addPipeControl(commandStream, false);
|
||||
PipeControlHelper<FamilyType>::addPipeControlWithWA(commandStream, false);
|
||||
auto pipeControlOffset = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u;
|
||||
auto pipeControlAddress = buffer.get() + pipeControlOffset;
|
||||
auto pipeControl = genCmdCast<PIPE_CONTROL *>(pipeControlAddress);
|
||||
|
||||
@@ -75,7 +75,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskGmockTests, givenCsrInBatchingModeThreeRe
|
||||
dispatchFlags.outOfOrderExecutionAllowed = true;
|
||||
|
||||
EXPECT_CALL(*mockHelper, setPatchInfoData(::testing::_)).Times(10);
|
||||
EXPECT_CALL(*mockHelper, removePatchInfoData(::testing::_)).Times(4 * PipeControlHelper<FamilyType>::getRequiredPipeControlSize() / sizeof(PIPE_CONTROL));
|
||||
size_t removePatchInfoDataCount = 4u * PipeControlHelper<FamilyType>::getRequiredPipeControlSize(true) / sizeof(PIPE_CONTROL);
|
||||
EXPECT_CALL(*mockHelper, removePatchInfoData(::testing::_)).Times(static_cast<int>(removePatchInfoDataCount));
|
||||
EXPECT_CALL(*mockHelper, registerCommandChunk(::testing::_)).Times(4);
|
||||
EXPECT_CALL(*mockHelper, registerBatchBufferStartAddress(::testing::_, ::testing::_)).Times(3);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "runtime/gmm_helper/gmm_helper.h"
|
||||
#include "runtime/gmm_helper/resource_info.h"
|
||||
#include "runtime/helpers/aligned_memory.h"
|
||||
#include "runtime/helpers/hardware_commands_helper.h"
|
||||
#include "runtime/helpers/options.h"
|
||||
#include "runtime/helpers/string.h"
|
||||
#include "runtime/memory_manager/graphics_allocation.h"
|
||||
@@ -203,6 +204,21 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteTimestampModeWhenHelperIsUsed
|
||||
EXPECT_TRUE(memcmp(pipeControl, &expectedPipeControl, sizeof(PIPE_CONTROL)) == 0);
|
||||
}
|
||||
|
||||
HWTEST_F(PipeControlHelperTests, whenQueryingPipeControlSizeWithoutWaThenReturnSinglePipeControlSize) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
auto size = PipeControlHelper<FamilyType>::getRequiredPipeControlSize(false);
|
||||
EXPECT_EQ(sizeof(PIPE_CONTROL), size);
|
||||
}
|
||||
|
||||
HWTEST_F(PipeControlHelperTests, whenQueryingPipeControlSizeWithWaThenReturnValidPipeControlSize) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
|
||||
auto size = PipeControlHelper<FamilyType>::getRequiredPipeControlSize(true);
|
||||
size_t pipeControlsCount = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? 2 : 1;
|
||||
|
||||
EXPECT_EQ(sizeof(PIPE_CONTROL) * pipeControlsCount, size);
|
||||
}
|
||||
|
||||
HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIsUsedThenProperFieldsAreProgrammed) {
|
||||
using PIPE_CONTROL = typename FamilyType::PIPE_CONTROL;
|
||||
std::unique_ptr<uint8_t> buffer(new uint8_t[128]);
|
||||
|
||||
Reference in New Issue
Block a user