Improve PIPE_CONTROL programming

Change-Id: Id21fe4d08fdfc19921051beb8f9a66737fefc2f3
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-07-11 14:35:40 +02:00
committed by sys_ocldev
parent 91b56260b0
commit 42604b8645
16 changed files with 98 additions and 82 deletions

2
Jenkinsfile vendored
View File

@ -1,5 +1,5 @@
#!groovy
dependenciesRevision='752539c0bf9f26785a1a99ebbb7be67263262272-1280'
strategy='EQUAL'
allowedCD=265
allowedCD=264
allowedF=5

View File

@ -111,7 +111,9 @@ void GpgpuWalkerHelper<GfxFamily>::dispatchProfilingCommandsStart(
// PIPE_CONTROL for global timestamp
uint64_t timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, GlobalStartTS);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(commandStream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, timeStampAddress, 0llu, false);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(*commandStream,
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP,
timeStampAddress, 0llu, false);
//MI_STORE_REGISTER_MEM for context local timestamp
timeStampAddress = hwTimeStamps.getGpuAddress() + offsetof(HwTimeStamps, ContextStartTS);

View File

@ -175,7 +175,8 @@ void GpgpuWalkerHelper<GfxFamily>::setupTimestampPacket(
if (TimestampPacketStorage::WriteOperationType::AfterWalker == writeOperationType) {
uint64_t address = timestampPacketNode->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(cmdStream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, 0, false);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(*cmdStream,
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, 0, false);
}
}

View File

