profile: add vlm prefill profiler ranges (#30871)

This commit is contained in:
Mick
2026-07-12 14:07:10 +08:00
committed by GitHub
parent bce3fc987d
commit f1c247edf9
+5
View File
@@ -1074,6 +1074,10 @@ def general_mm_embed_routine(
if forward_batch.mm_inputs[i] is not None
]
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:
# Split by precomputed vs non-precomputed so get_embedding_and_mask only sees uniform batches
input_embeds, other_info = _embed_mm_inputs_with_split(
@@ -1143,6 +1147,7 @@ def general_mm_embed_routine(
else:
input_embeds = None
with torch.profiler.record_function("sglang.vlm.language_model_prefill"):
hidden_states = language_model(
input_ids=None,
forward_batch=forward_batch,