Move noop programming to dedicated encoder

Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:
Zbigniew Zdanowicz
2021-11-17 22:36:00 +00:00
committed by Compute-Runtime-Automation
parent 6d8502847e
commit 76b8f6296f
15 changed files with 115 additions and 80 deletions

View File

@@ -93,4 +93,36 @@ HWTEST_F(EncodeBatchBufferStartOrEndTest, givenGpuAddressWhenEncodeBBStartThenAd
auto cmd = genCmdCast<MI_BATCH_BUFFER_START *>(*itor);
EXPECT_EQ(gpuAddress, cmd->getBatchBufferStartAddressGraphicsaddress472());
}
}
}
using EncodeNoopTest = Test<DeviceFixture>;
HWTEST_F(EncodeNoopTest, WhenAligningLinearStreamToCacheLineSizeThenItIsAlignedCorrectly) {
CommandContainer cmdContainer;
cmdContainer.initialize(pDevice);
auto commandStream = cmdContainer.getCommandStream();
EncodeNoop<FamilyType>::alignToCacheLine(*commandStream);
EXPECT_EQ(0u, commandStream->getUsed() % MemoryConstants::cacheLineSize);
commandStream->getSpace(4);
EncodeNoop<FamilyType>::alignToCacheLine(*commandStream);
EXPECT_EQ(0u, commandStream->getUsed() % MemoryConstants::cacheLineSize);
}
HWTEST_F(EncodeNoopTest, WhenEmittingNoopsThenExpectCorrectNumberOfBytesNooped) {
CommandContainer cmdContainer;
cmdContainer.initialize(pDevice);
auto commandStream = cmdContainer.getCommandStream();
size_t usedBefore = commandStream->getUsed();
EncodeNoop<FamilyType>::emitNoop(*commandStream, 0);
size_t usedAfter = commandStream->getUsed();
EXPECT_EQ(usedBefore, usedAfter);
size_t noopingSize = 4;
EncodeNoop<FamilyType>::emitNoop(*commandStream, noopingSize);
usedAfter = commandStream->getUsed();
EXPECT_EQ(noopingSize, (usedAfter - usedBefore));
}