!43098 Fixed the problem of mutiple compilation

Merge pull request !43098 from wanghenchang/tbe_compile_master
This commit is contained in:
i-robot 2022-09-28 14:51:33 +00:00 committed by Gitee
commit c4baddd410
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 2 additions and 0 deletions

View File

@ -39,6 +39,7 @@ namespace ascend {
using mindspore::kernel::tbe::TbeUtils;
using std::make_shared;
constexpr size_t kMaxAttrMemListSize = 192;
static std::mutex compile_mtx;
static kernel::KernelModPtr SerialCompileImpl(const AnfNodePtr &anf_node) {
kernel::KernelModPtr kernel_mod_ptr = nullptr;
@ -107,6 +108,7 @@ static bool KernelBuildParallelCompile(const std::vector<CNodePtr> &kernels) {
auto bin_map = kernel::tbe::KernelMeta::GetInstance();
MS_EXCEPTION_IF_NULL(bin_map);
if (!tbe_nodes.empty()) {
std::lock_guard<std::mutex> lock(compile_mtx);
auto &build_manager = kernel::ascend::TbeKernelCompileManager::GetInstance();
build_manager.TbeSingleOpCompile(tbe_nodes);
auto config_path = TbeUtils::GetOpDebugPath();