Skip to content

Commit e7122c3

Browse files
committed
[ET-VK] Support setting cache_data_path at build time
Pull Request resolved: #11359 TSIA ghstack-source-id: 288183827 @exported-using-ghexport Differential Revision: [D75708084](https://our.internmc.facebook.com/intern/diff/D75708084/)
1 parent 767b781 commit e7122c3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

backends/vulkan/runtime/vk_api/Runtime.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,12 @@ std::string& set_and_get_pipeline_cache_data_path(
381381
const std::string& file_path) {
382382
// The global cache data path is declared as a static local variable for the
383383
// same reasons as the global runtime below.
384+
#if defined(ETVK_DEFAULT_CACHE_PATH)
385+
static std::string global_cache_data_path = ETVK_DEFAULT_CACHE_PATH;
386+
#else
384387
static std::string global_cache_data_path;
388+
#endif /* ETVK_DEFAULT_CACHE_PATH */
389+
385390
if (file_path.size() > 0) {
386391
global_cache_data_path = file_path;
387392
}

backends/vulkan/targets.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ def define_common_targets(is_fbcode = False):
170170
"ovr_config//os:macos": mac_flags,
171171
})
172172

173+
etvk_default_cache_path = read_config("etvk", "default_cache_path", "")
174+
if etvk_default_cache_path != "":
175+
VK_API_PREPROCESSOR_FLAGS += ["-DETVK_DEFAULT_CACHE_PATH={}".format(etvk_default_cache_path)]
176+
173177
debug_mode = read_config("etvk", "debug", "0") == "1"
174178
if debug_mode:
175179
VK_API_PREPROCESSOR_FLAGS += ["-DVULKAN_DEBUG"]

0 commit comments

Comments
 (0)