huajsj commented on a change in pull request #9494:
URL: https://github.com/apache/tvm/pull/9494#discussion_r747999569



##########
File path: src/runtime/pipeline/pipeline_scheduler.cc
##########
@@ -26,12 +27,97 @@ namespace runtime {
  * \brief Initialize the pipeline.
  * \param modules The list of graph executor modules.
  * \param pipeline_conf The dependency information of each graph executor 
module.
+ * \return Return a list of backend runtime module.
  */
-size_t PipelineScheduler::PipelineInit(const std::vector<Module>& modules,
-                                       const PipelineConfig& pipeline_config) {
+std::vector<std::shared_ptr<BackendRuntime>> PipelineScheduler::PipelineInit(
+    const std::vector<Module>& modules, ConfigPipelineExecution 
pipeline_config) {
+  std::vector<std::shared_ptr<BackendRuntime>> runtimes;
   graph_modules_ = modules;
-  int num_output = pipeline_config.GetGlobalOutputNum();
-  return num_output;
+  for (size_t i = 0; i < graph_modules_.size(); i++) {
+    auto runItem = std::make_shared<BackendRuntime>(graph_modules_[i], i);
+    runtimes.push_back(runItem);
+  }
+  // Initialize the outputs array.
+  auto& global_output_map = pipeline_config.GetGlobalConfigOutputBindings();
+  for (size_t i = 0; i < global_output_map.size(); i++) {
+    if (global_output_map.find(i) == global_output_map.end()) {
+      LOG(FATAL) << "Not find global output index " << i;
+    }
+    ModuleOutputPair& output_pair = global_output_map[i];
+    NDArray output = 
runtimes[output_pair.mod_idx]->CreateFromOutput(output_pair.output_idx);
+    output_array.push_back(output);
+  }
+  return runtimes;
 }
+
+/*!
+ * \brief Exeute in the serialized mode.
+ * \param runtimes A list of backend runtimes module.
+ * \param pipeline_config The dependency information of each graph executor 
module.
+ */
+void PipelineScheduler::PipelineRunSerial(

Review comment:
       fixed.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to