跳转至

mstx_profile.py — 华为 NPU MSTX 分析

文件路径: verl/utils/profiler/mstx_profile.py

文件概述

华为 Ascend NPU 上的性能分析实现,使用 MSTX (Mindstudio TX) 标记,功能上对应 NVIDIA 的 NVTX。

核心功能

  • mark_start_range() / mark_end_range(): 使用 mstx.range_start/end
  • NPUProfiler: 使用 torch_npu.profiler 进行性能采集
  • 支持多种采集级别(level0/1/2)和内容(npu/cpu/memory/stack)

与其他模块的关系

  • 被 profile.py 在 NPU 设备上使用
  • 需要 torch_npu 包

小结

NPU 设备上对标 NVTX 的性能分析实现。