Add ult specific config to neo_shared_tests

Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-10-08 17:54:03 +00:00
committed by Compute-Runtime-Automation
parent 740ceaf2c2
commit aa0cb7a8bf
6 changed files with 55 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@@ -14,3 +14,19 @@ TEST(CompilerCache, GivenDefaultClCacheConfigThenValuesAreProperlyPopulated) {
EXPECT_STREQ(".cl_cache", cacheConfig.cacheFileExtension.c_str());
EXPECT_TRUE(cacheConfig.enabled);
}
TEST(CompilerCacheTests, GivenExistingConfigWhenLoadingFromCacheThenBinaryIsLoaded) {
NEO::CompilerCache cache(NEO::getDefaultClCompilerCacheConfig());
static const char *hash = "SOME_HASH";
std::unique_ptr<char> data(new char[32]);
for (size_t i = 0; i < 32; i++)
data.get()[i] = static_cast<char>(i);
bool ret = cache.cacheBinary(hash, static_cast<const char *>(data.get()), 32);
EXPECT_TRUE(ret);
size_t size;
auto loadedBin = cache.loadCachedBinary(hash, size);
EXPECT_NE(nullptr, loadedBin);
EXPECT_NE(0U, size);
}

View File

@@ -27,6 +27,7 @@ if(NOT SKIP_UNIT_TESTS)
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/test_mode.h
${CMAKE_CURRENT_SOURCE_DIR}/tests_configuration.h
${CMAKE_CURRENT_SOURCE_DIR}/ult_specific_config.cpp
${NEO_SOURCE_DIR}/opencl/source/compiler_interface/default_cache_config.cpp
${NEO_SHARED_DIRECTORY}/helpers/allow_deferred_deleter.cpp
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/api_specific_config_shared_tests.cpp

View File

