Improve PipeControlHelper

Change-Id: I8d553ec82026399225e452529044a0470afe7963
Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com>
This commit is contained in:
Dunajski, Bartosz
2019-07-10 11:21:16 +02:00
committed by sys_ocldev
parent 8a3f215dff
commit 878928caee
10 changed files with 42 additions and 28 deletions

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>::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);

View File

@@ -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);

View File

@@ -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);

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 = 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);

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"
@@ -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]);