refactor: store implicit args version in kernel

- adjust tests to work with implicitargs v0 and v1

Related-To: NEO-14115

Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2025-03-10 17:13:28 +00:00
committed by Compute-Runtime-Automation
parent f5e37e725c
commit 34dad4d3de
9 changed files with 77 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
#
# Copyright (C) 2019-2023 Intel Corporation
# Copyright (C) 2019-2025 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
@@ -9,6 +9,7 @@ target_sources(neo_libult_common PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/cmd_buffer_validator.h
${CMAKE_CURRENT_SOURCE_DIR}/batch_buffer_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/gtest_helpers.h
${CMAKE_CURRENT_SOURCE_DIR}/implicit_args_test_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/raii_gfx_core_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/raii_product_helper.h
${CMAKE_CURRENT_SOURCE_DIR}/relaxed_ordering_commands_helper.h

View File

@@ -0,0 +1,20 @@
/*
* Copyright (C) 2025 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "implicit_args.h"
namespace ImplicitArgsTestHelper {
constexpr uint32_t getImplicitArgsSize(uint32_t version) {
if (version == 0) {
return NEO::ImplicitArgsV0::getSize();
} else if (version == 1) {
return NEO::ImplicitArgsV1::getSize();
}
return 0;
}
} // namespace ImplicitArgsTestHelper

View File

@@ -18,6 +18,7 @@
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/helpers/gtest_helpers.h"
#include "shared/test/common/helpers/implicit_args_test_helper.h"
#include "shared/test/common/helpers/raii_gfx_core_helper.h"
#include "shared/test/common/mocks/mock_device.h"
#include "shared/test/common/mocks/mock_elf.h"
@@ -2082,7 +2083,7 @@ TEST_F(LinkerTests, givenImplicitArgRelocationAndStackCallsThenPatchRelocationWi
EXPECT_EQ(0U, relocatedSymbols.size());
auto addressToPatch = reinterpret_cast<const uint32_t *>(instructionSegment.data() + reloc.r_offset);
EXPECT_EQ(ImplicitArgsV0::getSize(), *addressToPatch);
EXPECT_EQ(ImplicitArgsTestHelper::getImplicitArgsSize(deviceFactory.rootDevices[0]->getGfxCoreHelper().getImplicitArgsVersion()), *addressToPatch);
EXPECT_EQ(initData, *(addressToPatch - 1));
EXPECT_EQ(initData, *(addressToPatch + 1));
EXPECT_TRUE(kernelDescriptor.kernelAttributes.flags.requiresImplicitArgs);
@@ -2270,7 +2271,7 @@ TEST_F(LinkerDebuggingSupportedTests, givenImplicitArgRelocationAndEnabledDebugg
EXPECT_EQ(0U, relocatedSymbols.size());
auto addressToPatch = reinterpret_cast<const uint32_t *>(instructionSegment.data() + reloc.r_offset);
EXPECT_EQ(ImplicitArgsV0::getSize(), *addressToPatch);
EXPECT_EQ(ImplicitArgsTestHelper::getImplicitArgsSize(device->getGfxCoreHelper().getImplicitArgsVersion()), *addressToPatch);
EXPECT_EQ(initData, *(addressToPatch - 1));
EXPECT_EQ(initData, *(addressToPatch + 1));
EXPECT_TRUE(kernelDescriptor.kernelAttributes.flags.requiresImplicitArgs);
@@ -2477,7 +2478,7 @@ TEST_F(LinkerTests, givenMultipleImplicitArgsRelocationsWithinSingleKernelWhenLi
for (const auto &reloc : relocs) {
auto addressToPatch = reinterpret_cast<const uint32_t *>(instructionSegment.data() + reloc.r_offset);
EXPECT_EQ(ImplicitArgsV0::getSize(), *addressToPatch);
EXPECT_EQ(ImplicitArgsTestHelper::getImplicitArgsSize(deviceFactory.rootDevices[0]->getGfxCoreHelper().getImplicitArgsVersion()), *addressToPatch);
EXPECT_TRUE(kernelDescriptor.kernelAttributes.flags.requiresImplicitArgs);
}
}