profile: add vlm prefill profiler ranges (#30871)
This commit is contained in:
@@ -1074,6 +1074,10 @@ def general_mm_embed_routine(
|
|||||||
if forward_batch.mm_inputs[i] is not None
|
if forward_batch.mm_inputs[i] is not None
|
||||||
]
|
]
|
||||||
server_args = get_server_args()
|
server_args = get_server_args()
|
||||||
|
# Makes VLM profiles directly attributable: this range includes
|
||||||
|
# encoder/ViT execution and multimodal feature placement, while
|
||||||
|
# the language model range below excludes both.
|
||||||
|
with torch.profiler.record_function("sglang.vlm.mm_embedding"):
|
||||||
if server_args and server_args.enable_adaptive_dispatch_to_encoder:
|
if server_args and server_args.enable_adaptive_dispatch_to_encoder:
|
||||||
# Split by precomputed vs non-precomputed so get_embedding_and_mask only sees uniform batches
|
# Split by precomputed vs non-precomputed so get_embedding_and_mask only sees uniform batches
|
||||||
input_embeds, other_info = _embed_mm_inputs_with_split(
|
input_embeds, other_info = _embed_mm_inputs_with_split(
|
||||||
@@ -1143,6 +1147,7 @@ def general_mm_embed_routine(
|
|||||||
else:
|
else:
|
||||||
input_embeds = None
|
input_embeds = None
|
||||||
|
|
||||||
|
with torch.profiler.record_function("sglang.vlm.language_model_prefill"):
|
||||||
hidden_states = language_model(
|
hidden_states = language_model(
|
||||||
input_ids=None,
|
input_ids=None,
|
||||||
forward_batch=forward_batch,
|
forward_batch=forward_batch,
|
||||||
|
|||||||
Reference in New Issue
Block a user