Improve MFU metrics for prefill and verify timing (#29000)
Co-authored-by: Pranjal Shankhdhar <pranjal.ssh@gmail.com>
This commit is contained in:
co-authored by
Pranjal Shankhdhar
parent
0c6e8e9477
commit
b60185c41c
@@ -3047,11 +3047,16 @@ class ModelRunner(ModelRunnerKVCacheMixin):
|
||||
):
|
||||
# Prefill cuda graph (piecewise).
|
||||
kwargs = self._extend_forward_kwargs(forward_batch, pp_proxy_tensors)
|
||||
category = (
|
||||
"target_verify"
|
||||
if forward_batch.forward_mode.is_target_verify()
|
||||
else "extend"
|
||||
)
|
||||
# TODO: device_timer.wrap is too broad here — it also includes
|
||||
# load_batch time. Move timing into the prefill cuda graph runner
|
||||
# to capture only the model.forward part.
|
||||
ctx = (
|
||||
self.device_timer.wrap(metadata={"category": "extend"})
|
||||
self.device_timer.wrap(metadata={"category": category})
|
||||
if self.device_timer
|
||||
else contextlib.nullcontext()
|
||||
)
|
||||
|
||||
@@ -309,6 +309,11 @@ class EagerRunner(BaseRunner):
|
||||
) -> Union[LogitsProcessorOutput, PPProxyTensors, EmbeddingPoolerOutput]:
|
||||
model_runner = self.model_runner
|
||||
kwargs = model_runner._extend_forward_kwargs(forward_batch, pp_proxy_tensors)
|
||||
category = (
|
||||
"target_verify"
|
||||
if forward_batch.forward_mode.is_target_verify()
|
||||
else "extend"
|
||||
)
|
||||
|
||||
if not model_runner.server_args.enable_pdmux:
|
||||
forward_batch = self.load_batch(forward_batch, pp_proxy_tensors)
|
||||
@@ -337,7 +342,7 @@ class EagerRunner(BaseRunner):
|
||||
forward_positions = sharded_positions
|
||||
|
||||
ctx = (
|
||||
model_runner.device_timer.wrap(metadata={"category": "extend"})
|
||||
model_runner.device_timer.wrap(metadata={"category": category})
|
||||
if model_runner.device_timer
|
||||
else contextlib.nullcontext()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user