From bf6a6468c16966848ff5a008778a4fc04af8c374 Mon Sep 17 00:00:00 2001 From: mei-feiyao <1332490378@qq.com> Date: Mon, 18 Aug 2025 19:53:02 +0800 Subject: [PATCH] msmonitor npu-monitor support step mstx data --- torch_npu/profiler/dynamic_profile.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/torch_npu/profiler/dynamic_profile.py b/torch_npu/profiler/dynamic_profile.py index 313fe7d388f..5a89a0afd2e 100644 --- a/torch_npu/profiler/dynamic_profile.py +++ b/torch_npu/profiler/dynamic_profile.py @@ -79,10 +79,9 @@ class _DynamicProfile: elif self.cur_step - self.RECORD_TIME_STEP == 1: self._step_time = max(self._min_poll_interval, int(time.time() - self._step_record_time)) self._dynamic_monitor.modify_step_time(self._step_time) + if self._step_mstx_range_id: + mstx.range_end(self._step_mstx_range_id) if self.prof: - if self._step_mstx_range_id: - mstx.range_end(self._step_mstx_range_id) - self._step_mstx_range_id = mstx.range_start(f"step {self.cur_step}", current_stream()) self.prof.step() self.step_num -= 1 if 0 == self.step_num: @@ -94,6 +93,8 @@ class _DynamicProfile: self.step_num = self.cfg_ctx.active() + self.cfg_ctx.warmup() self.enable_prof() self.cfg_ctx = None + if self.prof is None: + self._step_mstx_range_id = mstx.range_start(f"step {self.cur_step}", current_stream()) def start(self, config_path: str): if self.prof: -- Gitee