Commit Graph
146 Commits
Author SHA1 Message Date
shaoyf 037341d87e Support registering functions on AutogradPrivateUse1 via YAML dispatch configuration
Co-authored-by: shaoyf02<shaoyifan1@huawei.com>



# message auto-generated for no-merge-commit merge:
merge 280_autograd into v2.8.0

Support registering functions on AutogradPrivateUse1 via YAML dispatch configuration

Created-by: shaoyf
Commit-by: shaoyf02
Merged-by: ascend-robot
Description: <!--  Thanks for sending a pull request! 
-->

**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**:
<!-- 
*Automatically closes linked issue when PR is merged.
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes #

**Special notes for your reviewers**:




See merge request: Ascend/pytorch!25031
2025-09-19 13:19:38 +08:00
wgb 38476d6389 !24254 npu codegen autograd support symint
Merge pull request !24254 from wgb/v2.8.0
2025-08-27 01:27:04 +00:00
chuboning 949b683eb4 !24228 Fix npu_dtype_cast not support complex
Merge pull request !24228 from chuboning/v2.8.0
2025-08-26 06:51:44 +00:00
chuboning 533b13f068 !22300 Add support for custom dtype
Merge pull request !22300 from chuboning/master
2025-06-28 02:18:48 +00:00
jiangpengfei 54c0023474 !20887 Internalformat torchnpu operator dispatch and add new parameter type f…
Merge pull request !20887 from jiangpengfei/master
2025-05-13 09:11:38 +00:00
姜怡文 bab67d09b9 !20733 Add NPUSwapMemoryAllocator and empty_with_swap_memory
Merge pull request !20733 from 姜怡文/main_vm
2025-04-27 07:23:25 +00:00
wgb a6918b83b8 !18907 device check support for kwargs parameters
Merge pull request !18907 from wgb/copy_master
2025-03-14 07:41:52 +00:00
wgb 6b44e62827 !18257 Fix the judgment condition of device_check
Merge pull request !18257 from wgb/master
2025-02-25 01:37:42 +00:00
dilililiwhy 4fe71bd12b !18176 TORCH MAIN SYNC : compiled_autograd_apply_functional && torch.types.FileLike
Merge pull request !18176 from dilililiwhy/main_sync_20250201
2025-02-22 06:43:04 +00:00
dilililiwhy 8f7cdb5d4a !17808 Update to v2.7.0
Merge pull request !17808 from dilililiwhy/version_2.7
2025-02-13 09:48:50 +00:00
刘嘉巍 822e569455 !17339 [Fix] Registe npu_dtype_cast gradient support complex.
Merge pull request !17339 from 刘嘉巍/master
2025-02-08 07:29:30 +00:00
wgb bf1b1e7e26 !17404 Add device_check feature
Merge pull request !17404 from wgb/copy_master
2025-02-07 09:31:30 +00:00
wgb 9ad9921849 !17149 Fix the out of place custom functions in variabletype
Merge pull request !17149 from wgb/bugfix_master
2025-01-16 06:35:18 +00:00
ChenDonYY a34622f1ba !15979 add OpHook and Swap related changes
Merge pull request !15979 from ChenDonYY/master_swap
2024-12-19 12:03:58 +00:00
闫鹏全 4504867507 !1414 Modify the scope of the libtorch macro
Merge pull request !1414 from 闫鹏全/master
2024-09-06 09:26:26 +00:00
alanhe151220037 d34801bf19 !13883 update GRADIENT_IMPLEMENTED_FOR_COMPLEX for stft autograd codegen
Merge pull request !13883 from alanhe151220037/master
2024-08-27 02:51:40 +00:00
王广斌 dc182c63a0 !13794 Bugfix: Custom operators support input keyword arguments
Merge pull request !13794 from 王广斌/bugfix_master
2024-08-21 01:44:08 +00:00
闫鹏全 deda8e8a74 !13717 Adds the unsafe flag to Tensor data for npu recovery
Merge pull request !13717 from 闫鹏全/master
2024-08-17 09:11:11 +00:00
王广斌 f1cf28e3c9 !12610 [Codecheck] remove assert in codegen
Merge pull request !12610 from 王广斌/master
2024-06-25 11:41:17 +00:00
邵非凡 25ff2988f2 !12360 register tags for custom functions.
Merge pull request !12360 from 邵非凡/tag24
2024-06-24 01:53:51 +00:00
王广斌 95985c5107 !12519 [Codecheck] remove assert in codegen
Merge pull request !12519 from 王广斌/master
2024-06-22 09:01:07 +00:00
tangpeiqi96 7539e969e6 !12190 Add guard judgment for path 5 special operators
Merge pull request !12190 from tangpeiqi96/master_0603
2024-06-05 11:30:21 +00:00
王广斌 91f2f8d6fe !12041 Fix api dispatch diff between cpu and npu in compositeimplicitautograd key
Merge pull request !12041 from 王广斌/master
2024-05-30 11:43:34 +00:00
DaiFu 5ea1c0ef45 !12005 [master]Support matmul_double_backward
Merge pull request !12005 from DaiFu/2405MatmulDoubleBackward
2024-05-28 10:56:37 +00:00
tangpeiqi96 1785f2b0bd !11830 Add customized operator codegen to generate deviceGuard
Merge pull request !11830 from tangpeiqi96/master_517
2024-05-25 03:07:22 +00:00
tangpeiqi96 c923f31291 !11511 Remove auto-generated "check_and_update_common_device()"
Merge pull request !11511 from tangpeiqi96/master_delcheck
2024-05-07 02:06:29 +00:00
王广斌 ad21023315 !10962 Add functionalize codegen feature
Merge pull request !10962 from 王广斌/bugfix_master
2024-04-29 12:10:30 +00:00
DaiFu 8a0b444c43 !11211 Support sparse_csr_tensor
Merge pull request !11211 from DaiFu/2404CsrCreate
2024-04-19 02:40:01 +00:00
tangpeiqi96 c4104d70f6 !11117 Modify the value of device_guard
Merge pull request !11117 from tangpeiqi96/master_device_guard
2024-04-18 11:09:17 +00:00
邵非凡 c431aa0288 !10089 add sparse ut
Merge pull request !10089 from 邵非凡/skip_gen
2024-03-25 01:16:12 +00:00
王广斌 1287dcaaa6 !10444 Bugfix: add saved_for param for unpack_list func
Merge pull request !10444 from 王广斌/bugfix_master
2024-03-21 12:59:19 +00:00
huangyunlong 034e5b867d !9976 [Feature]add errorcode.
Merge pull request !9976 from huangyunlong/2.3thr
2024-03-06 09:58:16 +00:00
王广斌 54e9496600 !9967 Add generate python_functions feature
Merge pull request !9967 from 王广斌/master_copy
2024-03-06 09:40:41 +00:00
邵非凡 3348eade05 !9940 skip op which shouldn't register to NPU
Merge pull request !9940 from 邵非凡/skip_gen
2024-03-05 12:17:28 +00:00
邵非凡 51b78f4f66 !9907 skip op which shouldn't register to NPU
Merge pull request !9907 from 邵非凡/skip_gen
2024-03-04 12:05:39 +00:00
姜怡文 33fce58340 !9301 Close some temporary open interfaces
Merge pull request !9301 from 姜怡文/master_api
2024-02-26 01:21:45 +00:00
邵非凡 c7adce655e !9574 use codegen to generate code which registered to pytorch
Merge pull request !9574 from 邵非凡/sparse_gen
2024-02-24 02:59:21 +00:00
i-robot f1c351c3c8 !9174 [refactor public API] Rename npu_testing_utils.
Merge pull request !9174 from Leon/23_
2024-01-29 01:59:06 +00:00
liangyunfan f403509f25 rename generated file name related to test_ops. 2024-01-26 10:19:25 +08:00
姜怡文 daf7615d36 !8875 Transform some quantize ops
Merge pull request !8875 from 姜怡文/v2.3.0_quant
2024-01-17 07:49:27 +00:00
huangyunlong 7c413cae27 !8288 [Feature]get version from version.txt.
Merge pull request !8288 from huangyunlong/2.2vers
2023-12-13 09:29:23 +00:00
姜怡文 17cde4efac !7602 Support quantize dispatch key
Merge pull request !7602 from 姜怡文/v2.2.0_qtensor
2023-11-22 15:17:49 +00:00
王广斌 231957bd61 !7410 Add filt exposed api feature
Merge pull request !7410 from 王广斌/master_copy
2023-11-15 01:08:07 +00:00
shaoyf bfeb888934 !7282 Use the yaml in op-plugin for testing
Merge pull request !7282 from shaoyf/del_op/master
2023-11-10 08:11:31 +00:00
王广斌 e0c37b2c8a !7039 Filt expose api in torch_npu all
Merge pull request !7039 from 王广斌/master_copy
2023-11-03 10:05:26 +00:00
王广斌 75fc5f01ab !6923 Filt exposed api
Merge pull request !6923 from 王广斌/filt_python
2023-10-31 14:16:14 +00:00
jiangpengfei 2b0e436c1f !6916 Revert some ops from privateuse1 to atuogradprivateuse1
Merge pull request !6916 from jiangpengfei/master
2023-10-31 05:13:46 +00:00
王嘉诚 a85b396926 !6912 【PTA】support ForceAclnnOpList
Merge pull request !6912 from 王嘉诚/master
2023-10-31 03:35:00 +00:00
jiangpengfei 96f9cf7b29 !6803 Register some native operators with dispatchkey compositeimplicitautograd to both privateuse1 and autogradprivateuse1
Merge pull request !6803 from jiangpengfei/dtensor
2023-10-30 14:21:09 +00:00
王广斌 f422263ee6 !6805 [Clean code] File path problem
Merge pull request !6805 from 王广斌/clean_code
2023-10-28 06:12:41 +00:00