• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2024 Huawei Technologies Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #include <string>
17 #include "transform/symbol/symbol_utils.h"
18 #include "transform/symbol/acl_compiler_symbol.h"
19 
20 namespace mindspore {
21 namespace transform {
22 aclopCompileAndExecuteFunObj aclopCompileAndExecute_ = nullptr;
23 aclopCompileAndExecuteV2FunObj aclopCompileAndExecuteV2_ = nullptr;
24 aclSetCompileoptFunObj aclSetCompileopt_ = nullptr;
25 aclopSetCompileFlagFunObj aclopSetCompileFlag_ = nullptr;
26 aclGenGraphAndDumpForOpFunObj aclGenGraphAndDumpForOp_ = nullptr;
27 
LoadAclOpCompilerApiSymbol(const std::string & ascend_path)28 void LoadAclOpCompilerApiSymbol(const std::string &ascend_path) {
29   std::string complier_plugin_path = ascend_path + "lib64/libacl_op_compiler.so";
30   auto handler = GetLibHandler(complier_plugin_path);
31   if (handler == nullptr) {
32     MS_LOG(WARNING) << "Dlopen " << complier_plugin_path << " failed!" << dlerror();
33     return;
34   }
35   aclopCompileAndExecute_ = DlsymAscendFuncObj(aclopCompileAndExecute, handler);
36   aclopCompileAndExecuteV2_ = DlsymAscendFuncObj(aclopCompileAndExecuteV2, handler);
37   aclSetCompileopt_ = DlsymAscendFuncObj(aclSetCompileopt, handler);
38   aclopSetCompileFlag_ = DlsymAscendFuncObj(aclopSetCompileFlag, handler);
39   aclGenGraphAndDumpForOp_ = DlsymAscendFuncObj(aclGenGraphAndDumpForOp, handler);
40   MS_LOG(INFO) << "Load acl op compiler api success!";
41 }
42 
43 }  // namespace transform
44 }  // namespace mindspore
45