test: Correct mock kernel setArgumentValue function

Only use explicit args when proper flag is set.

Related-To: NEO-14946

Signed-off-by: Filip Hazubski <filip.hazubski@intel.com>
This commit is contained in:
Filip Hazubski 2025-05-14 20:46:22 +00:00 committed by Compute-Runtime-Automation
parent b9ab3df910
commit 30af50404e
2 changed files with 11 additions and 6 deletions

View File

@ -119,15 +119,18 @@ struct Mock<::L0::KernelImp> : public WhiteBox<::L0::KernelImp> {
if (checkPassedArgumentValues) {
UNRECOVERABLE_IF(argIndex >= passedArgumentValues.size());
auto &explicitArgs = getImmutableData()->getDescriptor().payloadMappings.explicitArgs;
if (explicitArgs[argIndex].type == NEO::ArgDescriptor::argTValue) {
if (useExplicitArgs) {
auto &explicitArgs = getImmutableData()->getDescriptor().payloadMappings.explicitArgs;
UNRECOVERABLE_IF(argIndex >= explicitArgs.size());
if (explicitArgs[argIndex].type == NEO::ArgDescriptor::argTValue) {
size_t maxArgSize = 0u;
size_t maxArgSize = 0u;
for (const auto &element : explicitArgs[argIndex].as<NEO::ArgDescValue>().elements) {
maxArgSize += element.size;
for (const auto &element : explicitArgs[argIndex].as<NEO::ArgDescValue>().elements) {
maxArgSize += element.size;
}
argSize = std::min(maxArgSize, argSize);
}
argSize = std::min(maxArgSize, argSize);
}
passedArgumentValues[argIndex].resize(argSize);
@ -150,6 +153,7 @@ struct Mock<::L0::KernelImp> : public WhiteBox<::L0::KernelImp> {
bool enableForcingOfGenerateLocalIdByHw = false;
bool forceGenerateLocalIdByHw = false;
bool checkPassedArgumentValues = false;
bool useExplicitArgs = false;
};
} // namespace ult

View File

@ -3386,6 +3386,7 @@ TEST_F(CommandListAppendLaunchKernelWithArgumentsTests, whenAppendLaunchKernelWi
EXPECT_EQ(ZE_RESULT_SUCCESS, kernel.initialize(&desc));
kernel.checkPassedArgumentValues = true;
kernel.useExplicitArgs = true;
kernel.passedArgumentValues.resize(5);
void *argBuffer = reinterpret_cast<void *>(0xDEADF00);