!21064 Fix pclint.
Merge pull request !21064 from gaoyong10/runtime_001
This commit is contained in:
commit
3fec06eab4
|
|
@ -37,8 +37,8 @@ void GatherActor::Init() {
|
|||
}
|
||||
|
||||
auto data = std::make_unique<OpData<DeviceTensor>>(data_arrow->to_op_id_, nullptr, data_arrow->to_input_index_);
|
||||
output_data_.emplace_back(data.get());
|
||||
output_data_by_output_index_[IntToSize(data_arrow->from_output_index_)].emplace_back(std::move(data));
|
||||
(void)output_data_.emplace_back(data.get());
|
||||
(void)output_data_by_output_index_[IntToSize(data_arrow->from_output_index_)].emplace_back(std::move(data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ void GatherActor::RunOpData(OpData<DeviceTensor> *input_data, OpContext<DeviceTe
|
|||
void GatherActor::RunOpControl(AID *input_control, OpContext<DeviceTensor> *context) {
|
||||
MS_EXCEPTION_IF_NULL(context);
|
||||
auto &sequential_num = context->sequential_num_;
|
||||
input_op_controls_[sequential_num].emplace_back(input_control);
|
||||
(void)input_op_controls_[sequential_num].emplace_back(input_control);
|
||||
|
||||
if (CheckLaunchCondition(context)) {
|
||||
FetchInputDeviceTensor(context);
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ void SwitchActor::AddInput(const KernelWithIndex node_with_index, const size_t b
|
|||
branch_inputs_pos_[branch].push_back(iter - input_nodes_.begin());
|
||||
return;
|
||||
}
|
||||
device_tensor_store_keys_.emplace_back(input_nodes_.size(), node.get());
|
||||
(void)device_tensor_store_keys_.emplace_back(input_nodes_.size(), node.get());
|
||||
branch_inputs_pos_[branch].push_back(input_nodes_.size());
|
||||
input_nodes_.push_back(node_with_index);
|
||||
return;
|
||||
|
|
@ -371,8 +371,8 @@ void SwitchActor::FetchInputDeviceTensor(OpContext<DeviceTensor> *context) {
|
|||
|
||||
auto control_iter = input_controls_.find(context->sequential_num_);
|
||||
if (control_iter != input_controls_.end()) {
|
||||
for_each(control_iter->second.begin(), control_iter->second.end(),
|
||||
[](auto &input_control) { input_control.second--; });
|
||||
(void)for_each(control_iter->second.begin(), control_iter->second.end(),
|
||||
[](auto &input_control) { input_control.second--; });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -426,7 +426,7 @@ void SwitchActor::SendOutput(OpContext<DeviceTensor> *context) {
|
|||
std::string error_info = "Failed to get backend node of switch actor output, actor:" + GetAID().Name() +
|
||||
" branch:" + std::to_string(index) +
|
||||
" index:" + std::to_string(result_arrow->from_output_index_) + " output pos" +
|
||||
std::to_string(branch_inputs_pos_[index][result_arrow->from_output_index_]) +
|
||||
std::to_string(branch_inputs_pos_[index][IntToSize(result_arrow->from_output_index_)]) +
|
||||
" output index" + std::to_string(result_arrow->to_input_index_);
|
||||
SET_OPCONTEXT_FAIL_RET_WITH_ERROR((*context), error_info);
|
||||
}
|
||||
|
|
@ -493,7 +493,7 @@ void SwitchActor::FetchInputNode(const ControlNodeParserPtr &parser) {
|
|||
if (backend_weight == nullptr) {
|
||||
MS_LOG(EXCEPTION) << "Cannot find backend node for weight node:" << AnfAlgo::GetNodeDebugString(input_node);
|
||||
}
|
||||
backend_parameters_[i].insert({backend_weight, 0});
|
||||
(void)backend_parameters_[i].emplace(backend_weight, 0);
|
||||
}
|
||||
}
|
||||
} // namespace runtime
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ void FetchWeightbyHostParameter(const AnfNodePtr &node, std::vector<AnfNodePtr>
|
|||
if (find((*dest_nodes).begin(), (*dest_nodes).end(), node) != (*dest_nodes).end()) {
|
||||
return;
|
||||
}
|
||||
(*dest_nodes).emplace_back(node);
|
||||
(void)((*dest_nodes).emplace_back(node));
|
||||
if (front_to_front_weight.find(node) == front_to_front_weight.end()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -76,10 +76,10 @@ void FetchParameterBySwitchNode(const AnfNodePtr &switch_node, FuncGraphToParame
|
|||
const auto &partial_inputs = partial_node->cast<CNodePtr>()->inputs();
|
||||
for (size_t j = kPartialInputStartPos; j < partial_inputs.size(); ++j) {
|
||||
if (CheckValidFuncGraphInput(partial_inputs[j])) {
|
||||
parameters.emplace_back(partial_inputs[j]);
|
||||
(void)parameters.emplace_back(partial_inputs[j]);
|
||||
}
|
||||
}
|
||||
(*graph_to_real_parameters)[func_graph].emplace_back(parameters);
|
||||
(void)((*graph_to_real_parameters)[func_graph].emplace_back(parameters));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,17 +106,17 @@ void FetchParameterBySwitchLayerNode(const AnfNodePtr &switch_layer_node, const
|
|||
// Get inputs in partial node.
|
||||
for (size_t j = kPartialInputStartPos; j < partial_inputs.size(); ++j) {
|
||||
if (CheckValidFuncGraphInput(partial_inputs[j])) {
|
||||
parameters.emplace_back(partial_inputs[j]);
|
||||
(void)parameters.emplace_back(partial_inputs[j]);
|
||||
}
|
||||
}
|
||||
|
||||
// Get inputs in call node.
|
||||
for (size_t j = kCallInputStartPos; j < call_inputs.size(); ++j) {
|
||||
if (CheckValidFuncGraphInput(call_inputs[j])) {
|
||||
parameters.emplace_back(call_inputs[j]);
|
||||
(void)parameters.emplace_back(call_inputs[j]);
|
||||
}
|
||||
}
|
||||
(*graph_to_real_parameters)[func_graph].emplace_back(parameters);
|
||||
(void)((*graph_to_real_parameters)[func_graph].emplace_back(parameters));
|
||||
} else if (tuple_inputs[i]->isa<ValueNode>() && IsValueNode<FuncGraph>(tuple_inputs[i])) {
|
||||
// Tuple branch is a call node.
|
||||
const auto &func_graph = GetValueNode<FuncGraphPtr>(tuple_inputs[i]);
|
||||
|
|
@ -125,11 +125,11 @@ void FetchParameterBySwitchLayerNode(const AnfNodePtr &switch_layer_node, const
|
|||
// Get inputs in call node.
|
||||
for (size_t j = kCallInputStartPos; j < call_inputs.size(); ++j) {
|
||||
if (CheckValidFuncGraphInput(call_inputs[j])) {
|
||||
parameters.emplace_back(call_inputs[j]);
|
||||
(void)parameters.emplace_back(call_inputs[j]);
|
||||
}
|
||||
}
|
||||
|
||||
(*graph_to_real_parameters)[func_graph].emplace_back(parameters);
|
||||
(void)(*graph_to_real_parameters)[func_graph].emplace_back(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +210,7 @@ std::pair<AnfNodePtr, DeviceContext *> FetchBackendNodeByFrontNode(
|
|||
if ((*invalid_node).find(front_node) != (*invalid_node).end()) {
|
||||
return std::pair<AnfNodePtr, DeviceContext *>();
|
||||
}
|
||||
(*invalid_node).insert(front_node);
|
||||
(void)(*invalid_node).insert(front_node);
|
||||
|
||||
const auto front_to_backend_iter = front_to_backend_parameter.find(front_node);
|
||||
if (front_to_backend_iter != front_to_backend_parameter.end()) {
|
||||
|
|
@ -258,11 +258,11 @@ std::vector<AnfNodePtr> FetchInputNodeByParameter(const AnfNodePtr ¶meter,
|
|||
}
|
||||
|
||||
// Record the node which has been collected.
|
||||
(*invalid_inputs).insert(parameter);
|
||||
(void)(*invalid_inputs).insert(parameter);
|
||||
|
||||
// If the parameter node is a parameter of host data source actor, return it.
|
||||
if (find(host_ds_parameters.begin(), host_ds_parameters.end(), parameter) != host_ds_parameters.end()) {
|
||||
input_nodes.emplace_back(parameter);
|
||||
(void)input_nodes.emplace_back(parameter);
|
||||
return input_nodes;
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ std::vector<AnfNodePtr> FetchInputNodeByParameter(const AnfNodePtr ¶meter,
|
|||
if (HasAbstractMonad(input) || HasAbstractRef(input)) {
|
||||
continue;
|
||||
}
|
||||
self_inputs.emplace_back(input);
|
||||
(void)self_inputs.emplace_back(input);
|
||||
}
|
||||
|
||||
const auto iter = find(self_inputs.begin(), self_inputs.end(), parameter);
|
||||
|
|
@ -294,11 +294,11 @@ std::vector<AnfNodePtr> FetchInputNodeByParameter(const AnfNodePtr ¶meter,
|
|||
}
|
||||
const auto input = parameters[pos];
|
||||
if (input->isa<CNode>()) {
|
||||
input_nodes.emplace_back(input);
|
||||
(void)input_nodes.emplace_back(input);
|
||||
} else if (input->isa<Parameter>()) {
|
||||
// If input is a parameter, you need to find its input recursively.
|
||||
auto inputs = FetchInputNodeByParameter(input, host_ds_parameters, invalid_inputs, graph_to_real_parameters);
|
||||
input_nodes.insert(input_nodes.end(), inputs.begin(), inputs.end());
|
||||
(void)input_nodes.insert(input_nodes.end(), inputs.begin(), inputs.end());
|
||||
}
|
||||
}
|
||||
return input_nodes;
|
||||
|
|
@ -322,7 +322,7 @@ std::vector<AnfNodePtr> FetchFuncGraphOutput(const FuncGraphPtr &func_graph, std
|
|||
std::vector<FuncGraphPtr> func_graphs = FetchFuncGraphbyCallNode(real_output.first);
|
||||
for (const auto &graph : func_graphs) {
|
||||
auto single_outputs = FetchFuncGraphOutput(graph, call_nodes);
|
||||
outputs.insert(outputs.end(), single_outputs.begin(), single_outputs.end());
|
||||
(void)outputs.insert(outputs.end(), single_outputs.begin(), single_outputs.end());
|
||||
}
|
||||
return outputs;
|
||||
}
|
||||
|
|
@ -336,7 +336,7 @@ std::vector<AnfNodePtr> FetchOutputByCallNode(const AnfNodePtr &call_node, std::
|
|||
if ((*call_nodes).find(call_node) != (*call_nodes).end()) {
|
||||
return outputs;
|
||||
}
|
||||
(*call_nodes).insert(call_node);
|
||||
(void)((*call_nodes).insert(call_node));
|
||||
|
||||
const auto func_graphs = FetchFuncGraphbyCallNode(call_node);
|
||||
|
||||
|
|
@ -348,12 +348,12 @@ std::vector<AnfNodePtr> FetchOutputByCallNode(const AnfNodePtr &call_node, std::
|
|||
outputs.push_back(graph_output);
|
||||
} else if (AnfAlgo::CheckPrimitiveType(graph_output, prim::kPrimSwitch)) {
|
||||
const auto &switch_outputs = FetchOutputBySwitchNode(graph_output, call_nodes, switch_nodes);
|
||||
outputs.insert(outputs.end(), switch_outputs.begin(), switch_outputs.end());
|
||||
(void)outputs.insert(outputs.end(), switch_outputs.begin(), switch_outputs.end());
|
||||
} else if (IsCallNode(graph_output)) {
|
||||
const auto &call_outputs = FetchOutputByCallNode(graph_output, call_nodes, switch_nodes);
|
||||
outputs.insert(outputs.end(), call_outputs.begin(), call_outputs.end());
|
||||
(void)outputs.insert(outputs.end(), call_outputs.begin(), call_outputs.end());
|
||||
} else if (graph_output->isa<CNode>()) {
|
||||
outputs.emplace_back(graph_output);
|
||||
(void)outputs.emplace_back(graph_output);
|
||||
} else if (graph_output->isa<ValueNode>()) {
|
||||
outputs.push_back(graph_output);
|
||||
} else {
|
||||
|
|
@ -372,7 +372,7 @@ std::vector<AnfNodePtr> FetchOutputBySwitchNode(const AnfNodePtr &switch_node, s
|
|||
if ((*switch_nodes).find(switch_node) != (*switch_nodes).end()) {
|
||||
return outputs;
|
||||
}
|
||||
(*switch_nodes).insert(switch_node);
|
||||
(void)((*switch_nodes).insert(switch_node));
|
||||
|
||||
if (!switch_node->isa<CNode>()) {
|
||||
MS_LOG(EXCEPTION) << "Invalid switch node:" << AnfAlgo::GetNodeDebugString(switch_node);
|
||||
|
|
@ -387,12 +387,12 @@ std::vector<AnfNodePtr> FetchOutputBySwitchNode(const AnfNodePtr &switch_node, s
|
|||
continue;
|
||||
} else if (AnfAlgo::CheckPrimitiveType(inputs[i], prim::kPrimSwitch)) {
|
||||
const auto &switch_outputs = FetchOutputBySwitchNode(inputs[i], call_nodes, switch_nodes);
|
||||
outputs.insert(outputs.end(), switch_outputs.begin(), switch_outputs.end());
|
||||
(void)outputs.insert(outputs.end(), switch_outputs.begin(), switch_outputs.end());
|
||||
} else if (IsCallNode(inputs[i])) {
|
||||
const auto &call_outputs = FetchOutputByCallNode(inputs[i], call_nodes, switch_nodes);
|
||||
outputs.insert(outputs.end(), call_outputs.begin(), call_outputs.end());
|
||||
(void)outputs.insert(outputs.end(), call_outputs.begin(), call_outputs.end());
|
||||
} else {
|
||||
outputs.emplace_back(inputs[i]);
|
||||
(void)outputs.emplace_back(inputs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -425,13 +425,13 @@ std::vector<AnfNodePtr> FetchParameterByControlNode(const std::vector<AnfNodePtr
|
|||
} else if (AnfAlgo::CheckPrimitiveType(control_node, prim::kPrimPartial)) {
|
||||
for (size_t i = kPartialInputStartPos; i < inputs.size(); ++i) {
|
||||
if (inputs[i]->isa<Parameter>()) {
|
||||
parameters.emplace_back(inputs[i]);
|
||||
(void)parameters.emplace_back(inputs[i]);
|
||||
}
|
||||
}
|
||||
} else if (cnode->input(0)->isa<CNode>() || IsValueNode<FuncGraph>(cnode->input(0))) {
|
||||
for (size_t i = kCallInputStartPos; i < inputs.size(); ++i) {
|
||||
if (inputs[i]->isa<Parameter>()) {
|
||||
parameters.emplace_back(inputs[i]);
|
||||
(void)parameters.emplace_back(inputs[i]);
|
||||
}
|
||||
}
|
||||
} else if (AnfAlgo::CheckPrimitiveType(control_node, prim::kPrimSwitch)) {
|
||||
|
|
@ -439,14 +439,14 @@ std::vector<AnfNodePtr> FetchParameterByControlNode(const std::vector<AnfNodePtr
|
|||
MS_LOG(EXCEPTION) << "Invalid switch node:" << AnfAlgo::GetNodeDebugString(control_node);
|
||||
}
|
||||
if (inputs[kSwitchCondPos]->isa<Parameter>()) {
|
||||
parameters.emplace_back(inputs[kSwitchCondPos]);
|
||||
(void)parameters.emplace_back(inputs[kSwitchCondPos]);
|
||||
}
|
||||
} else if (AnfAlgo::CheckPrimitiveType(control_node, prim::kPrimSwitchLayer)) {
|
||||
if (inputs.size() != kSwitchLayerInputNum) {
|
||||
MS_LOG(EXCEPTION) << "Invalid switch node:" << AnfAlgo::GetNodeDebugString(control_node);
|
||||
}
|
||||
if (inputs[kSwitchLayerCondPos]->isa<Parameter>()) {
|
||||
parameters.emplace_back(inputs[kSwitchLayerCondPos]);
|
||||
(void)parameters.emplace_back(inputs[kSwitchLayerCondPos]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -492,7 +492,7 @@ AnfNodePtr FetchRealOutputByCallNode(const AnfNodePtr &node, std::set<AnfNodePtr
|
|||
if ((*call_nodes).find(real_node) != (*call_nodes).end()) {
|
||||
return nullptr;
|
||||
}
|
||||
(*call_nodes).insert(real_node);
|
||||
(void)((*call_nodes).insert(real_node));
|
||||
|
||||
const auto &func_graphs = FetchFuncGraphbyCallNode(real_node);
|
||||
for (const auto &func_graph : func_graphs) {
|
||||
|
|
@ -560,7 +560,7 @@ std::vector<KernelWithIndex> FetchAllRealInputNodeByParameter(const KernelWithIn
|
|||
const auto &real_node = real_node_with_index.first;
|
||||
if (real_node->isa<Parameter>()) {
|
||||
if (!HasAbstractRef(real_node) && !HasAbstractMonad(real_node)) {
|
||||
parameters.emplace_back(real_node_with_index);
|
||||
(void)parameters.emplace_back(real_node_with_index);
|
||||
}
|
||||
} else if (HasAbstractMonad(real_node)) {
|
||||
return parameters;
|
||||
|
|
@ -568,10 +568,10 @@ std::vector<KernelWithIndex> FetchAllRealInputNodeByParameter(const KernelWithIn
|
|||
const auto &inputs = real_node->cast<CNodePtr>()->inputs();
|
||||
for (size_t i = kMakeTupleInputStartPos; i < inputs.size(); ++i) {
|
||||
const auto &sub_parameters = FetchAllRealInputNodeByParameter({inputs[i], 0});
|
||||
parameters.insert(parameters.end(), sub_parameters.begin(), sub_parameters.end());
|
||||
(void)parameters.insert(parameters.end(), sub_parameters.begin(), sub_parameters.end());
|
||||
}
|
||||
} else {
|
||||
parameters.emplace_back(real_node_with_index);
|
||||
(void)parameters.emplace_back(real_node_with_index);
|
||||
}
|
||||
return parameters;
|
||||
}
|
||||
|
|
@ -589,9 +589,9 @@ std::vector<FuncGraphPtr> FetchFuncGraphbyCallNode(const AnfNodePtr &node) {
|
|||
if (AnfAlgo::CheckPrimitiveType(cnode, prim::kPrimSwitch)) {
|
||||
for (size_t i = kSwitchTrueBranchPos; i < cnode_inputs.size(); ++i) {
|
||||
if (IsPrimitiveCNode(cnode_inputs[i], prim::kPrimPartial)) {
|
||||
func_graphs.emplace_back(GetFuncGraphFromPartial(cnode_inputs[i]));
|
||||
(void)func_graphs.emplace_back(GetFuncGraphFromPartial(cnode_inputs[i]));
|
||||
} else if (IsValueNode<FuncGraph>(cnode_inputs[i])) {
|
||||
func_graphs.emplace_back(GetValueNode<FuncGraphPtr>(cnode_inputs[i]));
|
||||
(void)func_graphs.emplace_back(GetValueNode<FuncGraphPtr>(cnode_inputs[i]));
|
||||
}
|
||||
}
|
||||
} else if (AnfAlgo::CheckPrimitiveType(cnode, prim::kPrimSwitchLayer) &&
|
||||
|
|
@ -611,7 +611,7 @@ std::vector<FuncGraphPtr> FetchFuncGraphbyCallNode(const AnfNodePtr &node) {
|
|||
MS_LOG(EXCEPTION) << "Unable to identify call node" << node->DebugString();
|
||||
}
|
||||
} else if (call_inputs[0]->isa<ValueNode>() && IsValueNode<FuncGraph>(call_inputs[0])) {
|
||||
func_graphs.emplace_back(GetValueNode<FuncGraphPtr>(call_inputs[0]));
|
||||
(void)func_graphs.emplace_back(GetValueNode<FuncGraphPtr>(call_inputs[0]));
|
||||
} else {
|
||||
MS_LOG(EXCEPTION) << "Unable to identify call node" << node->DebugString();
|
||||
}
|
||||
|
|
@ -625,7 +625,7 @@ size_t FetchOutputSizebyCallNode(const AnfNodePtr &node, std::vector<AnfNodePtr>
|
|||
if (find((*call_nodes).begin(), (*call_nodes).end(), node) != (*call_nodes).end()) {
|
||||
return 0;
|
||||
}
|
||||
(*call_nodes).emplace_back(node);
|
||||
(void)((*call_nodes).emplace_back(node));
|
||||
|
||||
const auto &func_graphs = FetchFuncGraphbyCallNode(node);
|
||||
for (const auto &func_graph : func_graphs) {
|
||||
|
|
@ -745,7 +745,7 @@ void ControlNodeParser::Parse(const std::vector<AnfNodePtr> &control_nodes, cons
|
|||
RealToFormalNode formal_to_real_front_parameters;
|
||||
for (const auto real_to_formal_front_parameter : real_to_formal_front_parameters) {
|
||||
for (const auto formal_parameter : real_to_formal_front_parameter.second) {
|
||||
formal_to_real_front_parameters[formal_parameter].emplace_back(real_to_formal_front_parameter.first);
|
||||
(void)formal_to_real_front_parameters[formal_parameter].emplace_back(real_to_formal_front_parameter.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -873,7 +873,7 @@ void ControlNodeParser::FetchValueNodeBySwitchNode(const AnfNodePtr &switch_node
|
|||
if (input->isa<ValueNode>()) {
|
||||
const auto &node_value = input->cast<ValueNodePtr>()->value();
|
||||
if (node_value->isa<tensor::Tensor>()) {
|
||||
(*value_nodes).emplace_back(input);
|
||||
(void)((*value_nodes).emplace_back(input));
|
||||
}
|
||||
} else if (IsCallNode(input)) {
|
||||
// If input is a call not, should check the switch node in its input.
|
||||
|
|
@ -893,7 +893,7 @@ void ControlNodeParser::FetchValueNodeBySwitchNode(const AnfNodePtr &switch_node
|
|||
// if input is a partial node, get the value node in its funcgraph.
|
||||
const auto &func_graph = GetValueNode<FuncGraphPtr>(partial_inputs[kPartialFuncGraphPos]);
|
||||
if (func_graph->output()->isa<ValueNode>()) {
|
||||
(*value_nodes).emplace_back(func_graph->output());
|
||||
(void)((*value_nodes).emplace_back(func_graph->output()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -924,14 +924,14 @@ void ControlNodeParser::FetchFrontValueNode(const std::vector<AnfNodePtr> &contr
|
|||
<< AnfAlgo::GetNodeDebugString(parameters[i - kCallInputStartPos])
|
||||
<< ", used the default format";
|
||||
CreateDeviceTensorForFrontParameter(inputs[i], device_contexts[0]);
|
||||
front_value_nodes_.emplace_back(inputs[i], device_contexts[0]);
|
||||
(void)front_value_nodes_.emplace_back(inputs[i], device_contexts[0]);
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto &backend_node = front_to_backend_parameters_[parameters[i - kCallInputStartPos]].first;
|
||||
const auto &device_context = front_to_backend_parameters_[parameters[i - kCallInputStartPos]].second;
|
||||
CreateDeviceTensorForValueNode(inputs[i], backend_node, device_context);
|
||||
front_value_nodes_.emplace_back(inputs[i], device_context);
|
||||
(void)front_value_nodes_.emplace_back(inputs[i], device_context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -956,7 +956,7 @@ void ControlNodeParser::FetchFrontValueNode(const std::vector<AnfNodePtr> &contr
|
|||
FetchValueNodeBySwitchNode(front_output_node, &value_nodes);
|
||||
for (const auto value_node : value_nodes) {
|
||||
CreateDeviceTensorForValueNode(value_node, parameter, device_contexts[index]);
|
||||
front_value_nodes_.emplace_back(value_node, device_contexts[index]);
|
||||
(void)front_value_nodes_.emplace_back(value_node, device_contexts[index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -972,7 +972,7 @@ void ControlNodeParser::FetchFrontValueNode(const std::vector<AnfNodePtr> &contr
|
|||
if (output->isa<ValueNode>() && GetFrontValueNodeDeviceContext(output) == nullptr) {
|
||||
const auto &device_context = call_node_to_backend_parameter.second.second;
|
||||
CreateDeviceTensorForValueNode(output, call_node_to_backend_parameter.second.first, device_context);
|
||||
front_value_nodes_.emplace_back(output, device_context);
|
||||
(void)front_value_nodes_.emplace_back(output, device_context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1082,7 +1082,7 @@ std::vector<AnfNodePtr> ControlNodeParser::FetchControlNodeParameter(const std::
|
|||
for (const auto &input : inputs) {
|
||||
const auto &front_node = graph->GetFrontAnfByBackendAnf(input);
|
||||
if (front_node != nullptr && front_node->isa<Parameter>() && (!HasAbstractRef(front_node))) {
|
||||
parameters.emplace_back(front_node);
|
||||
(void)parameters.emplace_back(front_node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1092,7 +1092,7 @@ std::vector<AnfNodePtr> ControlNodeParser::FetchControlNodeParameter(const std::
|
|||
if (backend_iter == front_to_backend_parameters_.end()) {
|
||||
CreateDeviceTensorForFrontParameter(parameter, device_context);
|
||||
front_to_backend_parameters_[parameter] = {parameter, device_context};
|
||||
front_parameters_.emplace_back(parameter, device_context);
|
||||
(void)front_parameters_.emplace_back(parameter, device_context);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1154,7 +1154,7 @@ std::vector<AnfNodePtr> FetchInputParameterbyControlNode(const AnfNodePtr &node,
|
|||
if ((*switch_nodes).find(node) != (*switch_nodes).end()) {
|
||||
return parameters;
|
||||
}
|
||||
(*switch_nodes).insert(node);
|
||||
(void)(*switch_nodes).insert(node);
|
||||
|
||||
const auto &cnode = node->cast<CNodePtr>();
|
||||
const auto &inputs = cnode->inputs();
|
||||
|
|
@ -1164,22 +1164,22 @@ std::vector<AnfNodePtr> FetchInputParameterbyControlNode(const AnfNodePtr &node,
|
|||
|
||||
for (size_t i = kSwitchTrueBranchPos; i < kSwitchInputNum; ++i) {
|
||||
if (inputs[i]->isa<Parameter>()) {
|
||||
parameters.emplace_back(inputs[i]);
|
||||
(void)parameters.emplace_back(inputs[i]);
|
||||
} else if (IsCallNode(inputs[i]) || AnfAlgo::CheckPrimitiveType(inputs[i], prim::kPrimSwitch)) {
|
||||
const auto &sub_parameters = FetchInputParameterbyControlNode(inputs[i], switch_nodes, call_nodes);
|
||||
parameters.insert(parameters.end(), sub_parameters.begin(), sub_parameters.end());
|
||||
(void)parameters.insert(parameters.end(), sub_parameters.begin(), sub_parameters.end());
|
||||
}
|
||||
}
|
||||
} else if (IsCallNode(node)) {
|
||||
if ((*call_nodes).find(node) != (*call_nodes).end()) {
|
||||
return parameters;
|
||||
}
|
||||
(*call_nodes).insert(node);
|
||||
(void)(*call_nodes).insert(node);
|
||||
|
||||
const auto &func_graphs = FetchFuncGraphbyCallNode(node);
|
||||
for (const auto &func_graph : func_graphs) {
|
||||
if (func_graph->output()->isa<Parameter>()) {
|
||||
parameters.emplace_back(func_graph->output());
|
||||
(void)parameters.emplace_back(func_graph->output());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1204,7 +1204,7 @@ std::vector<KernelWithIndex> FetchParameterbyKernelGraph(const KernelGraphPtr &g
|
|||
const auto &front_node_with_index =
|
||||
((external_front_node != nullptr) ? KernelWithIndex(external_front_node, 0) : internal_front_node_with_index);
|
||||
const auto &sub_parameters = FetchAllRealInputNodeByParameter(front_node_with_index);
|
||||
parameters.insert(parameters.end(), sub_parameters.begin(), sub_parameters.end());
|
||||
(void)parameters.insert(parameters.end(), sub_parameters.begin(), sub_parameters.end());
|
||||
}
|
||||
|
||||
return parameters;
|
||||
|
|
@ -1311,10 +1311,10 @@ void ControlNodeParser::FetchFuncGraphToParameter(const std::vector<AnfNodePtr>
|
|||
std::vector<AnfNodePtr> parameters;
|
||||
for (size_t i = kCallInputStartPos; i < inputs.size(); ++i) {
|
||||
if (CheckValidFuncGraphInput(inputs[i])) {
|
||||
parameters.emplace_back(inputs[i]);
|
||||
(void)parameters.emplace_back(inputs[i]);
|
||||
}
|
||||
}
|
||||
func_graph_to_parameters_[func_graph].emplace_back(parameters);
|
||||
(void)func_graph_to_parameters_[func_graph].emplace_back(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1352,12 +1352,12 @@ void ControlNodeParser::FetchBackendOutputByFrontOutput(const AnfNodePtr &front_
|
|||
std::set<AnfNodePtr> *switch_nodes,
|
||||
std::set<KernelWithIndex> *results) {
|
||||
if (front_output->isa<ValueNode>()) {
|
||||
(*results).emplace(front_output, 0);
|
||||
(void)(*results).emplace(front_output, 0);
|
||||
|
||||
const auto &iter = formal_to_real_parameters_.find(front_output);
|
||||
if (iter != formal_to_real_parameters_.end()) {
|
||||
for (const auto &node : iter->second) {
|
||||
(*results).emplace(node);
|
||||
(void)(*results).emplace(node);
|
||||
}
|
||||
}
|
||||
} else if (front_output->isa<Parameter>()) {
|
||||
|
|
@ -1366,7 +1366,7 @@ void ControlNodeParser::FetchBackendOutputByFrontOutput(const AnfNodePtr &front_
|
|||
|
||||
if (iter != formal_to_real_parameters_.end()) {
|
||||
for (const auto &node : iter->second) {
|
||||
(*results).emplace(node);
|
||||
(void)(*results).emplace(node);
|
||||
}
|
||||
} else {
|
||||
MS_LOG(EXCEPTION) << "Cannot find backend node for front parameter:" << AnfAlgo::GetNodeDebugString(front_output);
|
||||
|
|
@ -1398,7 +1398,7 @@ void ControlNodeParser::FetchBackendOutputByFrontOutput(const AnfNodePtr &front_
|
|||
const auto iter = front_to_backend_kernels_.find(AnfAlgo::VisitKernelWithReturnType(front_output, 0));
|
||||
|
||||
if (iter != front_to_backend_kernels_.end()) {
|
||||
(*results).emplace(iter->second.first);
|
||||
(void)(*results).emplace(iter->second.first);
|
||||
} else {
|
||||
MS_LOG(EXCEPTION) << "Cannot find backend node for front kernel:" << AnfAlgo::GetNodeDebugString(front_output);
|
||||
}
|
||||
|
|
@ -1425,17 +1425,17 @@ void ControlNodeParser::FetchBackendInputNodebyFrontNode(
|
|||
MS_LOG(WARNING) << "Cannot find backend node of node:" << AnfAlgo::GetNodeDebugString(node_with_index.first);
|
||||
continue;
|
||||
}
|
||||
formal_to_real_parameters_[formal_parameter].emplace_back(iter->second.first, 0);
|
||||
(void)formal_to_real_parameters_[formal_parameter].emplace_back(iter->second.first, 0);
|
||||
} else {
|
||||
const auto iter = front_to_backend_kernels_.find(node_with_index);
|
||||
if (iter == front_to_backend_kernels_.end()) {
|
||||
MS_LOG(EXCEPTION) << "Cannot find actor of front node:" << AnfAlgo::GetNodeDebugString(node_with_index.first);
|
||||
}
|
||||
formal_to_real_parameters_[formal_parameter].emplace_back(iter->second.first);
|
||||
(void)formal_to_real_parameters_[formal_parameter].emplace_back(iter->second.first);
|
||||
}
|
||||
}
|
||||
} else if (real_parameter->isa<ValueNode>()) {
|
||||
formal_to_real_parameters_[formal_parameter].emplace_back(real_parameter, 0);
|
||||
(void)formal_to_real_parameters_[formal_parameter].emplace_back(real_parameter, 0);
|
||||
} else if (IsCallNode(real_parameter)) {
|
||||
const auto func_graphs = FetchFuncGraphbyCallNode(real_parameter);
|
||||
for (const auto func_graph : func_graphs) {
|
||||
|
|
@ -1448,7 +1448,7 @@ void ControlNodeParser::FetchBackendInputNodebyFrontNode(
|
|||
if (iter == front_to_backend_kernels_.end()) {
|
||||
MS_LOG(EXCEPTION) << "Cannot find backend node of node:" << AnfAlgo::GetNodeDebugString(node_with_index.first);
|
||||
}
|
||||
formal_to_real_parameters_[formal_parameter].emplace_back(iter->second.first);
|
||||
(void)formal_to_real_parameters_[formal_parameter].emplace_back(iter->second.first);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1508,7 +1508,7 @@ void ControlNodeParser::FetchBackendInputNode(const std::vector<KernelGraphPtr>
|
|||
auto front_node = graph->GetFrontAnfByBackendAnf(value_node);
|
||||
|
||||
if (front_node != nullptr) {
|
||||
formal_to_real_parameters_[front_node].emplace_back(value_node, 0);
|
||||
(void)formal_to_real_parameters_[front_node].emplace_back(value_node, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1517,7 +1517,7 @@ void ControlNodeParser::FetchBackendInputNode(const std::vector<KernelGraphPtr>
|
|||
for (const auto &front_weight : host_parameter_to_weight.second) {
|
||||
const auto &iter = front_to_backend_parameters_.find(host_parameter_to_weight.first);
|
||||
if (iter != front_to_backend_parameters_.end()) {
|
||||
formal_to_real_parameters_[front_weight].emplace_back(iter->second.first, 0);
|
||||
(void)formal_to_real_parameters_[front_weight].emplace_back(iter->second.first, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1530,7 +1530,7 @@ void ControlNodeParser::FetchBackendInputNode(const std::vector<KernelGraphPtr>
|
|||
if (HasAbstractMonad(input) || (input->isa<Parameter>() && HasAbstractRef(input))) {
|
||||
continue;
|
||||
}
|
||||
graph_inputs.emplace_back(input);
|
||||
(void)graph_inputs.emplace_back(input);
|
||||
}
|
||||
|
||||
// Collect all backend input node to gather, There are two situations:
|
||||
|
|
@ -1548,10 +1548,10 @@ void ControlNodeParser::FetchBackendInputNode(const std::vector<KernelGraphPtr>
|
|||
}
|
||||
}
|
||||
for (const auto parameter_pair : front_to_backend_parameters) {
|
||||
formal_to_real_parameters_[parameter_pair.first].emplace_back(parameter_pair.second.first, 0);
|
||||
(void)formal_to_real_parameters_[parameter_pair.first].emplace_back(parameter_pair.second.first, 0);
|
||||
}
|
||||
for (const auto parameter_pair : front_to_backend_parameters_) {
|
||||
formal_to_real_parameters_[parameter_pair.first].emplace_back(parameter_pair.second.first, 0);
|
||||
(void)formal_to_real_parameters_[parameter_pair.first].emplace_back(parameter_pair.second.first, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -568,7 +568,7 @@ void GraphScheduler::Schedule(const ActorSet *actor_set) {
|
|||
}
|
||||
for (auto &gather_actor : actor_set->gather_actors_) {
|
||||
MS_EXCEPTION_IF_NULL(gather_actor);
|
||||
actors.emplace_back(static_cast<ActorReference>(gather_actor));
|
||||
(void)actors.emplace_back(static_cast<ActorReference>(gather_actor));
|
||||
}
|
||||
for (auto ©_actor : actor_set->copy_actors_) {
|
||||
MS_EXCEPTION_IF_NULL(copy_actor);
|
||||
|
|
@ -1033,18 +1033,19 @@ std::vector<DataSourceActorPtr> GraphScheduler::BuildDataSourceActor(const Graph
|
|||
host_queue_ds_actor =
|
||||
std::make_shared<HostQueueDataSourceActor>(actor_name, 1, memory_manager_aid_, nullptr, nullptr, host_queue);
|
||||
InsertActor(host_queue_ds_actor.get());
|
||||
data_source_actors.emplace_back(host_queue_ds_actor);
|
||||
(void)data_source_actors.emplace_back(host_queue_ds_actor);
|
||||
}
|
||||
|
||||
const auto &backend_node = backend_iter->second.first;
|
||||
auto iter = find(host_queue_ds_actor->data_nodes_.begin(), host_queue_ds_actor->data_nodes_.end(), backend_node);
|
||||
|
||||
if (iter != host_queue_ds_actor->data_nodes_.end()) {
|
||||
host_queue_ds_actor->data_node_position_map_.emplace(parameter, iter - host_queue_ds_actor->data_nodes_.begin());
|
||||
(void)host_queue_ds_actor->data_node_position_map_.emplace(parameter,
|
||||
iter - host_queue_ds_actor->data_nodes_.begin());
|
||||
} else {
|
||||
host_queue_ds_actor->data_node_position_map_.emplace(parameter, host_queue_ds_actor->data_nodes_.size());
|
||||
host_queue_ds_actor->data_nodes_.emplace_back(backend_iter->second.first);
|
||||
host_queue_ds_actor->device_contexts_.emplace_back(backend_iter->second.second);
|
||||
(void)host_queue_ds_actor->data_node_position_map_.emplace(parameter, host_queue_ds_actor->data_nodes_.size());
|
||||
(void)host_queue_ds_actor->data_nodes_.emplace_back(backend_iter->second.first);
|
||||
(void)host_queue_ds_actor->device_contexts_.emplace_back(backend_iter->second.second);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1195,7 +1196,7 @@ std::vector<SwitchActorPtr> GraphScheduler::BuildSwitchActor(const GraphCompiler
|
|||
// Fetch all the input nodes of switch actor.
|
||||
switch_actor->FetchInputNode(graph_compiler_info.control_node_parser_);
|
||||
InsertActor(switch_actor.get());
|
||||
switch_actors.emplace_back(switch_actor);
|
||||
(void)switch_actors.emplace_back(switch_actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1212,7 +1213,7 @@ std::vector<SwitchActorPtr> GraphScheduler::BuildSwitchActor(const GraphCompiler
|
|||
// Fetch all the input nodes of switch actor.
|
||||
switch_actor->FetchInputNode(graph_compiler_info.control_node_parser_);
|
||||
InsertActor(switch_actor.get());
|
||||
switch_actors.emplace_back(switch_actor);
|
||||
(void)switch_actors.emplace_back(switch_actor);
|
||||
}
|
||||
|
||||
return switch_actors;
|
||||
|
|
@ -1262,7 +1263,7 @@ std::vector<GatherActorPtr> GraphScheduler::BuildGatherActor(const GraphCompiler
|
|||
if (HasAbstractMonad(parameter) || HasAbstractRef(parameter)) {
|
||||
continue;
|
||||
}
|
||||
parameters.emplace_back(parameter, 0);
|
||||
(void)parameters.emplace_back(parameter, 0);
|
||||
}
|
||||
|
||||
const auto branch_id = parser->GetBranchIDByFuncGraph(func_graph);
|
||||
|
|
@ -1275,7 +1276,7 @@ std::vector<GatherActorPtr> GraphScheduler::BuildGatherActor(const GraphCompiler
|
|||
std::make_shared<GatherActor>(actor_name, parameters, true, output_switch_aid, AID(), branch_id);
|
||||
gather_actor->FetchBackendInputNode(func_graph, graph_compiler_info.control_node_parser_);
|
||||
InsertActor(gather_actor.get());
|
||||
gather_actors.emplace_back(gather_actor);
|
||||
(void)gather_actors.emplace_back(gather_actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1291,7 +1292,7 @@ std::vector<GatherActorPtr> GraphScheduler::BuildGatherActor(const GraphCompiler
|
|||
if (HasAbstractMonad(inputs[i]) || (inputs[i]->isa<Parameter>() && HasAbstractRef(inputs[i]))) {
|
||||
continue;
|
||||
}
|
||||
parameters.emplace_back(inputs[i], 0);
|
||||
(void)parameters.emplace_back(inputs[i], 0);
|
||||
}
|
||||
|
||||
auto func_graph = control_node->func_graph();
|
||||
|
|
@ -1304,7 +1305,7 @@ std::vector<GatherActorPtr> GraphScheduler::BuildGatherActor(const GraphCompiler
|
|||
gather_actor->FetchBackendInputNode(func_graph, graph_compiler_info.control_node_parser_);
|
||||
|
||||
InsertActor(gather_actor.get());
|
||||
gather_actors.emplace_back(gather_actor);
|
||||
(void)gather_actors.emplace_back(gather_actor);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1317,7 +1318,7 @@ std::vector<GatherActorPtr> GraphScheduler::BuildGatherActor(const GraphCompiler
|
|||
auto actor_name = graph->ToString();
|
||||
auto gather_actor = std::make_shared<GatherActor>(actor_name, parameters, false, AID(), AID(), kInvalidBranchID);
|
||||
InsertActor(gather_actor.get());
|
||||
gather_actors.emplace_back(gather_actor);
|
||||
(void)gather_actors.emplace_back(gather_actor);
|
||||
}
|
||||
|
||||
return gather_actors;
|
||||
|
|
@ -1337,8 +1338,8 @@ void GraphScheduler::LinkDataArrow(KernelActor *to_actor, const GraphCompilerInf
|
|||
const auto &real_front_node_with_index =
|
||||
AnfAlgo::VisitKernelWithReturnType(kernel_with_index.first, SizeToInt(kernel_with_index.second));
|
||||
if (HasAbstractRef(real_front_node_with_index.first)) {
|
||||
to_actor->device_tensor_store_keys_.emplace_back(to_kernel_with_input_idx.second,
|
||||
real_front_node_with_index.first.get());
|
||||
(void)to_actor->device_tensor_store_keys_.emplace_back(to_kernel_with_input_idx.second,
|
||||
real_front_node_with_index.first.get());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1365,7 +1366,7 @@ void GraphScheduler::LinkDataArrow(KernelActor *to_actor, const GraphCompilerInf
|
|||
auto actor_name = func_graph->ToString();
|
||||
const auto &from_actor = dynamic_cast<GatherActor *>(FetchActor(actor_name));
|
||||
if (HasAbstractRef(from_kernel)) {
|
||||
to_actor->device_tensor_store_keys_.emplace_back(to_kernel_with_input_idx.second, front_node.get());
|
||||
(void)to_actor->device_tensor_store_keys_.emplace_back(to_kernel_with_input_idx.second, front_node.get());
|
||||
return;
|
||||
}
|
||||
LinkDataArrowForGatherActor(from_actor, to_actor, {front_node, 0}, to_kernel_with_input_idx);
|
||||
|
|
@ -1901,7 +1902,7 @@ void GraphScheduler::LinkOutputResultArrowForOutputActor(OutputActor *to_actor,
|
|||
|
||||
// The graph output is from device tensor store.
|
||||
if (IsPersistentDeviceTensor(output_with_index.first)) {
|
||||
to_actor->device_tensor_store_keys_.emplace_back(output_position, output_with_index.first);
|
||||
(void)to_actor->device_tensor_store_keys_.emplace_back(output_position, output_with_index.first);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -1986,7 +1987,7 @@ void GraphScheduler::LinkOutputResultArrowForSwitchActor(const GraphCompilerInfo
|
|||
for (const auto output_pos : output_poses) {
|
||||
auto op_arrow = std::make_shared<DataArrow>(output_index, to_actor->GetAID(), output_pos);
|
||||
to_actor->device_contexts_[output_pos] = switch_actor->device_context_;
|
||||
switch_actor->output_branch_result_arrows_[branch_index].emplace_back(op_arrow);
|
||||
(void)switch_actor->output_branch_result_arrows_[branch_index].emplace_back(op_arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2015,10 +2016,10 @@ void GraphScheduler::LinkOutputResultArrowForSwitchActor(const GraphCompilerInfo
|
|||
|
||||
for (const auto pos : iter->second) {
|
||||
auto op_arrow = std::make_shared<DataArrow>(0, to_actor->GetAID(), pos);
|
||||
from_actor->output_branch_result_arrows_[i].emplace_back(op_arrow);
|
||||
(void)from_actor->output_branch_result_arrows_[i].emplace_back(op_arrow);
|
||||
}
|
||||
|
||||
from_actor->output_branch_control_arrows_[i].emplace_back(loop_count_actor->GetAID());
|
||||
(void)from_actor->output_branch_control_arrows_[i].emplace_back(loop_count_actor->GetAID());
|
||||
}
|
||||
loop_count_actor->input_controls_num_++;
|
||||
}
|
||||
|
|
@ -2132,8 +2133,8 @@ void GraphScheduler::LinkArrowByControlNode(const GraphCompilerInfo &graph_compi
|
|||
continue;
|
||||
}
|
||||
|
||||
gather_actor->device_tensor_store_keys_.emplace_back(i - kCallInputStartPos - persist_input_num,
|
||||
inputs[i].get());
|
||||
(void)gather_actor->device_tensor_store_keys_.emplace_back(i - kCallInputStartPos - persist_input_num,
|
||||
inputs[i].get());
|
||||
gather_actor->device_contexts_[i - kCallInputStartPos - persist_input_num] =
|
||||
graph_compiler_info.control_node_parser_->GetFrontValueNodeDeviceContext(inputs[i]);
|
||||
} else if ((inputs[i]->isa<Parameter>() && HasAbstractRef(inputs[i]->cast<ParameterPtr>())) ||
|
||||
|
|
@ -2148,7 +2149,7 @@ void GraphScheduler::LinkArrowByControlNode(const GraphCompilerInfo &graph_compi
|
|||
|
||||
auto op_arrow = std::make_shared<DataArrow>(i - kCallInputStartPos - persist_input_num, to_actor->GetAID(),
|
||||
i - kCallInputStartPos - persist_input_num);
|
||||
gather_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
(void)gather_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2181,7 +2182,7 @@ void GraphScheduler::LinkArrowByControlNode(const GraphCompilerInfo &graph_compi
|
|||
}
|
||||
LinkBranchArrowForSwitchActor(graph_compiler_info);
|
||||
|
||||
LinkBranchArrowForGatherActor(graph_compiler_info, actor_set);
|
||||
LinkBranchArrowForGatherActor(graph_compiler_info);
|
||||
|
||||
LinkControlArrowForGatherActor(&(actor_set->kernel_actors_), graph_compiler_info.graphs_,
|
||||
graph_compiler_info.control_node_parser_);
|
||||
|
|
@ -2202,7 +2203,7 @@ void GraphScheduler::LinkDataArrowForGatherActor(GatherActor *from_actor, Kernel
|
|||
auto position = from_actor->FetchDataNodePosition(front_node_with_index);
|
||||
|
||||
auto op_arrow = std::make_shared<DataArrow>(position, to_actor->GetAID(), to_node_with_index.second);
|
||||
from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
(void)from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
to_actor->input_datas_num_++;
|
||||
}
|
||||
|
||||
|
|
@ -2258,7 +2259,7 @@ void GraphScheduler::LinkDataArrowForSwitchActor(SwitchActor *from_actor, const
|
|||
}
|
||||
auto op_arrow =
|
||||
std::make_shared<DataArrow>(from_actor->branch_inputs_pos_[i][from_index], to_actor->GetAID(), to_index);
|
||||
from_actor->output_branch_arrows_[i].emplace_back(op_arrow);
|
||||
(void)from_actor->output_branch_arrows_[i].emplace_back(op_arrow);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2279,7 +2280,7 @@ void GraphScheduler::LinkDataArrowByControlNode(const GraphCompilerInfo &graph_c
|
|||
auto from_actor = dynamic_cast<GatherActor *>(actor_name_to_actor_[input_node->func_graph()->ToString()]);
|
||||
auto position = from_actor->FetchDataNodePosition({input_node, 0});
|
||||
auto op_arrow = std::make_shared<DataArrow>(position, to_actor->GetAID(), to_index);
|
||||
from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
(void)from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
} else if (IsSwitchActor(input_node)) {
|
||||
const auto &actor_name = input_node->DebugString();
|
||||
auto actor = FetchActor(actor_name);
|
||||
|
|
@ -2302,7 +2303,7 @@ void GraphScheduler::LinkDataArrowByControlNode(const GraphCompilerInfo &graph_c
|
|||
MS_EXCEPTION_IF_NULL(from_actor);
|
||||
|
||||
auto op_arrow = std::make_shared<DataArrow>(backend_node.second, to_actor->GetAID(), to_index);
|
||||
from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
(void)from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
auto device_tensor = AnfAlgo::GetMutableOutputAddr(from_actor->kernel_, backend_node.second, false);
|
||||
UpdateRefCount(device_tensor.get(), true);
|
||||
return;
|
||||
|
|
@ -2310,7 +2311,7 @@ void GraphScheduler::LinkDataArrowByControlNode(const GraphCompilerInfo &graph_c
|
|||
|
||||
auto op_arrow = std::make_shared<DataArrow>(input_with_index.second, to_actor->GetAID(), to_index);
|
||||
auto from_actor = front_node_to_actor_[input_node];
|
||||
from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
(void)from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
auto device_tensor = AnfAlgo::GetMutableOutputAddr(from_actor->kernel_, input_with_index.second, false);
|
||||
UpdateRefCount(device_tensor.get(), true);
|
||||
} else if (find(parameters.begin(), parameters.end(), input_node) != parameters.end()) {
|
||||
|
|
@ -2336,7 +2337,7 @@ void GraphScheduler::LinkDataArrowByControlNode(const GraphCompilerInfo &graph_c
|
|||
}
|
||||
|
||||
auto op_arrow = std::make_shared<DataArrow>(iter->second, to_actor->GetAID(), to_index);
|
||||
from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
(void)from_actor->output_data_arrows_.emplace_back(op_arrow);
|
||||
auto device_tensor = AnfAlgo::GetMutableOutputAddr(from_actor->data_nodes_[iter->second], 0, false);
|
||||
UpdateRefCount(device_tensor.get(), true);
|
||||
} else {
|
||||
|
|
@ -2374,7 +2375,7 @@ void GraphScheduler::LinkDataArrowForSwitchActor(const GraphCompilerInfo &graph_
|
|||
for (size_t j = 0; j < actor->branch_inputs_pos_[i].size(); ++j) {
|
||||
auto pos = actor->branch_inputs_pos_[i][j];
|
||||
auto op_arrow = std::make_shared<DataArrow>(pos, to_actor->GetAID(), j);
|
||||
actor->output_branch_arrows_[i].emplace_back(op_arrow);
|
||||
(void)actor->output_branch_arrows_[i].emplace_back(op_arrow);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2404,7 +2405,7 @@ void GraphScheduler::LinkControlArrowForGatherActor(std::vector<KernelActorPtr>
|
|||
MS_EXCEPTION_IF_NULL(kernel_actor);
|
||||
|
||||
if ((kernel_actor->input_datas_num_ == 0) && (kernel_actor->input_controls_num_ == 0)) {
|
||||
gather_actor->output_control_arrows_.emplace_back(kernel_actor->GetAID());
|
||||
(void)gather_actor->output_control_arrows_.emplace_back(kernel_actor->GetAID());
|
||||
kernel_actor->input_controls_num_ = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -2432,7 +2433,7 @@ void GraphScheduler::LinkControlArrowForGatherActor(std::vector<KernelActorPtr>
|
|||
auto switch_actor = dynamic_cast<SwitchActor *>(actor);
|
||||
MS_EXCEPTION_IF_NULL(switch_actor);
|
||||
|
||||
kernel_actor->output_control_arrows_.emplace_back(switch_actor->GetAID());
|
||||
(void)kernel_actor->output_control_arrows_.emplace_back(switch_actor->GetAID());
|
||||
switch_actor->input_controls_num_++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2452,7 +2453,7 @@ void GraphScheduler::LinkControlArrowForGatherActor(std::vector<KernelActorPtr>
|
|||
}
|
||||
auto kernel_actor = dynamic_cast<KernelActor *>(kernel_op_actor);
|
||||
auto gather_actor = dynamic_cast<GatherActor *>(gather_op_actor);
|
||||
kernel_actor->output_control_arrows_.emplace_back(gather_actor->GetAID());
|
||||
(void)kernel_actor->output_control_arrows_.emplace_back(gather_actor->GetAID());
|
||||
gather_actor->input_controls_num_++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2475,7 +2476,7 @@ void GraphScheduler::LinkControlArrowForSwitchActor(std::vector<SwitchActorPtr>
|
|||
MS_EXCEPTION_IF_NULL(actor);
|
||||
auto gather_actor = dynamic_cast<GatherActor *>(actor);
|
||||
MS_EXCEPTION_IF_NULL(gather_actor);
|
||||
gather_actor->output_control_arrows_.emplace_back(switch_actor->GetAID());
|
||||
(void)gather_actor->output_control_arrows_.emplace_back(switch_actor->GetAID());
|
||||
switch_actor->input_controls_num_++;
|
||||
}
|
||||
}
|
||||
|
|
@ -2499,7 +2500,7 @@ void GraphScheduler::LinkControlArrowForSwitchActor(std::vector<SwitchActorPtr>
|
|||
std::set<AnfNodePtr> call_nodes;
|
||||
for (const auto &output : origin_outputs_order) {
|
||||
if (IsCallNode(output.first.first)) {
|
||||
call_nodes.insert(output.first.first);
|
||||
(void)call_nodes.insert(output.first.first);
|
||||
}
|
||||
}
|
||||
to_actor->input_controls_num_ += call_nodes.size();
|
||||
|
|
@ -2545,14 +2546,13 @@ void GraphScheduler::LinkBranchArrowForSwitchActor(const GraphCompilerInfo &grap
|
|||
|
||||
const auto &gather_actor = FetchActor(func_graph->ToString());
|
||||
MS_EXCEPTION_IF_NULL(gather_actor);
|
||||
switch_actor->output_branch_branch_arrows_[i].emplace_back(gather_actor->GetAID());
|
||||
(void)switch_actor->output_branch_branch_arrows_[i].emplace_back(gather_actor->GetAID());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GraphScheduler::LinkBranchArrowForGatherActor(const GraphCompilerInfo &graph_compiler_info,
|
||||
const ActorSet *actor_set) {
|
||||
void GraphScheduler::LinkBranchArrowForGatherActor(const GraphCompilerInfo &graph_compiler_info) {
|
||||
if (graph_compiler_info.control_nodes_.empty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2566,7 +2566,7 @@ void GraphScheduler::LinkBranchArrowForGatherActor(const GraphCompilerInfo &grap
|
|||
auto actor = FetchActor(actor_name);
|
||||
MS_EXCEPTION_IF_NULL(actor);
|
||||
auto gather_actor = dynamic_cast<GatherActor *>(actor);
|
||||
gather_actor->output_branch_arrows_.emplace_back(gather_actor->gather_aid_);
|
||||
(void)gather_actor->output_branch_arrows_.emplace_back(gather_actor->gather_aid_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2577,7 +2577,7 @@ void GraphScheduler::LinkBranchArrowForGatherActor(const GraphCompilerInfo &grap
|
|||
MS_EXCEPTION_IF_NULL(actor);
|
||||
auto gather_actor = dynamic_cast<GatherActor *>(actor);
|
||||
MS_EXCEPTION_IF_NULL(gather_actor);
|
||||
gather_actor->output_branch_arrows_.emplace_back(gather_actor->switch_aid_);
|
||||
(void)gather_actor->output_branch_arrows_.emplace_back(gather_actor->switch_aid_);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ class GraphScheduler {
|
|||
// In control flow, there are scenarios where there are multi-branch outputs, and the gather actor needs to
|
||||
// send the branch id to the loop count actor.
|
||||
void LinkBranchArrowForSwitchActor(const GraphCompilerInfo &graph_compiler_info);
|
||||
void LinkBranchArrowForGatherActor(const GraphCompilerInfo &graph_compiler_info, const ActorSet *actor_set);
|
||||
void LinkBranchArrowForGatherActor(const GraphCompilerInfo &graph_compiler_info);
|
||||
void LinkOutputResultArrowForSwitchActor(const GraphCompilerInfo &graph_compiler_info, const ActorSet *actor_set);
|
||||
void PrepareDataForControlNode(HostQueueDataSourceActor *host_data_source_actor,
|
||||
const ControlNodeParserPtr &control_node_parser,
|
||||
|
|
|
|||
|
|
@ -170,7 +170,7 @@ void PushTensor(const VectorRef &args, const std::vector<AnfNodePtr> ¶meters
|
|||
std::vector<tensor::TensorPtr> *input_tensor) {
|
||||
const auto &iter = std::find(parameters.begin(), parameters.end(), front_node);
|
||||
if (iter == parameters.end()) {
|
||||
(*input_tensor).emplace_back(nullptr);
|
||||
(void)((*input_tensor).emplace_back(nullptr));
|
||||
return;
|
||||
}
|
||||
auto position = iter - parameters.begin();
|
||||
|
|
@ -820,7 +820,7 @@ void MindRTBackend::RunGraph(const ActorInfo &actor_info, const VectorRef &args,
|
|||
for (const auto ¶meter : control_node_parameters) {
|
||||
PushTensor(args, origin_parameters, parameter, &input_tensor);
|
||||
}
|
||||
input_tensors.emplace_back(input_tensor);
|
||||
(void)input_tensors.emplace_back(input_tensor);
|
||||
|
||||
// Run in the pynative mode.
|
||||
MS_EXCEPTION_IF_NULL(outputs);
|
||||
|
|
|
|||
Loading…
Reference in New Issue