[feat]Provide ACL_OP_COMPILER_CACHE_MODE and ACL_OP_COMPILER_CACHE_DIR environment variables to enable cache.
This commit is contained in:
@@ -40,7 +40,13 @@ std::string GetCurDirPath() {
|
||||
}
|
||||
|
||||
void MakeCompileCacheDirAndSetOption() {
|
||||
auto compile_cache_dir = GetCurDirPath() + "/cache";
|
||||
char* compile_cache_mode_val = std::getenv("ACL_OP_COMPILER_CACHE_MODE");
|
||||
char* compile_cache_dir_val = std::getenv("ACL_OP_COMPILER_CACHE_DIR");
|
||||
|
||||
std::string compile_cache_mode = (compile_cache_mode_val == nullptr) ? std::string("enable")
|
||||
: std::string(compile_cache_mode_val);
|
||||
std::string compile_cache_dir = (compile_cache_dir_val == nullptr) ? GetCurDirPath() + "/cache"
|
||||
: std::string(compile_cache_dir_val);
|
||||
// mode : 750
|
||||
auto ret = Mkdir(compile_cache_dir.c_str(), S_IRWXU | S_IRGRP | S_IXGRP);
|
||||
if (ret == -1) {
|
||||
@@ -49,7 +55,10 @@ void MakeCompileCacheDirAndSetOption() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
c10_npu::option::register_options::OptionRegister::GetInstance()->Set("ACL_OP_COMPILER_CACHE_MODE", "enable");
|
||||
if (compile_cache_mode != "enable" && compile_cache_mode != "disable" && compile_cache_mode != "force") {
|
||||
compile_cache_mode = std::string("enable");
|
||||
}
|
||||
c10_npu::option::register_options::OptionRegister::GetInstance()->Set("ACL_OP_COMPILER_CACHE_MODE", compile_cache_mode);
|
||||
c10_npu::option::register_options::OptionRegister::GetInstance()->Set("ACL_OP_COMPILER_CACHE_DIR", compile_cache_dir);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user