• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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 
17 #ifndef MINDSPORE_CCSRC_CXXAPI_SESSION_ACL_OPTION_PARSER_H
18 #define MINDSPORE_CCSRC_CXXAPI_SESSION_ACL_OPTION_PARSER_H
19 #include <vector>
20 #include <string>
21 #include <map>
22 #include <tuple>
23 #include <memory>
24 #include <optional>
25 #include "include/api/types.h"
26 #include "include/api/status.h"
27 #include "include/api/context.h"
28 
29 namespace mindspore {
30 class AclModelOptions {
31  public:
32   explicit AclModelOptions(const std::shared_ptr<Context> &context);
33   ~AclModelOptions() = default;
34   std::string GenAclOptionsKey() const;
GetDeviceID()35   uint32_t GetDeviceID() const { return device_id_; }
36   void RenameInput(const std::vector<std::string> &);
37 
38   // return tuple<init_options, build_options>
39   std::tuple<std::map<std::string, std::string>, std::map<std::string, std::string>> GenAclOptions() const;
SetFirstGraph(bool is_first_graph)40   void SetFirstGraph(bool is_first_graph) noexcept { first_graph_flag_ = is_first_graph; }
41 
42  private:
43   std::string output_node_;  // todo: at convert.cc::BuildGraph(), no atc options
44   // build options
45   std::string insert_op_cfg_path_;
46   std::string input_format_;
47   std::string input_shape_;
48   std::string output_type_;
49   std::string precision_mode_;
50   std::string op_select_impl_mode_;
51   std::string fusion_switch_cfg_path_;
52   std::string soc_version_ = "Ascend310";
53   std::string dynamic_batch_size_;
54   std::string dynamic_image_size_;
55   std::string buffer_optimize_mode_;
56   std::map<int, std::vector<int>> input_shape_map_;
57   // other options
58   uint32_t device_id_;
59   std::optional<bool> first_graph_flag_;
60 };
61 }  // namespace mindspore
62 
63 #endif  // MINDSPORE_CCSRC_CXXAPI_SESSION_ACL_OPTION_PARSER_H
64