From a194d5023838a8aef0fafc17f805a5fcab858b61 Mon Sep 17 00:00:00 2001 From: panzhaohu Date: Thu, 24 Jul 2025 10:26:33 +0800 Subject: [PATCH] added parameter mstx --- msmonitor/README.md | 5 ++++- msmonitor/dynolog_npu/cli/src/commands/nputrace.rs | 5 +++++ msmonitor/dynolog_npu/cli/src/main.rs | 4 ++++ profiler/example/mstx_torch_plugin/README.md | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/msmonitor/README.md b/msmonitor/README.md index ab0658318d..3ae23aa38d 100644 --- a/msmonitor/README.md +++ b/msmonitor/README.md @@ -334,7 +334,10 @@ nputrace的SUBCOMMANDS(子命令)选项如下: | --analyse | action | 采集后是否自动解析,设置参数解析,默认不解析 | Y | Y | N | | --l2-cache | action | 是否采集L2 Cache数据,设置参数采集,默认不采集 | Y | Y | N | | --op-attr | action | 是否采集算子属性信息,设置参数采集,默认不采集 | Y | N | N | -| --msprof-tx | action | 是否使能MSTX,设置参数采集,默认不使能 | Y | Y | N | +| --msprof-tx | action | 是否使能MSTX,设置参数采集,默认不使能 | + Y | N | N | +| --mstx | action | 是否使能MSTX,设置参数采集,默认不使能 + Y | Y | N | | --mstx-domain-include | Option | 使能--msprof-tx采集mstx打点数据的情况下,配置该开关,设置实际采集的domain范围,与--mstx-domain-exclude参数互斥,若同时设置,则只有--mstx-domain-include生效。该参数为可选参数,默认不使能。可配置一个或多个domain,例如:--mstx-domain-include domain1, domain2 | Y | Y | N | | --mstx-domain-exclude | Option | 使能--msprof-tx采集mstx打点数据的情况下,配置该开关,设置实际不采集的domain范围,与--mstx-domain-include参数互斥,若同时设置,则只有--mstx-domain-include生效。该参数为可选参数,默认不使能。可配置一个或多个domain,例如:--mstx-domain-exclude domain1, domain2 | Y | Y | N | | --data-simplification | String | 解析完成后是否数据精简,可选值范围[`true`, `false`],默认值`true` | Y | Y | N | diff --git a/msmonitor/dynolog_npu/cli/src/commands/nputrace.rs b/msmonitor/dynolog_npu/cli/src/commands/nputrace.rs index ef84b3038d..d306398702 100644 --- a/msmonitor/dynolog_npu/cli/src/commands/nputrace.rs +++ b/msmonitor/dynolog_npu/cli/src/commands/nputrace.rs @@ -53,6 +53,7 @@ pub struct NpuTraceOptions { pub l2_cache: bool, pub op_attr: bool, pub msprof_tx: bool, + pub mstx: bool, pub gc_detect_threshold: Option, pub data_simplification: String, pub export_type: String, @@ -79,6 +80,7 @@ PROFILE_AIC_METRICS={} PROFILE_L2_CACHE={} PROFILE_OP_ATTR={} PROFILE_MSPROF_TX={} +PROFILE_MSTX={} PROFILE_GC_DETECT_THRESHOLD={} PROFILE_DATA_SIMPLIFICATION={} PROFILE_EXPORT_TYPE={} @@ -99,6 +101,7 @@ PROFILE_MSTX_DOMAIN_EXCLUDE={}"#, self.l2_cache, self.op_attr, self.msprof_tx, + self.mstx, self.gc_detect_threshold.map_or("None".to_string(), |v| v.to_string()), self.data_simplification, self.export_type, @@ -229,6 +232,7 @@ ACTIVITIES_ITERATIONS=1000"# l2_cache: true, op_attr: true, msprof_tx: true, + mstx: true, gc_detect_threshold: 0.1, data_simplification: "true", export_type: "Text".to_string(), @@ -256,6 +260,7 @@ PROFILE_AIC_METRICS=AiCoreNone PROFILE_L2_CACHE=true PROFILE_OP_ATTR=true PROFILE_MSPROF_TX=true +PROFILE_MSTX=true PROFILE_GC_DETECT_THRESHOLD=0.1 PROFILE_DATA_SIMPLIFICATION=true PROFILE_EXPORT_TYPE=Text diff --git a/msmonitor/dynolog_npu/cli/src/main.rs b/msmonitor/dynolog_npu/cli/src/main.rs index 7ee9d1be02..48bea65ff1 100644 --- a/msmonitor/dynolog_npu/cli/src/main.rs +++ b/msmonitor/dynolog_npu/cli/src/main.rs @@ -214,6 +214,8 @@ enum Command { /// Whether to enable MSTX. #[clap(long, action)] msprof_tx: bool, + #[clap(long, action)] + mstx: bool, /// GC detect threshold. #[clap(long)] gc_detect_threshold: Option, @@ -730,6 +732,7 @@ fn main() -> Result<()> { l2_cache, op_attr, msprof_tx, + mstx, gc_detect_threshold, data_simplification, export_type, @@ -764,6 +767,7 @@ fn main() -> Result<()> { l2_cache, op_attr, msprof_tx, + mstx, gc_detect_threshold, data_simplification, export_type, diff --git a/profiler/example/mstx_torch_plugin/README.md b/profiler/example/mstx_torch_plugin/README.md index f6c5b07115..3dda0523cb 100644 --- a/profiler/example/mstx_torch_plugin/README.md +++ b/profiler/example/mstx_torch_plugin/README.md @@ -1,6 +1,6 @@ # mstx_torch_plugin -Ascend Pytorch Profiler中的[采集并解析msprof_tx数据](https://www.hiascend.com/document/detail/zh/canncommercial/80RC3/devaids/devtools/profiling/atlasprofiling_16_0033.html#ZH-CN_TOPIC_0000002081898541__section5940122172516)功能已经内置了通信算子的打点。为了方便用户在不修改业务代码的基础上获取更多关键阶段的耗时数据,mstx_torch_plugin在Ascend Pytorch Profiler内置了**dataloader**、**forward**、**step**、**save_checkpoint**这四个关键阶段函数的打点。 +Ascend Pytorch Profiler中的[采集并解析mstx数据](https://www.hiascend.com/document/detail/zh/canncommercial/80RC3/devaids/devtools/profiling/atlasprofiling_16_0033.html#ZH-CN_TOPIC_0000002081898541__section5940122172516)功能已经内置了通信算子的打点。为了方便用户在不修改业务代码的基础上获取更多关键阶段的耗时数据,mstx_torch_plugin在Ascend Pytorch Profiler内置了**dataloader**、**forward**、**step**、**save_checkpoint**这四个关键阶段函数的打点。 ## 约束 @@ -54,7 +54,7 @@ Ascend Pytorch Profiler中的[采集并解析msprof_tx数据](https://www.hiasce 5. 使能torch_npu.profiler,采集打点数据。 - 打开msprof_tx开关,profiler_level开关可根据实际采集需要,配置对应的level: + 打开msprof_tx或者mstx开关,profiler_level开关可根据实际采集需要,配置对应的level: ```python import torch -- Gitee