已合并
feat: adapt FRACTAL_NZ D2H/printing and serialization UT for Ascend950 #44315
wuyouqi1创建于 8 天前
feat: adapt FRACTAL_NZ D2H/printing and serialization UT for Ascend950 #44315
已合并
Pull Request已成功合入, 合并人@ascend-robot
(感谢 wuyouqi1 的贡献)8 天前 关联了issue:[Feature]: Enable D2H, printing, and serialization for FRACTAL_NZ private-format tensors on Ascend950
8 天前 关联了issue:[Feature]: Enable D2H, printing, and serialization for FRACTAL_NZ private-format tensors on Ascend950
ascend-robot
8 天前 评论:
8 天前 评论:
ascend docs pipeline is running...


8 天前 添加了label:docs-ci-pipeline-running
8 天前 修改了pull request 的描述
此处折叠了176条消息 查看更多
1 天前 添加了label:approved
1 天前 添加了label:lgtm
1 天前 合入了pull request
ascend-robot
1 天前 评论:
1 天前 评论:
流水线 pytorch_gitcode_PR_multiVersion#14113 [ commitID:d642d977 ] 已完成


【合入来源】
【修改方案】
同步 #2629(A5/Ascend950 上 FRACTAL_NZ 私有格式 tensor 的 D2H、打印、序列化适配)至本分支,与 v2.7.1 实现(MR !40289)保持一致。本 PR 内容:
torch_npu/utils/tensor_methods.py:新增_add_repr_patch()。私有格式(FRACTAL_NZ 系列)tensor 在Tensor.__repr__中会命中_tensor_str内部格式守卫(cat/stack),导致打印/D2H 失败;patch 在私有格式时先.cpu()触发 D2H + format cast,再走原__repr__。在_add_tensor_methods()末尾注册。torch_npu/csrc/aten/common/FormatCastKernelNpu.cpp:IsAclnnOnly()路径下,未显式指定customize_dtype时,对element_size() >= 4的类型(fp32/int32)将customizeAcltype默认置为ACL_FLOAT16(C0=16),与 aclop 路径的历史行为对齐。test/npu/test_serialization_format.py:新增 Ascend950 专属用例TestSerializationFormatAscend950(受@unittest.skipUnless(IS_ASCEND950, ...)门控),覆盖 ND save/load、按 dtype 的 FRACTAL_NZ round-trip、NZ tensor D2H/repr/print;原TestSerializationFormat在 Ascend950 上跳过。【资料变更】
不涉及
【接口变更】
不涉及
【功能验证】
测试场景:
TestSerializationFormat原用例照常执行,TestSerializationFormatAscend950被skipUnless(IS_ASCEND950)跳过。TestSerializationFormat跳过,执行TestSerializationFormatAscend950:fp16/bf16/int8/int32/int64 的 FRACTAL_NZ save/load round-trip 与 D2H/repr/print。运行方式:
python test/npu/test_serialization_format.py -v新增/变更内容已适配 UT 用例(
test_serialization_format.py)。本 PR 为跨版本同步,代码已验证在各目标分支干净 apply、无遗留依赖(不含_reduce_ex__);具体执行结果以本分支 CI 流水线为准。【CheckList】
Fixes #2629
https://gitcode.com/Ascend/pytorch/issues/2629