From e2527df8b6a174ffba33b8857f2f7350d5ebbe20 Mon Sep 17 00:00:00 2001 From: zhaozx-cn <59479021+zhaozx-cn@users.noreply.github.com> Date: Sat, 9 May 2026 17:48:24 +0800 Subject: [PATCH] [NPU] fix profiler on npu (#24685) Signed-off-by: zhaozx-cn --- .../srt/managers/scheduler_profiler_mixin.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/python/sglang/srt/managers/scheduler_profiler_mixin.py b/python/sglang/srt/managers/scheduler_profiler_mixin.py index c02ed7997..0fabda141 100644 --- a/python/sglang/srt/managers/scheduler_profiler_mixin.py +++ b/python/sglang/srt/managers/scheduler_profiler_mixin.py @@ -201,6 +201,21 @@ class SchedulerProfilerMixin: str(self.torch_profiler_output_dir) ) ), + experimental_config=( + None + if not _is_npu + else torch_npu.profiler._ExperimentalConfig( + export_type=torch_npu.profiler.ExportType.Text, + profiler_level=torch_npu.profiler.ProfilerLevel.Level1, + msprof_tx=False, + aic_metrics=torch_npu.profiler.AiCMetrics.AiCoreNone, + l2_cache=False, + op_attr=False, + data_simplification=False, + record_op_args=False, + gc_detect_threshold=None, + ) + ), ) self.torch_profiler.start() self.profile_in_progress = True