refactor: change test to HWTEST

- move Heapful matcher to test macros
- check alignment in patchWithRequiredSize


Signed-off-by: Mateusz Hoppe <mateusz.hoppe@intel.com>
This commit is contained in:
Mateusz Hoppe
2024-12-31 09:31:05 +00:00
committed by Compute-Runtime-Automation
parent b83db7ee32
commit c08c9b7f86
4 changed files with 21 additions and 16 deletions

View File

@@ -642,7 +642,7 @@ TEST_F(KernelFromBinaryTests, WhenRegularKernelIsCreatedThenItIsNotBuiltIn) {
delete kernel;
}
TEST_F(KernelFromBinaryTests, givenArgumentDeclaredAsConstantWhenKernelIsCreatedThenArgumentIsMarkedAsReadOnly) {
HWTEST_F(KernelFromBinaryTests, givenArgumentDeclaredAsConstantWhenKernelIsCreatedThenArgumentIsMarkedAsReadOnly) {
createProgramFromBinary(pContext, pContext->getDevices(), "simple_kernels");
ASSERT_NE(nullptr, pProgram);

View File

@@ -1,11 +1,12 @@
/*
* Copyright (C) 2018-2023 Intel Corporation
* Copyright (C) 2018-2024 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/helpers/aligned_memory.h"
#include "shared/source/helpers/debug_helpers.h"
#include <cstddef>
@@ -59,8 +60,12 @@ struct PatchStoreOperation {
inline void patchWithRequiredSize(void *memoryToBePatched, uint32_t patchSize, uint64_t patchValue) {
if (patchSize == sizeof(uint64_t)) {
uint64_t *curbeAddress = reinterpret_cast<uint64_t *>(memoryToBePatched);
PatchStoreOperation{}(curbeAddress, patchValue);
if (isAligned<sizeof(uint64_t)>(memoryToBePatched)) {
uint64_t *curbeAddress = reinterpret_cast<uint64_t *>(memoryToBePatched);
PatchStoreOperation{}(curbeAddress, patchValue);
} else {
memcpy_s(memoryToBePatched, patchSize, &patchValue, sizeof(patchValue));
}
} else if (patchSize == sizeof(uint32_t)) {
uint32_t *curbeAddress = reinterpret_cast<uint32_t *>(memoryToBePatched);
PatchStoreOperation{}(curbeAddress, static_cast<uint32_t>(patchValue));

View File

@@ -759,4 +759,16 @@ struct SupportsSampler {
}
};
struct HeapfulSupportedMatch {
template <PRODUCT_FAMILY productFamily>
static constexpr bool isMatched() {
const GFXCORE_FAMILY gfxCoreFamily = NEO::ToGfxCoreFamily<productFamily>::get();
using FamilyType = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
constexpr bool heaplessModeEnabled = FamilyType::template isHeaplessMode<DefaultWalkerType>();
return !heaplessModeEnabled;
}
};
#include "common_matchers.h"

View File

@@ -962,18 +962,6 @@ HWTEST_F(CommandEncodeStatesTest, givenPauseOnEnqueueSetToAlwaysWhenEncodingWalk
using EncodeDispatchKernelTest = Test<CommandEncodeStatesFixture>;
struct HeapfulSupportedMatch {
template <PRODUCT_FAMILY productFamily>
static constexpr bool isMatched() {
const GFXCORE_FAMILY gfxCoreFamily = NEO::ToGfxCoreFamily<productFamily>::get();
using FamilyType = typename NEO::GfxFamilyMapper<gfxCoreFamily>::GfxFamily;
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;
constexpr bool heaplessModeEnabled = FamilyType::template isHeaplessMode<DefaultWalkerType>();
return !heaplessModeEnabled;
}
};
HWTEST2_F(EncodeDispatchKernelTest, givenBindfulKernelWhenDispatchingKernelThenSshFromContainerIsUsed, HeapfulSupportedMatch) {
using BINDING_TABLE_STATE = typename FamilyType::BINDING_TABLE_STATE;
using DefaultWalkerType = typename FamilyType::DefaultWalkerType;