@@ -11,12 +11,10 @@
#include "shared/source/helpers/hash.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/helpers/string.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/libult/global_environment.h"
#include "shared/test/common/mocks/mock_device.h"
#include "opencl/source/compiler_interface/default_cl_cache_config.h"
#include "opencl/test/unit_test/mocks/mock_cl_device.h"
#include "opencl/test/unit_test/mocks/mock_context.h"
#include "opencl/test/unit_test/mocks/mock_program.h"
#include "test.h"
#include <array>
@@ -237,22 +235,6 @@ TEST(CompilerCacheTests, GivenNonExistantConfigWhenLoadingFromCacheThenNullIsRet
EXPECT_EQ(0U, size);
}
TEST(CompilerCacheTests, GivenExistingConfigWhenLoadingFromCacheThenBinaryIsLoaded) {
CompilerCache cache(getDefaultClCompilerCacheConfig());
static const char *hash = "SOME_HASH";
std::unique_ptr<char> data(new char[32]);
for (size_t i = 0; i < 32; i++)
data.get()[i] = static_cast<char>(i);
bool ret = cache.cacheBinary(hash, static_cast<const char *>(data.get()), 32);
EXPECT_TRUE(ret);
size_t size;
auto loadedBin = cache.loadCachedBinary(hash, size);
EXPECT_NE(nullptr, loadedBin);
EXPECT_NE(0U, size);
}
TEST(CompilerInterfaceCachedTests, GivenNoCachedBinaryWhenBuildingThenErrorIsReturned) {
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
@@ -312,8 +294,7 @@ TEST(CompilerInterfaceCachedTests, GivenCachedBinaryWhenBuildingThenSuccessIsRet
}
TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsNotCalled) {
MockClDevice device{new MockDevice};
MockContext context(&device, true);
MockDevice device{};
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
auto src = "__kernel k() {}";
@@ -336,7 +317,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe
auto compilerInterface = std::unique_ptr<CompilerInterface>(CompilerInterface::createInstance(std::move(cache), true));
TranslationOutput translationOutput;
inputArgs.allowCaching = true;
auto retVal = compilerInterface->build(device.getDevice(), inputArgs, translationOutput);
auto retVal = compilerInterface->build(device, inputArgs, translationOutput);
EXPECT_EQ(TranslationOutput::ErrorCode::Success, retVal);
gEnvironment->fclPopDebugVars();
@@ -344,8 +325,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithoutIncludesAndBinaryInCacheWhe
}
TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCompilationRequestedThenFCLIsCalled) {
MockClDevice device{new MockDevice};
MockContext context(&device, true);
MockDevice device{};
TranslationInput inputArgs{IGC::CodeType::oclC, IGC::CodeType::oclGenBin};
auto src = "#include \"file.h\"\n__kernel k() {}";
@@ -361,7 +341,7 @@ TEST(CompilerInterfaceCachedTests, givenKernelWithIncludesAndBinaryInCacheWhenCo
auto compilerInterface = std::unique_ptr<CompilerInterface>(CompilerInterface::createInstance(std::move(cache), true));
TranslationOutput translationOutput;
inputArgs.allowCaching = true;
auto retVal = compilerInterface->build(device.getDevice(), inputArgs, translationOutput);
auto retVal = compilerInterface->build(device, inputArgs, translationOutput);
EXPECT_EQ(TranslationOutput::ErrorCode::BuildFailure, retVal);
gEnvironment->fclPopDebugVars();

View File

@@ -916,6 +916,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesDynamicImplicitScaling, givenImp
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
using BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
VariableBackup<bool> backup(&ImplicitScaling::apiSupport, true);
uint32_t dims[] = {16, 1, 1};
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
@@ -979,6 +981,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesDynamicImplicitScaling, givenImp
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
using BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
VariableBackup<bool> backup(&ImplicitScaling::apiSupport, true);
uint32_t dims[] = {16, 1, 1};
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());
@@ -1070,6 +1073,7 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, CommandEncodeStatesDynamicImplicitScaling, givenImp
using WALKER_TYPE = typename FamilyType::WALKER_TYPE;
using BATCH_BUFFER_START = typename FamilyType::MI_BATCH_BUFFER_START;
using MI_STORE_DATA_IMM = typename FamilyType::MI_STORE_DATA_IMM;
VariableBackup<bool> backup(&ImplicitScaling::apiSupport, true);
uint32_t dims[] = {16, 1, 1};
std::unique_ptr<MockDispatchKernelEncoder> dispatchInterface(new MockDispatchKernelEncoder());

View File

@@ -120,8 +120,8 @@ TEST_F(ImplicitScalingTests, givenForceSemaphoreUseWhenCheckingSemaphoreUseThenE
EXPECT_TRUE(ImplicitScalingHelper::isSemaphoreProgrammingRequired());
}
TEST_F(ImplicitScalingTests, givenDefaultSettingsWhenCheckingCrossTileAtomicSyncThenExpectTrue) {
EXPECT_TRUE(ImplicitScalingHelper::isCrossTileAtomicRequired());
TEST_F(ImplicitScalingTests, givenDefaultSettingsWhenCheckingCrossTileAtomicSyncThenExpectDefaultDefined) {
EXPECT_EQ(ImplicitScaling::crossTileAtomicSynchronization, ImplicitScalingHelper::isCrossTileAtomicRequired());
}
TEST_F(ImplicitScalingTests, givenForceDisableWhenCheckingCrossTileAtomicSyncThenExpectFalse) {

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/command_container/implicit_scaling.h"
#include "shared/source/memory_manager/compression_selector.h"
#include "shared/source/page_fault_manager/cpu_page_fault_manager.h"
namespace NEO {
namespace ImplicitScaling {
bool apiSupport = false;
bool semaphoreProgrammingRequired = false;
bool crossTileAtomicSynchronization = false;
} // namespace ImplicitScaling
bool CompressionSelector::preferRenderCompressedBuffer(const AllocationProperties &properties, const HardwareInfo &hwInfo) {
return false;
}
void PageFaultManager::transferToCpu(void *ptr, size_t size, void *cmdQ) {
}
void PageFaultManager::transferToGpu(void *ptr, void *cmdQ) {
}
} // namespace NEO