Browse Source

fix bug when add atomic clean for getnext's output

tags/v1.1.0
laiyongqiang 5 years ago
parent
commit
dbc6147e9b
2 changed files with 15 additions and 4 deletions
  1. +9
    -4
      mindspore/ccsrc/runtime/device/ascend/kernel_build_ascend.cc
  2. +6
    -0
      mindspore/ccsrc/runtime/device/kernel_adjust.cc

+ 9
- 4
mindspore/ccsrc/runtime/device/ascend/kernel_build_ascend.cc View File

@@ -234,10 +234,15 @@ std::map<AnfNodePtr, std::vector<size_t>> GetCommunicationOpInputInfo(
for (size_t i = 0; i < input_num; i++) {
auto input_node = kernel->input(i + 1);
auto kernel_input = AnfAlgo::VisitKernelWithReturnType(input_node, 0, true);
if (AnfAlgo::IsCommunicationOp(kernel_input.first)) {
// no need to add atomic for communication op's output
MS_LOG(INFO) << "No need to add atomic clean for communication op "
<< kernel_input.first->fullname_with_scope() << "'s output";
if (!kernel_input.first->isa<CNode>()) {
continue;
}
auto cnode = kernel_input.first->cast<CNodePtr>();
if (AnfAlgo::IsCommunicationOp(cnode) || AnfAlgo::IsIndependentNode(cnode) ||
AnfAlgo::GetCNodeName(cnode) == kGetNextOpName) {
// no need to add atomic for communication/independent/getnext op 's output
MS_LOG(INFO) << "No need to add atomic clean for op " << kernel_input.first->fullname_with_scope()
<< "'s output";
continue;
}
MS_LOG(INFO) << "Add atomic clean for single communication op input, comm:" << kernel->fullname_with_scope()


+ 6
- 0
mindspore/ccsrc/runtime/device/kernel_adjust.cc View File

@@ -280,6 +280,12 @@ void KernelAdjust::InsertSwitchLoop(const std::shared_ptr<session::KernelGraph>
for (size_t idx = i + 1; idx < orders.size(); idx++) {
cur_cnode = orders[idx];
if (AnfAlgo::HasNodeAttr(kAttrLabelForInsertStreamActive, cur_cnode)) {
auto pre_node = orders[idx - 1];
auto pre_kernel_name = AnfAlgo::GetCNodeName(pre_node);
if (pre_kernel_name == kAtomicAddrCleanOpName) {
other_list.pop_back();
memcpy_list.push_back(pre_node);
}
memcpy_list.emplace_back(cur_cnode);
} else {
other_list.emplace_back(cur_cnode);


Loading…
Cancel
Save