code clean of r1.3
This commit is contained in:
parent
ed26447d73
commit
868a6d558f
|
@ -402,7 +402,7 @@ void DebuggerProtoExporter::ExportCNodes(const FuncGraphPtr &func_graph, debugge
|
||||||
}
|
}
|
||||||
auto cnode = node->cast<CNodePtr>();
|
auto cnode = node->cast<CNodePtr>();
|
||||||
if (cnode != func_graph->get_return()) {
|
if (cnode != func_graph->get_return()) {
|
||||||
ExportCNode(func_graph, cnode, &apply_map, const_map_ptr, graph_proto, dump_location);
|
ExportCNode(func_graph, cnode, &apply_map, const_map_ptr, graph_proto);
|
||||||
} else {
|
} else {
|
||||||
ExportFuncGraphOutput(func_graph, cnode, apply_map, const_map_ptr, graph_proto);
|
ExportFuncGraphOutput(func_graph, cnode, apply_map, const_map_ptr, graph_proto);
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ void DebuggerProtoExporter::ExportCNodes(const FuncGraphPtr &func_graph, debugge
|
||||||
void DebuggerProtoExporter::ExportCNode(const FuncGraphPtr &func_graph, const CNodePtr &node,
|
void DebuggerProtoExporter::ExportCNode(const FuncGraphPtr &func_graph, const CNodePtr &node,
|
||||||
std::map<AnfNodePtr, size_t> *apply_map_ptr,
|
std::map<AnfNodePtr, size_t> *apply_map_ptr,
|
||||||
std::map<AnfNodePtr, size_t> *const_map_ptr,
|
std::map<AnfNodePtr, size_t> *const_map_ptr,
|
||||||
debugger::GraphProto *const graph_proto, LocDebugDumpMode dump_location) {
|
debugger::GraphProto *const graph_proto) {
|
||||||
if (func_graph == nullptr || node == nullptr || apply_map_ptr == nullptr || const_map_ptr == nullptr ||
|
if (func_graph == nullptr || node == nullptr || apply_map_ptr == nullptr || const_map_ptr == nullptr ||
|
||||||
graph_proto == nullptr) {
|
graph_proto == nullptr) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -55,8 +55,7 @@ class DebuggerProtoExporter {
|
||||||
void ExportCNodes(const FuncGraphPtr &func_graph, debugger::GraphProto *const graph_proto,
|
void ExportCNodes(const FuncGraphPtr &func_graph, debugger::GraphProto *const graph_proto,
|
||||||
std::map<AnfNodePtr, size_t> *const_map_ptr, LocDebugDumpMode dump_location = kDebugWholeStack);
|
std::map<AnfNodePtr, size_t> *const_map_ptr, LocDebugDumpMode dump_location = kDebugWholeStack);
|
||||||
void ExportCNode(const FuncGraphPtr &func_graph, const CNodePtr &node, std::map<AnfNodePtr, size_t> *apply_map_ptr,
|
void ExportCNode(const FuncGraphPtr &func_graph, const CNodePtr &node, std::map<AnfNodePtr, size_t> *apply_map_ptr,
|
||||||
std::map<AnfNodePtr, size_t> *const_map_ptr, debugger::GraphProto *const graph_proto,
|
std::map<AnfNodePtr, size_t> *const_map_ptr, debugger::GraphProto *const graph_proto);
|
||||||
LocDebugDumpMode dump_location = kDebugWholeStack);
|
|
||||||
void ExportFuncGraphOutput(const FuncGraphPtr &func_graph, const CNodePtr &ret_node,
|
void ExportFuncGraphOutput(const FuncGraphPtr &func_graph, const CNodePtr &ret_node,
|
||||||
const std::map<AnfNodePtr, size_t> &apply_map, std::map<AnfNodePtr, size_t> *const_map_ptr,
|
const std::map<AnfNodePtr, size_t> &apply_map, std::map<AnfNodePtr, size_t> *const_map_ptr,
|
||||||
debugger::GraphProto *graph_proto);
|
debugger::GraphProto *graph_proto);
|
||||||
|
|
|
@ -237,7 +237,7 @@ void EnvConfigParser::ConfigToString() {
|
||||||
cur_config.append(rdr_path_);
|
cur_config.append(rdr_path_);
|
||||||
cur_config.append(", rdr_enable: ");
|
cur_config.append(", rdr_enable: ");
|
||||||
std::string rdr_enable_flag = rdr_enabled_ ? "1" : "0";
|
std::string rdr_enable_flag = rdr_enabled_ ? "1" : "0";
|
||||||
cur_config.append(rdr_enable_flag);
|
(void)cur_config.append(rdr_enable_flag);
|
||||||
MS_LOG(INFO) << cur_config;
|
MS_LOG(INFO) << cur_config;
|
||||||
}
|
}
|
||||||
} // namespace mindspore
|
} // namespace mindspore
|
||||||
|
|
|
@ -119,7 +119,7 @@ void DeleteLoadUserUpdateState(const FuncGraphManagerPtr &manager, const AnfNode
|
||||||
const auto &update_state_cnode = load_user->cast<CNodePtr>();
|
const auto &update_state_cnode = load_user->cast<CNodePtr>();
|
||||||
constexpr size_t monad_index = 1;
|
constexpr size_t monad_index = 1;
|
||||||
const auto &monad = update_state_cnode->input(monad_index);
|
const auto &monad = update_state_cnode->input(monad_index);
|
||||||
manager->Replace(load_user, monad);
|
(void)manager->Replace(load_user, monad);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pattern2======================================
|
// Pattern2======================================
|
||||||
|
@ -167,8 +167,9 @@ void ReplaceLoadUserMakeTuple(const FuncGraphManagerPtr &manager, const FuncGrap
|
||||||
const auto &new_make_tuple = fg->NewCNode(new_make_tuple_inputs);
|
const auto &new_make_tuple = fg->NewCNode(new_make_tuple_inputs);
|
||||||
// Set abstract for the MakeTuple node.
|
// Set abstract for the MakeTuple node.
|
||||||
abstract::AbstractBasePtrList element_abstracts;
|
abstract::AbstractBasePtrList element_abstracts;
|
||||||
std::transform(new_make_tuple_inputs.begin() + 1, new_make_tuple_inputs.end(), std::back_inserter(element_abstracts),
|
(void)std::transform(new_make_tuple_inputs.begin() + 1, new_make_tuple_inputs.end(),
|
||||||
[](const AnfNodePtr &input) { return input->abstract(); });
|
std::back_inserter(element_abstracts),
|
||||||
|
[](const AnfNodePtr &input) { return input->abstract(); });
|
||||||
new_make_tuple->set_abstract(std::make_shared<abstract::AbstractTuple>(element_abstracts));
|
new_make_tuple->set_abstract(std::make_shared<abstract::AbstractTuple>(element_abstracts));
|
||||||
manager->Replace(make_tuple, new_make_tuple);
|
manager->Replace(make_tuple, new_make_tuple);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ class ByAttrDataConverter : public DataConverter {
|
||||||
return convert_func(obj, use_sig);
|
return convert_func(obj, use_sig);
|
||||||
}),
|
}),
|
||||||
attr_name_(attr_name) {}
|
attr_name_(attr_name) {}
|
||||||
|
~ByAttrDataConverter() override = default;
|
||||||
bool Matched(const py::object &obj) override { return py::hasattr(obj, attr_name_); }
|
bool Matched(const py::object &obj) override { return py::hasattr(obj, attr_name_); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -30,7 +30,7 @@ void PrimBpropOptGraphLevel2Info::TryFreeArgsValue(const ValuePtrList &op_args,
|
||||||
}
|
}
|
||||||
|
|
||||||
ValuePtrList new_args(op_args);
|
ValuePtrList new_args(op_args);
|
||||||
new_args.emplace_back(out);
|
(void)new_args.emplace_back(out);
|
||||||
TryFreeOneValue(new_args, args_value_using_info_);
|
TryFreeOneValue(new_args, args_value_using_info_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ void PrimBpropOptGraphLevel2Info::AalysisForTupleGetItem(const NodeUsersMap &nod
|
||||||
<< " TupleGetItem idx node:" << idx_node->ToString() << " idx Value :" << value_ptr;
|
<< " TupleGetItem idx node:" << idx_node->ToString() << " idx Value :" << value_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto idx = value_ptr->cast<Int64ImmPtr>()->value();
|
auto idx = LongToSize(value_ptr->cast<Int64ImmPtr>()->value());
|
||||||
arg_info->sub_using_info_[idx].using_flg_ = true;
|
arg_info->sub_using_info_[idx].using_flg_ = true;
|
||||||
ArgInfoRefresh(cnode, &(arg_info->sub_using_info_[idx]));
|
ArgInfoRefresh(cnode, &(arg_info->sub_using_info_[idx]));
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void PrimBpropOptGraphLevel2Info::ArgInfoRefresh(const std::shared_ptr<AnfNode>
|
||||||
}
|
}
|
||||||
|
|
||||||
PrimBpropOptimizer &PrimBpropOptimizer::GetPrimBpropOptimizerInst() {
|
PrimBpropOptimizer &PrimBpropOptimizer::GetPrimBpropOptimizerInst() {
|
||||||
static PrimBpropOptimizer g_prim_bprop_opt;
|
static PrimBpropOptimizer g_prim_bprop_opt = PrimBpropOptimizer();
|
||||||
return g_prim_bprop_opt;
|
return g_prim_bprop_opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -296,7 +296,7 @@ PrimBpropOptGraphLevel2InfoPtr PrimBpropOptimizer::PrimBpropOptStep2(
|
||||||
return level_2_graph_info;
|
return level_2_graph_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
FuncGraphPtr PrimBpropOptimizer::BpropGraphFinalOpt(const ResourcePtr &res) {
|
FuncGraphPtr PrimBpropOptimizer::BpropGraphFinalOpt(const ResourcePtr &res) const {
|
||||||
MS_EXCEPTION_IF_NULL(res);
|
MS_EXCEPTION_IF_NULL(res);
|
||||||
auto after_opt_bg = BpropGraphFinalOptPass(res);
|
auto after_opt_bg = BpropGraphFinalOptPass(res);
|
||||||
return after_opt_bg;
|
return after_opt_bg;
|
||||||
|
@ -339,7 +339,7 @@ void PrimBpropOptimizer::ArgsToAbs(const PrimitivePtr &prim, const ValuePtrList
|
||||||
arg_abs = arg_abs->PartialBroaden();
|
arg_abs = arg_abs->PartialBroaden();
|
||||||
MS_LOG(DEBUG) << "Broaden for " << prim->ToString();
|
MS_LOG(DEBUG) << "Broaden for " << prim->ToString();
|
||||||
}
|
}
|
||||||
(*abs_list).emplace_back(arg_abs);
|
(void)abs_list->emplace_back(arg_abs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,8 +351,8 @@ abstract::AbstractBasePtrList PrimBpropOptimizer::AddOutToAbsList(const ValuePtr
|
||||||
abstract::AbstractBasePtrList new_abs_list(abs_list);
|
abstract::AbstractBasePtrList new_abs_list(abs_list);
|
||||||
auto out_abs = out->ToAbstract();
|
auto out_abs = out->ToAbstract();
|
||||||
out_abs = out_abs->PartialBroaden();
|
out_abs = out_abs->PartialBroaden();
|
||||||
new_abs_list.emplace_back(out_abs);
|
(void)new_abs_list.emplace_back(out_abs);
|
||||||
new_abs_list.emplace_back(out_abs);
|
(void)new_abs_list.emplace_back(out_abs);
|
||||||
return new_abs_list;
|
return new_abs_list;
|
||||||
}
|
}
|
||||||
} // namespace pipeline
|
} // namespace pipeline
|
||||||
|
|
|
@ -100,6 +100,7 @@ struct ParamUsingInfo {
|
||||||
class PrimBpropOptGraphLevel2Info {
|
class PrimBpropOptGraphLevel2Info {
|
||||||
public:
|
public:
|
||||||
explicit PrimBpropOptGraphLevel2Info(const FuncGraphPtr &func_graph) : opt_func_graph_(func_graph) {}
|
explicit PrimBpropOptGraphLevel2Info(const FuncGraphPtr &func_graph) : opt_func_graph_(func_graph) {}
|
||||||
|
~PrimBpropOptGraphLevel2Info() = default;
|
||||||
|
|
||||||
const FuncGraphPtr &opt_func_graph() const { return opt_func_graph_; }
|
const FuncGraphPtr &opt_func_graph() const { return opt_func_graph_; }
|
||||||
|
|
||||||
|
@ -143,7 +144,7 @@ class PrimBpropOptimizer {
|
||||||
const ValuePtr &out);
|
const ValuePtr &out);
|
||||||
|
|
||||||
// do inline opt for final bprop graph
|
// do inline opt for final bprop graph
|
||||||
FuncGraphPtr BpropGraphFinalOpt(const ResourcePtr &res);
|
FuncGraphPtr BpropGraphFinalOpt(const ResourcePtr &res) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PrimBpropOptimizer() = default;
|
PrimBpropOptimizer() = default;
|
||||||
|
|
|
@ -90,7 +90,7 @@ class StackFrame : public Base {
|
||||||
AnalysisContextPtr current_context() const { return current_context_; }
|
AnalysisContextPtr current_context() const { return current_context_; }
|
||||||
AnalysisContextPtr parent_context() const { return parent_context_; }
|
AnalysisContextPtr parent_context() const { return parent_context_; }
|
||||||
|
|
||||||
AbstractBasePtrList &args_abs_list() { return args_abs_list_; }
|
const AbstractBasePtrList &args_abs_list() { return args_abs_list_; }
|
||||||
void set_args_abs_list(const AbstractBasePtrList &&args_abs_list) { args_abs_list_ = args_abs_list; }
|
void set_args_abs_list(const AbstractBasePtrList &&args_abs_list) { args_abs_list_ = args_abs_list; }
|
||||||
|
|
||||||
std::string ToString() const override {
|
std::string ToString() const override {
|
||||||
|
|
|
@ -53,12 +53,15 @@ static const std::vector<std::string> sub_module_names = {
|
||||||
"GE", // SM_GE
|
"GE", // SM_GE
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string GetSubModuleName(SubModuleId module_id) { return sub_module_names[module_id % NUM_SUBMODUES]; }
|
const std::string GetSubModuleName(SubModuleId module_id) {
|
||||||
|
return sub_module_names[static_cast<size_t>(module_id % NUM_SUBMODUES)];
|
||||||
|
}
|
||||||
|
|
||||||
// export GetTimeString for all sub modules
|
// export GetTimeString for all sub modules
|
||||||
std::string GetTimeString() {
|
std::string GetTimeString() {
|
||||||
#define BUFLEN 80
|
#define BUFLEN 80
|
||||||
char buf[BUFLEN] = {'\0'};
|
char buf[BUFLEN];
|
||||||
|
(void)memset(buf, '\0', BUFLEN);
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
time_t time_seconds = time(0);
|
time_t time_seconds = time(0);
|
||||||
struct tm now_time;
|
struct tm now_time;
|
||||||
|
|
|
@ -113,7 +113,7 @@ bool MsContext::set_backend_policy(const std::string &policy) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_TDTQUE
|
#ifdef ENABLE_TDTQUE
|
||||||
void MsContext::CreateTensorPrintThread(PrintThreadCrt ctr) {
|
void MsContext::CreateTensorPrintThread(const PrintThreadCrt &ctr) {
|
||||||
uint32_t device_id = get_param<uint32_t>(MS_CTX_DEVICE_ID);
|
uint32_t device_id = get_param<uint32_t>(MS_CTX_DEVICE_ID);
|
||||||
std::string kReceivePrefix = "TF_RECEIVE_";
|
std::string kReceivePrefix = "TF_RECEIVE_";
|
||||||
std::string channel_name = "_npu_log";
|
std::string channel_name = "_npu_log";
|
||||||
|
|
|
@ -149,7 +149,7 @@ class MsContext {
|
||||||
bool set_backend_policy(const std::string &policy);
|
bool set_backend_policy(const std::string &policy);
|
||||||
#ifdef ENABLE_TDTQUE
|
#ifdef ENABLE_TDTQUE
|
||||||
using PrintThreadCrt = std::function<std::thread(std::string &, acltdtChannelHandle *)>;
|
using PrintThreadCrt = std::function<std::thread(std::string &, acltdtChannelHandle *)>;
|
||||||
void CreateTensorPrintThread(PrintThreadCrt ctr);
|
void CreateTensorPrintThread(const PrintThreadCrt &ctr);
|
||||||
void DestroyTensorPrintThread();
|
void DestroyTensorPrintThread();
|
||||||
#endif
|
#endif
|
||||||
static void device_seter(DeviceSeter device) { seter_ = device; }
|
static void device_seter(DeviceSeter device) { seter_ = device; }
|
||||||
|
|
Loading…
Reference in New Issue