Browse Source

multi batch

tags/v1.1.0
wjm 4 years ago
parent
commit
8e67c970b8
2 changed files with 16 additions and 0 deletions
  1. +9
    -0
      ge/graph/build/memory/block_mem_assigner.cc
  2. +7
    -0
      ge/graph/preprocess/multi_batch_copy_graph.cc

+ 9
- 0
ge/graph/build/memory/block_mem_assigner.cc View File

@@ -880,6 +880,15 @@ MemoryBlock *BlockMemAssigner::ApplyMemory(size_t block_size, size_t real_size,
GELOGI("Unreusable block."); GELOGI("Unreusable block.");
continue; continue;
} }
std::string batch_label;
if (reusable_block->IsSameLabel(batch_label)) {
std::string op_label;
(void)ge::AttrUtils::GerStr(node_op_desc, Attr_NAME_BATCH_LABEL, op_label);
if (batch_label != op_label) {
GELOGI("label diff, op name %s", node_op_desc->GetName().c_str());
continue;
}
}


// A node can reuse blocks of the same stream and preorder streams // A node can reuse blocks of the same stream and preorder streams
if (CanReuseBySize(reusable_block_counts_, *reusable_block, block_size, real_size, continuous)) { if (CanReuseBySize(reusable_block_counts_, *reusable_block, block_size, real_size, continuous)) {


+ 7
- 0
ge/graph/preprocess/multi_batch_copy_graph.cc View File

@@ -1025,6 +1025,13 @@ Status MultiBatchGraphCopyer::InsertIdentityAfterSwitchN() {
} }


Status ProcessMultiBatch(ComputeGraphPtr &graph) { Status ProcessMultiBatch(ComputeGraphPtr &graph) {
const char *multi_batch_with_case = std::getenv("MULTI_BATCH_WITH_CASE");
if (multi_batch_with_case != nullptr) {
PassManager pass_manager;
GE_CHK_STATUS_RET(pass_manager.AddPass("MultiBatchClonePass", new (std::nothrow) MultiBatchClonePass));
return pass_manager.Run(graph);
}

std::vector<std::vector<int64_t>> shapes; std::vector<std::vector<int64_t>> shapes;
if (!InitDynamicParams(shapes)) { if (!InitDynamicParams(shapes)) {
GELOGD("There is no multi-batch options, no need to process multi-batch copy"); GELOGD("There is no multi-batch options, no need to process multi-batch copy");


Loading…
Cancel
Save