docstr: For all batches, no matter it is a new batch or a mini batch, we need to do prefill first.
docstr_tok: ["For","all","batches",",","no","matter","it","is","a","new","batch","or","a","mini","batch",",","we","need","to","do","prefill","first","."]
code: def _prefill_batch(self, batch):
      """
      For all batches, no matter it is a new batch or a mini batch, we need to do prefill first.
      """
      self._init_batch(batch)
  
      # TODO: figure out if cache and batch id is needed
      ans = self.engine._prefill_batch(batch.batch_id)
      req_to_out_token_id = ans
      self._add_token_id_to_req(batch, req_to_out_token_id)
      has_new_finished_req = batch.mark_finished_req(
          self.eos_id, self.engine.max_output_len
      )
      outputs = self._handle_finish_req(batch, has_new_finished_req)
      return has_new_finished_req, outputs
  
file_path: colossalai/colossalai/legacy/inference/async_manager.py
imports: from typing import List
  from .dynamic_batching.io_struct import Batch, Req, RequestOutput
  from .manager import DynamicBatchManager
  from .tensor_parallel import TPInferEngine
label_desc: Use image node_id 3 for calling the Async_DynamicBatchManager obj's underlying member method code with example usage: obj._prefill_batch(batch) and returns: has_new_finished_req,  outputs