diff --git a/level_zero/core/source/compiler_interface/CMakeLists.txt b/level_zero/core/source/compiler_interface/CMakeLists.txt index 9e0835ddd2..9b99d37ee9 100644 --- a/level_zero/core/source/compiler_interface/CMakeLists.txt +++ b/level_zero/core/source/compiler_interface/CMakeLists.txt @@ -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 ) diff --git a/level_zero/core/source/compiler_interface/default_cache_config.cpp b/level_zero/core/source/compiler_interface/default_cache_config.cpp index 6357d85a0d..0555b58208 100644 --- a/level_zero/core/source/compiler_interface/default_cache_config.cpp +++ b/level_zero/core/source/compiler_interface/default_cache_config.cpp @@ -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 namespace NEO { CompilerCacheConfig getDefaultCompilerCacheConfig() { - return L0::getDefaultL0CompilerCacheConfig(); + NEO::CompilerCacheConfig ret; + + std::string keyName = L0::registryPath; + keyName += "l0_c_cache_dir"; + std::unique_ptr settingsReader(NEO::SettingsReader::createOsReader(false, keyName)); + ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast(L0_CACHE_LOCATION)); + + ret.cacheFileExtension = ".l0_c_cache"; + + return ret; } } // namespace NEO diff --git a/level_zero/core/source/compiler_interface/default_l0_cache_config.cpp b/level_zero/core/source/compiler_interface/default_l0_cache_config.cpp deleted file mode 100644 index 08172a5691..0000000000 --- a/level_zero/core/source/compiler_interface/default_l0_cache_config.cpp +++ /dev/null @@ -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 - -namespace L0 { - -NEO::CompilerCacheConfig getDefaultL0CompilerCacheConfig() { - NEO::CompilerCacheConfig ret; - - std::string keyName = registryPath; - keyName += "l0_c_cache_dir"; - std::unique_ptr settingsReader(NEO::SettingsReader::createOsReader(false, keyName)); - ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast(L0_CACHE_LOCATION)); - - ret.cacheFileExtension = ".l0_c_cache"; - - return ret; -} -} // namespace L0 diff --git a/level_zero/core/source/compiler_interface/default_l0_cache_config.h b/level_zero/core/source/compiler_interface/default_l0_cache_config.h deleted file mode 100644 index 733eaa66ae..0000000000 --- a/level_zero/core/source/compiler_interface/default_l0_cache_config.h +++ /dev/null @@ -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(); -} diff --git a/opencl/source/compiler_interface/CMakeLists.txt b/opencl/source/compiler_interface/CMakeLists.txt index e519a4fc20..ede9bd1361 100644 --- a/opencl/source/compiler_interface/CMakeLists.txt +++ b/opencl/source/compiler_interface/CMakeLists.txt @@ -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 diff --git a/opencl/source/compiler_interface/default_cache_config.cpp b/opencl/source/compiler_interface/default_cache_config.cpp index 3f37549157..9a77ef3a47 100644 --- a/opencl/source/compiler_interface/default_cache_config.cpp +++ b/opencl/source/compiler_interface/default_cache_config.cpp @@ -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 namespace NEO { CompilerCacheConfig getDefaultCompilerCacheConfig() { - return getDefaultClCompilerCacheConfig(); + CompilerCacheConfig ret; + + std::string keyName = oclRegPath; + keyName += "cl_cache_dir"; + std::unique_ptr settingsReader(SettingsReader::createOsReader(false, keyName)); + ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast(CL_CACHE_LOCATION)); + + ret.cacheFileExtension = ".cl_cache"; + + return ret; } } // namespace NEO diff --git a/opencl/source/compiler_interface/default_cl_cache_config.cpp b/opencl/source/compiler_interface/default_cl_cache_config.cpp deleted file mode 100644 index fb22223fcb..0000000000 --- a/opencl/source/compiler_interface/default_cl_cache_config.cpp +++ /dev/null @@ -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 - -namespace NEO { - -CompilerCacheConfig getDefaultClCompilerCacheConfig() { - CompilerCacheConfig ret; - - std::string keyName = oclRegPath; - keyName += "cl_cache_dir"; - std::unique_ptr settingsReader(SettingsReader::createOsReader(false, keyName)); - ret.cacheDir = settingsReader->getSetting(settingsReader->appSpecificLocation(keyName), static_cast(CL_CACHE_LOCATION)); - - ret.cacheFileExtension = ".cl_cache"; - - return ret; -} -} // namespace NEO diff --git a/opencl/source/compiler_interface/default_cl_cache_config.h b/opencl/source/compiler_interface/default_cl_cache_config.h deleted file mode 100644 index 343ee4d8b8..0000000000 --- a/opencl/source/compiler_interface/default_cl_cache_config.h +++ /dev/null @@ -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(); -} diff --git a/opencl/test/unit_test/compiler_interface/default_cl_cache_config_tests.cpp b/opencl/test/unit_test/compiler_interface/default_cl_cache_config_tests.cpp index 63845b620b..8b25a23adc 100644 --- a/opencl/test/unit_test/compiler_interface/default_cl_cache_config_tests.cpp +++ b/opencl/test/unit_test/compiler_interface/default_cl_cache_config_tests.cpp @@ -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 data(new char[32]); for (size_t i = 0; i < 32; i++)