Pull Request已成功合入, 合并人@ascend-robot
(感谢 panzhaohu 的贡献)变更摘要
该 PR 实现「采集与解析结构体解耦」:采集侧上报的 Msprof* 结构体不再被解析层及上层业务直接复用,而是通过新增的解析层独立结构体 Parser* 与映射器完成数据拷贝转换。核心是新增 parser_common.h(定义 ParserApi、ParserCompactInfo、ParserAdditionalInfo、ParserRuntimeTrack、ParserConcatTensorInfo 等结构及 CompactInfoFormat、AdditionalInfoFormat、RuntimeTrackFormat、CaptureStreamFormat 枚举)与 parser_common_mapper.h/.cpp(提供 ParserCompactInfoMapper、ParserApiMapper、ParserAdditionalInfoMapper、ParserAicpuMapper 映射类),随后将各解析器、领域实体、关联建树与落库模块及 UT 全面迁移到 Parser* 类型,并顺带统一了 RuntimeTrack V1/V2 的格式判定方式。
主要改动
- 新增解析层独立结构体
parser_common.h: 新增以Parser为前缀的ParserApi、ParserEvent、ParserCompactInfo、ParserAdditionalInfo、ParserRuntimeTrack、ParserConcatTensorInfo、ParserProfFusionOpInfo等结构体,替换原Msprof*结构在解析及上层业务中的使用,并引入CompactInfoFormat、AdditionalInfoFormat、RuntimeTrackFormat、CaptureStreamFormat枚举区分不同数据格式。 - 新增结构体映射器
parser_common_mapper.h/.cpp: 新增ParserCompactInfoMapper::MapCompactInfo/MapRuntimeTrack、ParserApiMapper::MapApi、ParserAdditionalInfoMapper::MapAdditionalInfo、ParserAicpuMapper::MapNode/MapDp/MapModel/MapKfcInfos等静态方法,将采集侧原始Msprof*数据逐字段拷贝到解析结构体(如MapRuntimeTrackV1/MapRuntimeTrackV2分别处理 V1/V2 格式)。 - 解析器由「复用原始内存」改为「拷贝映射」:
AdditionInfoParser、ApiEventParser、CompactInfoParser的ProduceData不再直接持有ReinterpretConvert得到的原始结构指针,而是make_shared<Parser*>并经 mapper 拷贝后释放原始 chunk;TensorInfoParser通过新增的ConvertTensorData将MsrofTensorData转换为ParserTensorData,api_event_parser中 API 与事件数据均先映射为ParserApi再产出。 - RuntimeTrack V1/V2 归一化逻辑调整: 删除
TaskTrackParser::NormalizeRuntimeTrack及isRuntimeTrackV2_标志,改用RuntimeTrackFormat(V1/V2)枚举;Flip::ComputeBatchId、CalibrateFlipTaskIdNotZero参数由bool isV2改为RuntimeTrackFormat,上层统一由runtimeTrackV2改用runtimeTrack字段,并将FlipTask::taskId由uint32_t收紧为uint16_t。 - 上层业务全面迁移到
Parser*类型:Event构造函数、OpDesc/HcclBigOpDesc/GeFusionOpInfo等实体、TreeAnalyzer/TreeBuilder、CANNTraceDBDumper/ModelNameDBDumper/MemcpyInfoDumper等落库模块及对应 UT 用例的类型从Msprof*迁移至Parser*,并将原先ReinterpretConvert<MsprofXxxInfo*>(data)的强转访问改为直接访问类型化字段(如trace->contextIdInfo、trace->hcclInfo、fusionOp->fusionOpInfo、track->data.runtimeTrack)。


Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/msprof | ✅ 潘杨杰, 陈豪, Seanesmhxocism (3/2) | ✅ 潘杨杰 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
panzhaohu, thanks for your pull request. All authors of the commits have signed the CLA. 👍


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


PR 合入模板
注:经过自检不涉及的可标注“不涉及”或直接打勾,特殊情况请文字备注。不符合规范的 PR 不允许合入,请(后备)commit 注意。
1. 修改描述
采集和解析使用同一套结构体,上游组件对采集结构体做出改变,解析内部需要进行大量的改动,不利于代码的可维护性,于是采集侧上报的 Msprof* 结构体不再被解析层及上层业务直接复用,而是通过新增的解析层独立结构体 Parser* 与映射器完成数据拷贝转换
1.新增解析层独立结构体 parser_struct.h文件:
新增以 Parser 为前缀的 ParserApi、ParserEvent、ParserCompactInfo、ParserAdditionalInfo、ParserRuntimeTrack、ParserConcatTensorInfo、ParserProfFusionOpInfo 等结构体,替换原 Msprof* 结构在解析及上层业务中的使用,并引入 CompactInfoFormat、AdditionalInfoFormat、RuntimeTrackFormat、CaptureStreamFormat 枚举区分不同数据格式。
2.新增结构体映射器 parser_struct_adapter.h/.cpp文件:
新增 ParserCompactInfoMapper::MapCompactInfo/MapRuntimeTrack、ParserApiMapper::MapApi、ParserAdditionalInfoMapper::MapAdditionalInfo、ParserAicpuMapper::MapNode/MapDp/MapModel/MapKfcInfos 等静态方法,将采集侧原始 Msprof* 数据逐字段拷贝到解析结构体。
3.解析器由「复用原始内存」改为「拷贝映射」:
AdditionInfoParser、ApiEventParser、CompactInfoParser 的 ProduceData接口不再直接持有 ReinterpretConvert 得到的原始采集结构体结构指针,而是通过make_shared<Parser*> 生成解析结构体并通过mapper接口将采集侧原始 Msprof* 数据逐字段拷贝到解析结构体Parser*。
4.上层业务全面迁移到 Parser* 类型:
Event 构造函数、OpDesc/HcclBigOpDesc/GeFusionOpInfo 等实体、TreeAnalyzer/TreeBuilder、CANNTraceDBDumper/ModelNameDBDumper/MemcpyInfoDumper 等模块都使用解析结构体Parser* 而不是之前的采集结构体msprof*。
2. 功能验证
3. 分支合并要求
3. 代码检视
要求:
检视意见数:____ 条 (请填写本次检视的意见总数,用于commit合入前审视)
4. 安全自检
Python、C++
C++
5. 变更知会