mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-10 12:53:42 +08:00
Move API specific logic directly to getDefaultCompilerCacheConfig function
Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
3b92cef7a1
commit
625f88d64d
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (C) 2020 Intel Corporation
|
||||
# Copyright (C) 2020-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
@ -7,8 +7,6 @@
|
||||
set(L0_SRCS_COMPILER_INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_cache_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_l0_cache_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_l0_cache_config.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/l0_reg_path.h
|
||||
)
|
||||
|
||||
|
@ -1,17 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#define L0_CACHE_LOCATION "l0_c_cache"
|
||||
|
||||
#include "shared/source/compiler_interface/default_cache_config.h"
|
||||
|
||||
#include "level_zero/core/source/compiler_interface/default_l0_cache_config.h"
|
||||
#include "shared/source/utilities/debug_settings_reader.h"
|
||||
|
||||
#include "level_zero/core/source/compiler_interface/l0_reg_path.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
CompilerCacheConfig getDefaultCompilerCacheConfig() {
|
||||
return L0::getDefaultL0CompilerCacheConfig();
|
||||
NEO::CompilerCacheConfig ret;
|
||||
|
||||
std::string keyName = L0::registryPath;
|
||||
keyName += "l0_c_cache_dir";
|
||||
std::unique_ptr<NEO::SettingsReader> settingsReader(NEO::SettingsReader::createOsReader(false, keyName));
|
||||
ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast<std::string>(L0_CACHE_LOCATION));
|
||||
|
||||
ret.cacheFileExtension = ".l0_c_cache";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#define L0_CACHE_LOCATION "l0_c_cache"
|
||||
|
||||
#include "level_zero/core/source/compiler_interface/default_l0_cache_config.h"
|
||||
|
||||
#include "shared/source/utilities/debug_settings_reader.h"
|
||||
|
||||
#include "level_zero/core/source/compiler_interface/l0_reg_path.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace L0 {
|
||||
|
||||
NEO::CompilerCacheConfig getDefaultL0CompilerCacheConfig() {
|
||||
NEO::CompilerCacheConfig ret;
|
||||
|
||||
std::string keyName = registryPath;
|
||||
keyName += "l0_c_cache_dir";
|
||||
std::unique_ptr<NEO::SettingsReader> settingsReader(NEO::SettingsReader::createOsReader(false, keyName));
|
||||
ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast<std::string>(L0_CACHE_LOCATION));
|
||||
|
||||
ret.cacheFileExtension = ".l0_c_cache";
|
||||
|
||||
return ret;
|
||||
}
|
||||
} // namespace L0
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/compiler_interface/compiler_cache.h"
|
||||
|
||||
namespace L0 {
|
||||
|
||||
NEO::CompilerCacheConfig getDefaultL0CompilerCacheConfig();
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
#
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
set(RUNTIME_SRCS_COMPILER_INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_cl_cache_config.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/default_cache_config.cpp
|
||||
)
|
||||
|
||||
target_sources(${NEO_STATIC_LIB_NAME} PRIVATE
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@ -7,11 +7,27 @@
|
||||
|
||||
#include "shared/source/compiler_interface/default_cache_config.h"
|
||||
|
||||
#include "opencl/source/compiler_interface/default_cl_cache_config.h"
|
||||
#include "shared/source/utilities/debug_settings_reader.h"
|
||||
|
||||
#include "opencl/source/os_interface/ocl_reg_path.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "os_inc.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
CompilerCacheConfig getDefaultCompilerCacheConfig() {
|
||||
return getDefaultClCompilerCacheConfig();
|
||||
CompilerCacheConfig ret;
|
||||
|
||||
std::string keyName = oclRegPath;
|
||||
keyName += "cl_cache_dir";
|
||||
std::unique_ptr<SettingsReader> settingsReader(SettingsReader::createOsReader(false, keyName));
|
||||
ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast<std::string>(CL_CACHE_LOCATION));
|
||||
|
||||
ret.cacheFileExtension = ".cl_cache";
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "default_cl_cache_config.h"
|
||||
|
||||
#include "shared/source/utilities/debug_settings_reader.h"
|
||||
|
||||
#include "opencl/source/os_interface/ocl_reg_path.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "os_inc.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace NEO {
|
||||
|
||||
CompilerCacheConfig getDefaultClCompilerCacheConfig() {
|
||||
CompilerCacheConfig ret;
|
||||
|
||||
std::string keyName = oclRegPath;
|
||||
keyName += "cl_cache_dir";
|
||||
std::unique_ptr<SettingsReader> settingsReader(SettingsReader::createOsReader(false, keyName));
|
||||
ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast<std::string>(CL_CACHE_LOCATION));
|
||||
|
||||
ret.cacheFileExtension = ".cl_cache";
|
||||
|
||||
return ret;
|
||||
}
|
||||
} // namespace NEO
|
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2020 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "shared/source/compiler_interface/compiler_cache.h"
|
||||
|
||||
namespace NEO {
|
||||
|
||||
CompilerCacheConfig getDefaultClCompilerCacheConfig();
|
||||
}
|
@ -1,23 +1,22 @@
|
||||
/*
|
||||
* Copyright (C) 2019-2021 Intel Corporation
|
||||
* Copyright (C) 2019-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/compiler_interface/default_cache_config.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
||||
#include "opencl/source/compiler_interface/default_cl_cache_config.h"
|
||||
|
||||
TEST(CompilerCache, GivenDefaultClCacheConfigThenValuesAreProperlyPopulated) {
|
||||
auto cacheConfig = NEO::getDefaultClCompilerCacheConfig();
|
||||
auto cacheConfig = NEO::getDefaultCompilerCacheConfig();
|
||||
EXPECT_STREQ("cl_cache", cacheConfig.cacheDir.c_str());
|
||||
EXPECT_STREQ(".cl_cache", cacheConfig.cacheFileExtension.c_str());
|
||||
EXPECT_TRUE(cacheConfig.enabled);
|
||||
}
|
||||
|
||||
TEST(CompilerCacheTests, GivenExistingConfigWhenLoadingFromCacheThenBinaryIsLoaded) {
|
||||
NEO::CompilerCache cache(NEO::getDefaultClCompilerCacheConfig());
|
||||
NEO::CompilerCache cache(NEO::getDefaultCompilerCacheConfig());
|
||||
static const char *hash = "SOME_HASH";
|
||||
std::unique_ptr<char> data(new char[32]);
|
||||
for (size_t i = 0; i < 32; i++)
|
||||
|
Reference in New Issue
Block a user