mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 23:03:02 +08:00
Move unit test helper to shared code
Related-To: NEO-5161 Signed-off-by: Milczarek, Slawomir <slawomir.milczarek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
e5eba8be53
commit
9839b3049d
@@ -30,6 +30,8 @@ set(NEO_CORE_HELPERS_TESTS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_config.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ult_hw_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_helper.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/unit_test_helper.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/variable_backup.h
|
||||
)
|
||||
|
||||
|
||||
63
shared/test/common/helpers/unit_test_helper.h
Normal file
63
shared/test/common/helpers/unit_test_helper.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "shared/source/helpers/aux_translation.h"
|
||||
|
||||
#include "hw_cmds.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
struct KernelDescriptor;
|
||||
struct HardwareInfo;
|
||||
|
||||
template <typename GfxFamily>
|
||||
struct UnitTestHelper {
|
||||
using COHERENCY_TYPE = typename GfxFamily::RENDER_SURFACE_STATE::COHERENCY_TYPE;
|
||||
|
||||
static bool isL3ConfigProgrammable();
|
||||
|
||||
static bool evaluateDshUsage(size_t sizeBeforeEnqueue, size_t sizeAfterEnqueue, const KernelDescriptor *kernelDescriptor, uint32_t rootDeviceIndex);
|
||||
|
||||
static bool isPageTableManagerSupported(const HardwareInfo &hwInfo);
|
||||
|
||||
static bool isTimestampPacketWriteSupported();
|
||||
|
||||
static bool isExpectMemoryNotEqualSupported();
|
||||
|
||||
static uint32_t getDefaultSshUsage();
|
||||
|
||||
static uint32_t getAppropriateThreadArbitrationPolicy(uint32_t policy);
|
||||
|
||||
static auto getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType);
|
||||
|
||||
static bool evaluateGshAddressForScratchSpace(uint64_t usedScratchGpuAddress, uint64_t retrievedGshAddress);
|
||||
|
||||
static bool isPipeControlWArequired(const HardwareInfo &hwInfo);
|
||||
|
||||
static bool isAdditionalSynchronizationRequired();
|
||||
|
||||
static bool isAdditionalMiSemaphoreWaitRequired(const HardwareInfo &hwInfo);
|
||||
|
||||
static bool isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait);
|
||||
|
||||
static uint64_t getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic);
|
||||
|
||||
static bool requiresTimestampPacketsInSystemMemory();
|
||||
|
||||
static const bool tiledImagesSupported;
|
||||
|
||||
static const uint32_t smallestTestableSimdSize;
|
||||
|
||||
static const AuxTranslationMode requiredAuxTranslationMode;
|
||||
|
||||
static const bool useFullRowForLocalIdsGeneration;
|
||||
|
||||
static const bool additionalMiFlushDwRequired;
|
||||
};
|
||||
|
||||
} // namespace NEO
|
||||
103
shared/test/common/helpers/unit_test_helper.inl
Normal file
103
shared/test/common/helpers/unit_test_helper.inl
Normal file
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isL3ConfigProgrammable() {
|
||||
return true;
|
||||
};
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::evaluateDshUsage(size_t sizeBeforeEnqueue, size_t sizeAfterEnqueue, const KernelDescriptor *kernelDescriptor, uint32_t rootDeviceIndex) {
|
||||
if (sizeBeforeEnqueue != sizeAfterEnqueue) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isPageTableManagerSupported(const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isTimestampPacketWriteSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isExpectMemoryNotEqualSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
uint32_t UnitTestHelper<GfxFamily>::getDefaultSshUsage() {
|
||||
return sizeof(typename GfxFamily::RENDER_SURFACE_STATE);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline uint32_t UnitTestHelper<GfxFamily>::getAppropriateThreadArbitrationPolicy(uint32_t policy) {
|
||||
return policy;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::evaluateGshAddressForScratchSpace(uint64_t usedScratchGpuAddress, uint64_t retrievedGshAddress) {
|
||||
return usedScratchGpuAddress == retrievedGshAddress;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isPipeControlWArequired(const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isAdditionalSynchronizationRequired() {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isAdditionalMiSemaphoreWaitRequired(const HardwareInfo &hwInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool UnitTestHelper<GfxFamily>::isAdditionalMiSemaphoreWait(const typename GfxFamily::MI_SEMAPHORE_WAIT &semaphoreWait) {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline uint64_t UnitTestHelper<GfxFamily>::getMemoryAddress(const typename GfxFamily::MI_ATOMIC &atomic) {
|
||||
return atomic.getMemoryAddress() | ((static_cast<uint64_t>(atomic.getMemoryAddressHigh())) << 32);
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool UnitTestHelper<GfxFamily>::requiresTimestampPacketsInSystemMemory() {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
auto UnitTestHelper<GfxFamily>::getCoherencyTypeSupported(COHERENCY_TYPE coherencyType) -> decltype(coherencyType) {
|
||||
return coherencyType;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
const bool UnitTestHelper<GfxFamily>::tiledImagesSupported = true;
|
||||
|
||||
template <typename GfxFamily>
|
||||
const uint32_t UnitTestHelper<GfxFamily>::smallestTestableSimdSize = 8;
|
||||
|
||||
template <typename GfxFamily>
|
||||
const AuxTranslationMode UnitTestHelper<GfxFamily>::requiredAuxTranslationMode = AuxTranslationMode::Builtin;
|
||||
|
||||
template <typename GfxFamily>
|
||||
const bool UnitTestHelper<GfxFamily>::useFullRowForLocalIdsGeneration = false;
|
||||
|
||||
template <typename GfxFamily>
|
||||
const bool UnitTestHelper<GfxFamily>::additionalMiFlushDwRequired = false;
|
||||
|
||||
} // namespace NEO
|
||||
Reference in New Issue
Block a user