test: add getInlineDataSize helper function

Related-To: NEO-10641
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk 2024-08-13 16:14:56 +00:00 committed by Compute-Runtime-Automation
parent 1317aa539b
commit b063c3c62b
3 changed files with 14 additions and 6 deletions

View File

@ -956,7 +956,9 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenPassInlin
kd.kernelAttributes.flags.passInlineData = true;
kd.kernelAttributes.numLocalIdChannels = 0;
kernel->mockKernel->setCrossThreadData(crossThreadDataTwoGrf, sizeof(INLINE_DATA) * 2);
auto inlineDataSize = UnitTestHelper<FamilyType>::getInlineDataSize(cmdQ->heaplessModeEnabled);
kernel->mockKernel->setCrossThreadData(crossThreadDataTwoGrf, inlineDataSize * 2);
auto memoryManager = device->getUltCommandStreamReceiver<FamilyType>().getMemoryManager();
kernel->kernelInfo.kernelAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{device->getRootDeviceIndex(), MemoryConstants::pageSize});
@ -971,21 +973,21 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, XeHPAndLaterDispatchWalkerBasicTest, givenPassInlin
EXPECT_NE(hwParser.itorWalker, hwParser.cmdList.end());
WalkerVariant walkerVariant = NEO::UnitTestHelper<FamilyType>::getWalkerVariant(*hwParser.itorWalker);
std::visit([crossThreadDataTwoGrf = crossThreadDataTwoGrf, &ih](auto &&walker) {
std::visit([crossThreadDataTwoGrf = crossThreadDataTwoGrf, inlineDataSize, &ih](auto &&walker) {
using WalkerType = std::decay_t<decltype(*walker)>;
EXPECT_EQ(1u, walker->getEmitInlineParameter());
EXPECT_EQ(0u, walker->getGenerateLocalId());
EXPECT_EQ(0u, walker->getEmitLocalId());
EXPECT_EQ(0, memcmp(walker->getInlineDataPointer(), crossThreadDataTwoGrf, sizeof(INLINE_DATA)));
EXPECT_EQ(0, memcmp(walker->getInlineDataPointer(), crossThreadDataTwoGrf, inlineDataSize));
void *payloadData = ih.getCpuBase();
EXPECT_EQ(0, memcmp(payloadData, &crossThreadDataTwoGrf[sizeof(INLINE_DATA) / sizeof(uint32_t)], sizeof(INLINE_DATA)));
EXPECT_EQ(0, memcmp(payloadData, &crossThreadDataTwoGrf[inlineDataSize / sizeof(uint32_t)], inlineDataSize));
if constexpr (std::is_same_v<WalkerType, COMPUTE_WALKER>) {
size_t perThreadTotalDataSize = 0;
// second GRF in indirect
uint32_t expectedIndirectDataLength = static_cast<uint32_t>(perThreadTotalDataSize + sizeof(INLINE_DATA));
uint32_t expectedIndirectDataLength = static_cast<uint32_t>(perThreadTotalDataSize + inlineDataSize);
expectedIndirectDataLength = alignUp(expectedIndirectDataLength, FamilyType::indirectDataAlignment);
EXPECT_EQ(expectedIndirectDataLength, walker->getIndirectDataLength());
}

View File

@ -104,7 +104,7 @@ struct UnitTestHelper {
static GenCmdList::iterator findCsrBaseAddressCommand(GenCmdList::iterator begin, GenCmdList::iterator end);
static std::vector<GenCmdList::iterator> findAllMidThreadPreemptionAllocationCommand(GenCmdList::iterator begin, GenCmdList::iterator end);
static uint32_t getInlineDataSize(bool isHeaplessEnabled);
static bool getDisableFusionStateFromFrontEndCommand(const typename GfxFamily::FrontEndStateCommand &feCmd);
static bool getComputeDispatchAllWalkerFromFrontEndCommand(const typename GfxFamily::FrontEndStateCommand &feCmd);
static bool getSystolicFlagValueFromPipelineSelectCommand(const typename GfxFamily::PIPELINE_SELECT &pipelineSelectCmd);

View File

@ -79,6 +79,12 @@ bool UnitTestHelper<GfxFamily>::expectNullDsh(const DeviceInfo &deviceInfo) {
return true;
}
template <typename GfxFamily>
uint32_t UnitTestHelper<GfxFamily>::getInlineDataSize(bool isHeaplessEnabled) {
using DefaultWalkerType = typename GfxFamily::DefaultWalkerType;
return DefaultWalkerType::getInlineDataSize();
}
template <typename GfxFamily>
bool UnitTestHelper<GfxFamily>::findStateCacheFlushPipeControl(CommandStreamReceiver &csr, LinearStream &csrStream) {
using PIPE_CONTROL = typename GfxFamily::PIPE_CONTROL;