[CPU][Profiler] Group torch profiler tables by input shape when record_shapes is on (#56016)
Signed-off-by: Chinmay Kulkarni <Chinmay.Kulkarni@amd.com> Co-authored-by: Li, Jiang <jiang1.li@intel.com>
This commit is contained in:
co-authored by
Li, Jiang <jiang1.li@intel.com>
parent
b443c1cc4e
commit
dc89fdfb0e
@@ -19,6 +19,7 @@ import vllm.version
|
||||
from vllm.config import ProfilerConfig
|
||||
from vllm.config.profiler import _is_uri_path
|
||||
from vllm.logger import init_logger
|
||||
from vllm.platforms import current_platform
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
@@ -259,9 +260,14 @@ class TorchProfilerWrapper(WorkerProfiler):
|
||||
sort_key: str,
|
||||
row_limit: int | None = None,
|
||||
) -> str:
|
||||
group_by_input_shape = (
|
||||
current_platform.is_cpu()
|
||||
and self.profiler_config.torch_profiler_record_shapes
|
||||
)
|
||||
averages = self.profiler.key_averages(group_by_input_shape=group_by_input_shape)
|
||||
if row_limit is None: # use profiler default row limit of 100
|
||||
return self.profiler.key_averages().table(sort_by=sort_key)
|
||||
return self.profiler.key_averages().table(
|
||||
return averages.table(sort_by=sort_key)
|
||||
return averages.table(
|
||||
sort_by=sort_key,
|
||||
row_limit=row_limit,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user