@ -168,22 +168,10 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
currentPipeControlForNooping = epiloguePipeControlLocation;
}
//Some architectures (SKL) requires to have pipe control prior to pipe control with tag write, add it here
PipeControlHelper<GfxFamily>::addPipeControlWA(commandStreamTask);
auto address = getTagAllocation()->getGpuAddress();
auto pCmd = PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(&commandStreamTask, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, taskCount + 1, dispatchFlags.dcFlush);
if (DebugManager.flags.FlushAllCaches.get()) {
pCmd->setDcFlushEnable(true);
pCmd->setRenderTargetCacheFlushEnable(true);
pCmd->setInstructionCacheInvalidateEnable(true);
pCmd->setTextureCacheInvalidationEnable(true);
pCmd->setPipeControlFlushEnable(true);
pCmd->setVfCacheInvalidationEnable(true);
pCmd->setConstantCacheInvalidationEnable(true);
pCmd->setStateCacheInvalidationEnable(true);
}
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(commandStreamTask,
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
address, taskCount + 1, dispatchFlags.dcFlush);
this->latestSentTaskCount = taskCount + 1;
DBG_LOG(LogTaskCounts, __FUNCTION__, "Line: ", __LINE__, "taskCount", taskCount);
@ -493,7 +481,7 @@ inline void CommandStreamReceiverHw<GfxFamily>::flushBatchedSubmissions() {
ResidencyContainer surfacesForSubmit;
ResourcePackage resourcePackage;
auto pipeControlLocationSize = PipeControlHelper<GfxFamily>::getRequiredPipeControlSize();
auto pipeControlLocationSize = PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation();
void *currentPipeControlForNooping = nullptr;
void *epiloguePipeControlLocation = nullptr;
@ -582,7 +570,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>::getSizeForSinglePipeControl();
size += sizeof(typename GfxFamily::MI_BATCH_BUFFER_START);
size += getCmdSizeForL3Config();

View File

@ -62,21 +62,18 @@ template <typename GfxFamily>
size_t ExperimentalCommandBuffer::getTimeStampPipeControlSize() noexcept {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
//two P_C for timestamps, two prior them for WA - Enable CS Stall
return 4 * sizeof(PIPE_CONTROL);
// Two P_C for timestamps
return 2 * PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation();
}
template <typename GfxFamily>
void ExperimentalCommandBuffer::addTimeStampPipeControl() {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
auto pCmd = currentStream->getSpaceForCmd<PIPE_CONTROL>();
*pCmd = GfxFamily::cmdInitPipeControl;
pCmd->setCommandStreamerStallEnable(true);
uint64_t timeStampAddress = timestamps->getGpuAddress() + timestampsOffset;
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(currentStream.get(), PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, timeStampAddress, 0llu, false);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(*currentStream,
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, timeStampAddress, 0llu, false);
//moving to next chunk
timestampsOffset += sizeof(uint64_t);

View File

@ -123,15 +123,15 @@ void DeviceQueueHw<GfxFamily>::addExecutionModelCleanUpSection(Kernel *parentKer
uint64_t criticalSectionAddress = (uint64_t)&igilQueue->m_controls.m_CriticalSection;
addPipeControlCmdWa();
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(&slbCS, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, criticalSectionAddress, ExecutionModelCriticalSection::Free, false);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(slbCS,
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
criticalSectionAddress, ExecutionModelCriticalSection::Free, false);
uint64_t tagAddress = reinterpret_cast<uint64_t>(device->getDefaultEngine().commandStreamReceiver->getTagAddress());
addPipeControlCmdWa();
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(&slbCS, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, tagAddress, taskCount, false);
PipeControlHelper<GfxFamily>::obtainPipeControlAndProgramPostSyncOperation(slbCS,
PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA,
tagAddress, taskCount, false);
addMediaStateClearCmds();

View File

@ -27,9 +27,8 @@ 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);
typename Family::PIPE_CONTROL *PipeControlHelper<Family>::addPipeControl(LinearStream &commandStream, bool dcFlush) {
return PipeControlHelper<Family>::obtainPipeControl(commandStream, true);
}
template class AubHelperHw<Family>;

View File

@ -192,15 +192,18 @@ template <typename GfxFamily>
struct PipeControlHelper {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;
using POST_SYNC_OPERATION = typename GfxFamily::PIPE_CONTROL::POST_SYNC_OPERATION;
static PIPE_CONTROL *obtainPipeControlAndProgramPostSyncOperation(LinearStream *commandStream,
static PIPE_CONTROL *obtainPipeControlAndProgramPostSyncOperation(LinearStream &commandStream,
POST_SYNC_OPERATION operation,
uint64_t gpuAddress,
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 size_t getSizeForPipeControlWithPostSyncOperation();
static size_t getSizeForSinglePipeControl();
protected:
static PIPE_CONTROL *obtainPipeControl(LinearStream &commandStream, bool dcFlush);
};
union SURFACE_STATE_BUFFER_LENGTH {

View File

@ -149,14 +149,14 @@ bool HwHelperHw<Family>::getEnableLocalMemory(const HardwareInfo &hwInfo) const
}
template <typename Family>
typename Family::PIPE_CONTROL *PipeControlHelper<Family>::obtainPipeControlAndProgramPostSyncOperation(LinearStream *commandStream,
typename Family::PIPE_CONTROL *PipeControlHelper<Family>::obtainPipeControlAndProgramPostSyncOperation(LinearStream &commandStream,
POST_SYNC_OPERATION operation,
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);
addPipeControlWA(commandStream);
auto pipeControl = obtainPipeControl(commandStream, dcFlush);
pipeControl->setPostSyncOperation(operation);
pipeControl->setAddress(static_cast<uint32_t>(gpuAddress & 0x0000FFFFFFFFULL));
pipeControl->setAddressHigh(static_cast<uint32_t>(gpuAddress >> 32));
@ -168,9 +168,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>::obtainPipeControl(LinearStream &commandStream, bool dcFlush) {
auto pCmd = reinterpret_cast<PIPE_CONTROL *>(commandStream.getSpace(sizeof(PIPE_CONTROL)));
*pCmd = GfxFamily::cmdInitPipeControl;
pCmd->setCommandStreamerStallEnable(true);
@ -194,14 +192,19 @@ void PipeControlHelper<GfxFamily>::addPipeControlWA(LinearStream &commandStream)
}
template <typename GfxFamily>
void PipeControlHelper<GfxFamily>::addPipeControl(LinearStream &commandStream, bool dcFlush) {
PipeControlHelper<GfxFamily>::addPipeControlBase(commandStream, dcFlush);
typename GfxFamily::PIPE_CONTROL *PipeControlHelper<GfxFamily>::addPipeControl(LinearStream &commandStream, bool dcFlush) {
return PipeControlHelper<GfxFamily>::obtainPipeControl(commandStream, dcFlush);
}
template <typename GfxFamily>
int PipeControlHelper<GfxFamily>::getRequiredPipeControlSize() {
size_t PipeControlHelper<GfxFamily>::getSizeForSinglePipeControl() {
return sizeof(typename GfxFamily::PIPE_CONTROL);
}
template <typename GfxFamily>
size_t PipeControlHelper<GfxFamily>::getSizeForPipeControlWithPostSyncOperation() {
const auto pipeControlCount = HardwareCommandsHelper<GfxFamily>::isPipeControlWArequired() ? 2u : 1u;
return pipeControlCount * sizeof(typename GfxFamily::PIPE_CONTROL);
return pipeControlCount * getSizeForSinglePipeControl();
}
template <typename GfxFamily>

View File

@ -1368,6 +1368,9 @@ HWTEST_P(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenT
if (checkForStart) {
auto itorPipeCtrl = find<typename FamilyType::PIPE_CONTROL *>(cmdList.begin(), cmdList.end());
ASSERT_NE(cmdList.end(), itorPipeCtrl);
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
itorPipeCtrl++;
}
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*itorPipeCtrl);
ASSERT_NE(nullptr, pipeControl);
@ -1377,6 +1380,9 @@ HWTEST_P(ProfilingCommandsTest, givenKernelWhenProfilingCommandStartIsTakenThenT
itorPipeCtrl++;
itorPipeCtrl = find<typename FamilyType::PIPE_CONTROL *>(itorPipeCtrl, cmdList.end());
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
itorPipeCtrl++;
}
ASSERT_NE(cmdList.end(), itorPipeCtrl);
pipeControl = genCmdCast<PIPE_CONTROL *>(*itorPipeCtrl);
ASSERT_NE(nullptr, pipeControl);

View File

@ -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>::getSizeForSinglePipeControl();
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>::getSizeForPipeControlWithPostSyncOperation() / sizeof(PIPE_CONTROL);
auto &commandStreamTask = commandQueue.getCS(1024);

View File

@ -1466,10 +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);
auto pipeControlOffset = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u;
auto pipeControlAddress = buffer.get() + pipeControlOffset;
auto pipeControl = genCmdCast<PIPE_CONTROL *>(pipeControlAddress);
auto pipeControl = PipeControlHelper<FamilyType>::addPipeControl(commandStream, true);
EXPECT_TRUE(pipeControl->getDcFlushEnable());
EXPECT_TRUE(pipeControl->getCommandStreamerStallEnable());
@ -1480,10 +1477,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);
auto pipeControlOffset = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u;
auto pipeControlAddress = buffer.get() + pipeControlOffset;
auto pipeControl = genCmdCast<PIPE_CONTROL *>(pipeControlAddress);
auto pipeControl = PipeControlHelper<FamilyType>::addPipeControl(commandStream, false);
const bool expectedDcFlush = ::renderCoreFamily == IGFX_GEN8_CORE;
EXPECT_EQ(expectedDcFlush, pipeControl->getDcFlushEnable());

View File

@ -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 = 4 * PipeControlHelper<FamilyType>::getSizeForPipeControlWithPostSyncOperation() / 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);

View File

@ -5,6 +5,7 @@
*
*/
#include "runtime/helpers/hardware_commands_helper.h"
#include "runtime/memory_manager/internal_allocation_storage.h"
#include "runtime/memory_manager/memory_constants.h"
#include "runtime/memory_manager/memory_manager.h"
@ -88,17 +89,20 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
hwParserExCmdBuffer.parseCommands<FamilyType>(*mockExCmdBuffer->currentStream, 0);
it = hwParserExCmdBuffer.cmdList.begin();
GenCmdList::iterator end = hwParserExCmdBuffer.cmdList.end();
//1st PIPE_CONTROL with CS Stall
ASSERT_NE(end, it);
pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
ASSERT_NE(nullptr, pipeControl);
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
//1st PIPE_CONTROL with CS Stall
ASSERT_NE(end, it);
pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
ASSERT_NE(nullptr, pipeControl);
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
it++;
}
//2nd PIPE_CONTROL with ts addr
uint64_t timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress();
uint32_t expectedTsAddress = static_cast<uint32_t>(timeStampAddress & 0x0000FFFFFFFFULL);
uint32_t expectedTsAddressHigh = static_cast<uint32_t>(timeStampAddress >> 32);
it++;
ASSERT_NE(end, it);
pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
ASSERT_NE(nullptr, pipeControl);
@ -116,12 +120,14 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
EXPECT_EQ(exAllocationGpuAddr, semaphoreCmd->getSemaphoreGraphicsAddress());
EXPECT_EQ(MI_SEMAPHORE_WAIT::COMPARE_OPERATION_SAD_EQUAL_SDD, semaphoreCmd->getCompareOperation());
//3rd PIPE_CONTROL with CS stall
it++;
ASSERT_NE(end, it);
pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
ASSERT_NE(nullptr, pipeControl);
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
//3rd PIPE_CONTROL with CS stall
it++;
ASSERT_NE(end, it);
pipeControl = genCmdCast<PIPE_CONTROL *>(*it);
ASSERT_NE(nullptr, pipeControl);
EXPECT_EQ(1u, pipeControl->getCommandStreamerStallEnable());
}
//4th PIPE_CONTROL with ts addr
timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress() + sizeof(uint64_t);
@ -212,8 +218,10 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
hwParserExCmdBuffer.parseCommands<FamilyType>(*mockExCmdBuffer->currentStream, cmbBufferOffset);
it = hwParserExCmdBuffer.cmdList.begin();
GenCmdList::iterator end = hwParserExCmdBuffer.cmdList.end();
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
it++;
}
//2nd PIPE_CONTROL
it++;
uint64_t timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress() + 2 * sizeof(uint64_t);
uint32_t expectedTsAddress = static_cast<uint32_t>(timeStampAddress & 0x0000FFFFFFFFULL);
uint32_t expectedTsAddressHigh = static_cast<uint32_t>(timeStampAddress >> 32);
@ -225,7 +233,9 @@ HWTEST_F(MockExperimentalCommandBufferTest, givenEnabledExperimentalCmdBufferWhe
EXPECT_EQ(expectedTsAddress, pipeControl->getAddress());
EXPECT_EQ(expectedTsAddressHigh, pipeControl->getAddressHigh());
//omit SEMAPHORE_WAIT and 3rd PIPE_CONTROL
it++;
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
it++;
}
it++;
//get 4th PIPE_CONTROL
timeStampAddress = mockExCmdBuffer->timestamps->getGpuAddress() + 3 * sizeof(uint64_t);

View File

@ -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"
@ -196,10 +197,11 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteTimestampModeWhenHelperIsUsed
expectedPipeControl.setAddress(static_cast<uint32_t>(address & 0x0000FFFFFFFFULL));
expectedPipeControl.setAddressHigh(static_cast<uint32_t>(address >> 32));
auto pipeControl = PipeControlHelper<FamilyType>::obtainPipeControlAndProgramPostSyncOperation(&stream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, address, immediateData, false);
auto pipeControl = PipeControlHelper<FamilyType>::obtainPipeControlAndProgramPostSyncOperation(stream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_TIMESTAMP, address, immediateData, false);
auto additionalPcSize = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u;
EXPECT_EQ(sizeof(PIPE_CONTROL), stream.getUsed());
EXPECT_EQ(pipeControl, stream.getCpuBase());
EXPECT_EQ(sizeof(PIPE_CONTROL) + additionalPcSize, stream.getUsed());
EXPECT_EQ(pipeControl, ptrOffset(stream.getCpuBase(), additionalPcSize));
EXPECT_TRUE(memcmp(pipeControl, &expectedPipeControl, sizeof(PIPE_CONTROL)) == 0);
}
@ -218,10 +220,12 @@ HWTEST_F(PipeControlHelperTests, givenPostSyncWriteImmediateDataModeWhenHelperIs
expectedPipeControl.setAddressHigh(static_cast<uint32_t>(address >> 32));
expectedPipeControl.setImmediateData(immediateData);
auto pipeControl = PipeControlHelper<FamilyType>::obtainPipeControlAndProgramPostSyncOperation(&stream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, immediateData, false);
auto pipeControl = PipeControlHelper<FamilyType>::obtainPipeControlAndProgramPostSyncOperation(stream, PIPE_CONTROL::POST_SYNC_OPERATION_WRITE_IMMEDIATE_DATA, address, immediateData, false);
EXPECT_EQ(sizeof(PIPE_CONTROL), stream.getUsed());
EXPECT_EQ(pipeControl, stream.getCpuBase());
auto additionalPcSize = HardwareCommandsHelper<FamilyType>::isPipeControlWArequired() ? sizeof(PIPE_CONTROL) : 0u;
EXPECT_EQ(sizeof(PIPE_CONTROL) + additionalPcSize, stream.getUsed());
EXPECT_EQ(pipeControl, ptrOffset(stream.getCpuBase(), additionalPcSize));
EXPECT_TRUE(memcmp(pipeControl, &expectedPipeControl, sizeof(PIPE_CONTROL)) == 0);
}

