已合并
Support registering functions on AutogradPrivateUse1 via YAML dispatch configuration #25031
shaoyf创建于 2025年9月19日
Support registering functions on AutogradPrivateUse1 via YAML dispatch configuration #25031
已合并
shaoyf创建于 2025年9月19日
shaoyf成员
2025年9月19日

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind bug
/kind task
/kind feature

What does this PR do / why do we need it:
背景:解决高版本下默认针对没有注册autograd相关key但进行反向的api的告警
方案:通过提供支持添加dispatch字段注册到autogradprivateuse1上,避免出现告警:
例如:

  - func: npu_moe_token_unpermute_with_routing_map(Tensor permuted_tokens, Tensor sorted_indices, int[] restore_shape, *, Tensor? probs=None, Tensor? routing_map=None, bool drop_and_pad=False) -> Tensor
    op_api: [v2.1, newest]
    dispatch:
      AutogradPrivateUse1: npu_moe_token_unpermute_with_routing_map

具体样例:
添加dispatch前存在告警,添加后无

[W919 12:36:08.793215810 compiler_depend.ts:67] Warning: npu::npu_moe_token_unpermute_with_routing_map: an autograd kernel was not registered to the Autograd key(s) but we are trying to backprop through it. This may lead to silently incorrect behavior. This behavior is deprecated and will be removed in a future version of PyTorch. If your operator is differentiable, please ensure you have registered an autograd kernel to the correct Autograd key (e.g. DispatchKey::Autograd, DispatchKey::CompositeImplicitAutograd). If your operator is not differentiable, or to squash this warning and use the previous behavior, please register torch::CppFunction::makeFallthrough() to DispatchKey::Autograd. (function operator())

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewers:

likedislike
Pull Request已成功合入, 合并人@ascend-robot
(感谢 shaoyf 的贡献)
Sshaoyf成员
2025年9月19日 创建了 pull request,commit 22bfa41d
ascend-robot
ascend-robot成员
2025年9月19日 评论:

Thank your for your pull-request.

The full list of commands accepted by me can be found at here.

You can get sig-info guidance at here

likedislike
openLiBingCI成员
2025年9月19日 评论:
ascend-robotascend-robot成员
2025年9月19日 添加了label:ascend-cla/yes
shaoyf成员
2025年9月19日 评论:

compile

likedislike
ascend-robot
ascend-robot成员
2025年9月19日 评论:

CLA Signature Pass

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

likedislike
AtlasAccountAtlasAccount成员
2025年9月19日 添加了label:ci-pipeline-running
AtlasAccount
AtlasAccount成员
2025年9月19日 评论:

流水线任务触发成功,正在执行,请稍候。 任务链接[eb64f9f9ea5a404f9fda825e59866330]

likedislike
AtlasAccount
AtlasAccount成员
2025年9月19日 评论:

get-log

likedislike
AtlasAccountAtlasAccount成员
2025年9月19日 删除了label:ci-pipeline-running
AtlasAccountAtlasAccount成员
2025年9月19日 添加了label:ci-pipeline-running
AtlasAccountAtlasAccount成员
2025年9月19日 删除了label:ci-pipeline-running
AtlasAccountAtlasAccount成员
2025年9月19日 添加了label:ci-pipeline-passed
AtlasAccount
AtlasAccount成员
2025年9月19日 评论:
检查项 状态 日志 产物
code_check >>> N/A
sca >>> N/A
check_error >>> N/A
anti poison >>> N/A
Build_X86_USE_CXX_ABI_GCC13 >>> >>>
Build_LibTorch_USE_CXX_ABI_GCC13 >>> >>>
Build_ARM_USE_CXX_ABI_GCC13 >>> >>>
UT_X86_Part_01 >>> N/A
UT_X86_Part_02 >>> N/A
openlibing链接 点此跳转
likedislike
AtlasAccountAtlasAccount成员
2025年9月19日 删除了label:ci-pipeline-passed
AtlasAccountAtlasAccount成员
2025年9月19日 添加了label:ci-pipeline-passed
Sshaoyf成员
2025年9月19日 修改了pull request 的描述
王超成员
2025年9月19日 评论:

/approve

likedislike
ascend-robotascend-robot成员
2025年9月19日 添加了label:lgtm
yanpengquan成员
2025年9月19日 评论:

/approve

likedislike
ascend-robotascend-robot成员
2025年9月19日 添加了label:approved
ascend-robot
ascend-robot成员
2025年9月19日 评论:

Review Guide

This Pull-Request Passes Review.
Committers who writed a comment of /approve are: wangchao430, yanpengquan.
Reviewers who writed a comment of /lgtm are: wangchao430, yanpengquan.

likedislike
ascend-robotascend-robot成员
2025年9月19日 合入了pull request