You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

lic_manager.h 2.7 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Copyright 2021 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. #ifndef MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_PASS_SWITCH_MANAGER_H_
  17. #define MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_PASS_SWITCH_MANAGER_H_
  18. #include <memory>
  19. #include <string>
  20. #include <map>
  21. #include <vector>
  22. namespace mindspore {
  23. enum class OptPassEnum {
  24. MatmulBiasaddFusion,
  25. MulAddFusion,
  26. ReshapeTransposeFusion,
  27. SoftmaxGradExtFusion,
  28. SquareSumFusion,
  29. TransposeReshapeFusion,
  30. ClipByNormNoDivSquareSumFusion,
  31. MomentumLossscaleFusion,
  32. DereluFusion,
  33. FusedBatchNormFusion,
  34. MatmulEltwiseFusionPass,
  35. BatchMatmulFusedMulAddFusionPass,
  36. EltwiseFusionPass,
  37. MultiOutputFusionPass,
  38. BnupdateEltwiseEltwiseFusionPass,
  39. BnupdateEltwiseFusionPass,
  40. Conv2DBackpropEltwiseFusionPass,
  41. ConvBnReduceFusionPass,
  42. MulAddNPass,
  43. Resnet50DbnDwFusionPass,
  44. MatmulConfusiontransposeUbFusion,
  45. TbeBatchMatmulElementWiseFusionPass,
  46. Invalid,
  47. };
  48. class LicManager {
  49. public:
  50. static LicManager &GetInstance();
  51. bool GetPassSwitch(OptPassEnum pass) const;
  52. const std::string &GetOpTuneSwitch() const { return op_tune_switch_; }
  53. const std::string &GetOpTuneList() const { return op_tune_list_; }
  54. const std::string &GetRlTuneSwitch() const { return rl_tune_switch_; }
  55. const std::string &GetRlTuneList() const { return rl_tune_list_; }
  56. const std::string &GetPassSwitch() const { return pass_list_; }
  57. private:
  58. LicManager();
  59. ~LicManager() = default;
  60. void ParseSwitch();
  61. void ParseFeSwitch(const std::map<std::string, std::string> &options_map);
  62. void ParseOpTuneSwitch(const std::map<std::string, std::string> &options_map);
  63. void ParsePassSwitch(const std::map<std::string, std::string> &options_map);
  64. void ParseRlSwitch(const std::map<std::string, std::string> &options_map);
  65. std::map<OptPassEnum, bool> pass_switch_ = {};
  66. std::string op_tune_switch_ = "null";
  67. std::string op_tune_list_ = {};
  68. std::string pass_list_ = "invalid";
  69. std::string rl_tune_switch_ = "null";
  70. std::string rl_tune_list_ = {};
  71. };
  72. } // namespace mindspore
  73. #endif // MINDSPORE_CCSRC_RUNTIME_DEVICE_ASCEND_PASS_SWITCH_MANAGER_H_