!40957 Disable async backend init by default

Merge pull request !40957 from hewei/fix_master1
This commit is contained in:
i-robot 2022-08-27 08:32:34 +00:00 committed by Gitee
commit 9772a743af
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 3 deletions

View File

@ -497,9 +497,10 @@ compile::BackendPtr Resource::GetBackend() const {
}
void Resource::SetBackendAsync(std::function<compile::BackendPtr()> func) {
static bool is_enable_ge = (common::GetEnv("MS_ENABLE_GE") == "1");
if (is_enable_ge) {
// Disable async backend creating for GE pipeline.
static const bool is_enable_async = (common::GetEnv("MS_DEV_ASYNC_BACKEND_INIT") == "1");
static const bool is_enable_ge = (common::GetEnv("MS_ENABLE_GE") == "1");
if (!is_enable_async || is_enable_ge) {
// Disable async backend init if required.
std::lock_guard<std::mutex> guard(GetBackendInitMutex());
backend_ = func();
return;