View File

@ -398,6 +398,10 @@ HWCMDTEST_F(IGFX_GEN8_CORE, TimestampPacketTests, givenTimestampPacketWhenDispat
uint32_t walkersFound = 0;
for (auto it = hwParser.cmdList.begin(); it != hwParser.cmdList.end(); it++) {
if (genCmdCast<GPGPU_WALKER *>(*it)) {
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*++it);
EXPECT_NE(nullptr, pipeControl);
}
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*++it);
EXPECT_NE(nullptr, pipeControl);
auto expectedAddress = timestampPacket.getNode(walkersFound)->getGpuAddress() + offsetof(TimestampPacketStorage, packets[0].contextEnd);
@ -503,6 +507,10 @@ HWTEST_F(TimestampPacketTests, givenTimestampPacketWriteEnabledWhenEnqueueingThe
bool walkerFound = false;
for (auto it = hwParser.cmdList.begin(); it != hwParser.cmdList.end(); it++) {
if (genCmdCast<GPGPU_WALKER *>(*it)) {
if (HardwareCommandsHelper<FamilyType>::isPipeControlWArequired()) {
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*++it);
EXPECT_NE(nullptr, pipeControl);
}
walkerFound = true;
auto pipeControl = genCmdCast<PIPE_CONTROL *>(*++it);
ASSERT_NE(nullptr, pipeControl);