test: adjust copyBuffer ults if heapless enabled

Related-To: NEO-10641
Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2024-08-14 12:57:24 +00:00
committed by Compute-Runtime-Automation
parent 96642b69cc
commit c2be925419
2 changed files with 40 additions and 5 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018-2022 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -80,6 +80,19 @@ struct EnqueueCopyBufferTest : public CommandEnqueueFixture,
parseCommands<FamilyType>(*pCmdQ);
}
int32_t adjustBuiltInType(bool isHeaplessEnabled, int32_t builtInType) {
if (isHeaplessEnabled) {
switch (builtInType) {
case EBuiltInOps::copyBufferToBuffer:
case EBuiltInOps::copyBufferToBufferStateless:
return EBuiltInOps::copyBufferToBufferStatelessHeapless;
}
}
return builtInType;
}
MockContext context;
Buffer *srcBuffer = nullptr;
Buffer *dstBuffer = nullptr;

View File

@@ -7,6 +7,7 @@
#include "shared/source/built_ins/built_ins.h"
#include "shared/source/gen_common/reg_configs_common.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/ptr_math.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/unit_test_helper.h"
@@ -210,9 +211,13 @@ HWTEST_F(EnqueueCopyBufferTest, WhenCopyingBufferThenIndirectDataGetsAdded) {
auto iohBefore = pIOH->getUsed();
auto sshBefore = pSSH->getUsed();
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
auto heaplessEnabled = compilerProductHelper.isHeaplessModeEnabled();
enqueueCopyBuffer();
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer,
auto builtInType = adjustBuiltInType(heaplessEnabled, EBuiltInOps::copyBufferToBuffer);
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(builtInType,
pCmdQ->getClDevice());
ASSERT_NE(nullptr, &builder);
@@ -231,7 +236,17 @@ HWTEST_F(EnqueueCopyBufferTest, WhenCopyingBufferThenIndirectDataGetsAdded) {
auto kernelDescriptor = &kernel->getKernelInfo().kernelDescriptor;
EXPECT_TRUE(UnitTestHelper<FamilyType>::evaluateDshUsage(dshBefore, pDSH->getUsed(), kernelDescriptor, rootDeviceIndex));
EXPECT_NE(iohBefore, pIOH->getUsed());
auto crossThreadDatSize = kernel->getCrossThreadDataSize();
auto inlineDataSize = UnitTestHelper<FamilyType>::getInlineDataSize(heaplessEnabled);
bool crossThreadDataFitsInInlineData = (crossThreadDatSize <= inlineDataSize);
if (crossThreadDataFitsInInlineData) {
EXPECT_EQ(iohBefore, pIOH->getUsed());
} else {
EXPECT_NE(iohBefore, pIOH->getUsed());
}
if (kernel->usesBindfulAddressingForBuffers()) {
EXPECT_NE(sshBefore, pSSH->getUsed());
}
@@ -377,7 +392,11 @@ HWTEST_F(EnqueueCopyBufferTest, WhenCopyingBufferThenArgumentZeroMatchesSourceAd
// Extract the kernel used
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer,
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
auto heaplessEnabled = compilerProductHelper.isHeaplessModeEnabled();
auto builtInType = adjustBuiltInType(heaplessEnabled, EBuiltInOps::copyBufferToBuffer);
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(builtInType,
pCmdQ->getClDevice());
ASSERT_NE(nullptr, &builder);
@@ -405,7 +424,10 @@ HWTEST_F(EnqueueCopyBufferTest, WhenCopyingBufferThenArgumentOneMatchesDestinati
enqueueCopyBufferAndParse<FamilyType>();
// Extract the kernel used
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(EBuiltInOps::copyBufferToBuffer,
auto &compilerProductHelper = pDevice->getCompilerProductHelper();
auto heaplessEnabled = compilerProductHelper.isHeaplessModeEnabled();
auto builtInType = adjustBuiltInType(heaplessEnabled, EBuiltInOps::copyBufferToBuffer);
auto &builder = BuiltInDispatchBuilderOp::getBuiltinDispatchInfoBuilder(builtInType,
pCmdQ->getClDevice());
ASSERT_NE(nullptr, &builder);