已合并
[bugfix]跳过NZ格式Tensor的采集以避免异常内存申请 #795
jiangchao创建于 6月15日
[bugfix]跳过NZ格式Tensor的采集以避免异常内存申请 #795
已合并
jiangchao创建于 6月15日
jiangchao成员
6月15日

背景

使用msProbe工具dump DeepSeek-V4模型的精度数据时,会申请异常内存,导致OOM或者报Tensor维度为负数的异常。

问题根因

前提:
MOE层的专家权重为NZ私有格式,对该权重调用float、max、clone等API进行统计量计算或落盘时,会先尝试申请一块较大内存Tw,再自动调用TransData算子尝试将其转换为float等API支持的数据格式,但因为某种原因TransData会抛出tiling异常。

OOM报错原因:
(1)Tw大于Free Memory。
(2)当Tw小于Free Memory,且TransData Tiling异常被工具捕获,未中断推理时,异步模式(ASCEND_LAUNCH_BLOCKING=0)下,TransData算子执行失败过程中的脏内存会传递到下游,发生内存踩踏。如果repeat_interleave的入参被污染为非常大的值,则会申请一块异常大的内容。

Tensor维度为负数的原因:
当Tw小于Free Memory,且TransData Tiling异常被工具捕获,未中断推理时,异步模式(ASCEND_LAUNCH_BLOCKING=0)下,TransData算子执行失败过程中的脏内存会传递到下游,发生内存踩踏。如果repeat_interleave的入参被污染为负数,则会产生Tensor维度为负数的异常报错。
(将ASCEND_LAUNCH_BLOCKING设为1后,推理过程也能正常完成)

解决方案

进行数据格式校验,不采集NZ格式Tensor。

自验证

image.png

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 jiangchao 的贡献)
ascend-robotascend-robot成员
6月15日 添加了label:ascend-cla/yes
ascend-robot
ascend-robot成员
6月15日 评论:

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


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-Ascend/msprobe ✅ cai-weiwei1989, zderry (2/2) ✅ zderry (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

jianchaoj, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
jiangchao成员
6月15日 评论:

compile

likedislike
ascend-robotascend-robot成员
6月15日 添加了label:ci-pipeline-running
此处折叠了48条消息 查看更多
RanZheng成员
6月15日 评论:

/approve

likedislike
ascend-robotascend-robot成员
6月15日 添加了label:approvedlgtm
ascend-robotascend-robot成员
6月15日 合入了pull request
Jjiangchao成员
6月16日 修改了pull request 的描述
Jjiangchao成员
6月16日 修改了pull request 的描述