Browse Source

Clean code for compiler

feature/build-system-rewrite
yujianfeng 4 years ago
parent
commit
4e6203ad4b
9 changed files with 11 additions and 35 deletions
  1. +1
    -1
      mindspore/core/ir/manager.cc
  2. +2
    -2
      mindspore/core/ir/manager.h
  3. +0
    -5
      mindspore/core/ir/meta_tensor.cc
  4. +0
    -7
      mindspore/core/ir/meta_tensor_extends.cc
  5. +3
    -2
      mindspore/core/ir/pattern_matcher.h
  6. +2
    -2
      mindspore/core/ir/primal_attr.h
  7. +2
    -2
      mindspore/core/ir/primal_debug_info.h
  8. +0
    -13
      mindspore/core/ir/tensor.cc
  9. +1
    -1
      mindspore/core/ir/value.h

+ 1
- 1
mindspore/core/ir/manager.cc View File

@@ -349,7 +349,7 @@ void FuncGraphManager::AddFuncGraph(const FuncGraphPtr &func_graph, bool is_root
}

// Clear the all information in manager
void FuncGraphManager::Clear() {
void FuncGraphManager::Clear() noexcept {
for (auto graph : func_graphs_) {
graph->DecAttachedMngCnt();
if (graph->attached_mng_cnt() == 0) {


+ 2
- 2
mindspore/core/ir/manager.h View File

@@ -281,7 +281,7 @@ class FuncGraphManager : public std::enable_shared_from_this<FuncGraphManager>,
public deprecated::api::FuncGraphManager {
public:
explicit FuncGraphManager(const std::vector<FuncGraphPtr> &roots, bool manage = true);
~FuncGraphManager() noexcept {
~FuncGraphManager() {
if (is_manage_) {
RemoveRoots();
}
@@ -290,7 +290,7 @@ class FuncGraphManager : public std::enable_shared_from_this<FuncGraphManager>,

void Reset();
void Init();
void Clear();
void Clear() noexcept;
void AddFuncGraph(const FuncGraphPtr &func_graph, bool is_root = false);
void KeepRoots(const std::vector<FuncGraphPtr> &roots = {});
void RemoveRoots();


+ 0
- 5
mindspore/core/ir/meta_tensor.cc View File

@@ -15,12 +15,7 @@
*/

#include "ir/meta_tensor.h"

#include <functional>
#include <numeric>
#include <vector>
#include <sstream>
#include <string>

namespace mindspore {
namespace tensor {


+ 0
- 7
mindspore/core/ir/meta_tensor_extends.cc View File

@@ -15,13 +15,6 @@
*/

#include "ir/meta_tensor.h"

#include <functional>
#include <numeric>
#include <vector>
#include <sstream>
#include <string>

#include "abstract/abstract_value.h"

namespace mindspore {


+ 3
- 2
mindspore/core/ir/pattern_matcher.h View File

@@ -267,7 +267,7 @@ class PCNode : public PBase<PCNode<TArgs...> > {
// If it could capture the initial set of nodes specified in the Pattern
// and there are enough extra inputs to add
if (capture_func.captured_ && inputs.size() > pattern_arg_len) {
extra_nodes_.insert(extra_nodes_.end(), inputs.begin() + SizeToLong(pattern_arg_len), inputs.end());
(void)extra_nodes_.insert(extra_nodes_.end(), inputs.begin() + SizeToLong(pattern_arg_len), inputs.end());
return true;
}
return capture_func.captured_;
@@ -357,7 +357,8 @@ class PPrimitive : public PBase<PPrimitive<TArgs...> > {
if (capture_func.captured_) {
captured_prim_node_ = node;
if (inputs.size() > pattern_arg_len + 1) {
extra_nodes_.insert(extra_nodes_.end(), inputs.begin() + 1 + SizeToLong(pattern_arg_len), inputs.end());
(void)extra_nodes_.insert(extra_nodes_.end(), inputs.begin() + 1 + SizeToLong(pattern_arg_len),
inputs.end());
}
}
return capture_func.captured_;


+ 2
- 2
mindspore/core/ir/primal_attr.h View File

@@ -36,7 +36,7 @@ class PrimalAttrManager {
PrimalAttrManager &operator=(const PrimalAttrManager &) = delete;
~PrimalAttrManager() = default;
void SetPrimalAttr(const mindspore::HashMap<std::string, ValuePtr> &primal_attrs) { primal_attrs_ = primal_attrs; }
void ClearPrimalAttr() { primal_attrs_.clear(); }
void ClearPrimalAttr() noexcept { primal_attrs_.clear(); }
mindspore::HashMap<std::string, ValuePtr> GetCurrentPrimalAttr() { return primal_attrs_; }

private:
@@ -51,7 +51,7 @@ class PrimalAttrGuard {
explicit PrimalAttrGuard(const mindspore::HashMap<std::string, ValuePtr> &primal_attrs) {
PrimalAttrManager::GetInstance().SetPrimalAttr(primal_attrs);
}
~PrimalAttrGuard() noexcept { PrimalAttrManager::GetInstance().ClearPrimalAttr(); }
~PrimalAttrGuard() { PrimalAttrManager::GetInstance().ClearPrimalAttr(); }
};
} // namespace mindspore
#endif // MINDSPORE_CORE_IR_PRIMAL_ATTR_H_

+ 2
- 2
mindspore/core/ir/primal_debug_info.h View File

@@ -38,7 +38,7 @@ class PrimalDebugInfoManager {
std::for_each(primal_debug_infos.begin(), primal_debug_infos.end(),
[this](const NodeDebugInfoPtr &debug_info) { primal_debug_infos_.emplace(debug_info); });
}
void ClearPrimalDebugInfo() { primal_debug_infos_.clear(); }
void ClearPrimalDebugInfo() noexcept { primal_debug_infos_.clear(); }
std::set<NodeDebugInfoPtr, DebugInfoCompare> GetCurrentPrimalDebugInfo() { return primal_debug_infos_; }

private:
@@ -53,7 +53,7 @@ class PrimalDebugInfoGuard {
explicit PrimalDebugInfoGuard(const std::vector<NodeDebugInfoPtr> &primal_debug_infos) {
PrimalDebugInfoManager::GetInstance().SetPrimalDebugInfo(primal_debug_infos);
}
~PrimalDebugInfoGuard() noexcept { PrimalDebugInfoManager::GetInstance().ClearPrimalDebugInfo(); }
~PrimalDebugInfoGuard() { PrimalDebugInfoManager::GetInstance().ClearPrimalDebugInfo(); }
};
} // namespace mindspore
#endif // MINDSPORE_CORE_IR_PRIMAL_DEBUG_INFO_H

+ 0
- 13
mindspore/core/ir/tensor.cc View File

@@ -15,20 +15,7 @@
*/

#include "ir/tensor.h"

#include <atomic>
#include <functional>
#include <numeric>
#include <vector>
#include <memory>
#include <sstream>
#include <string>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <type_traits>
#include <typeinfo>

#include "abstract/utils.h"
#include "abstract/abstract_value.h"
#include "base/complex_storage.h"


+ 1
- 1
mindspore/core/ir/value.h View File

@@ -505,7 +505,7 @@ class MS_CORE_API Monad : public Value {
/// \brief Constructor of Monad.
///
/// \param[in] type Define the type of Monad object.
explicit Monad(TypePtr type) : Value(type) {}
explicit Monad(const TypePtr &type) : Value(type) {}
};

/// \brief UMonad defines a Value class which related to memory side effect.


Loading…
Cancel
Save