你说的算子开源是指哪些算子?


你说的算子开源是指哪些算子?
aclnnInplaceFfnWorkerScheduler、aclnnInplaceAttentionWorkerScheduler这两AI CPU算子;以及aclnnFfnWorkerBatching和aclnnAttentionWorkerCombine这AI Core算子
这些源码的开源情况,可以到cann仓https://gitcode.com/cann/ops-nn/issues 提相关issue。


你说的算子开源是指哪些算子?
aclnnInplaceFfnWorkerScheduler、aclnnInplaceAttentionWorkerScheduler这两AI CPU算子;以及aclnnFfnWorkerBatching和aclnnAttentionWorkerCombine这AI Core算子
这些源码的开源情况,可以到cann仓https://gitcode.com/cann/ops-nn/issues 提相关issue。
嗯嗯,行的;但是单测报错能不能先帮忙解决下


上述用例确实有报错,但是你的报错应该是环境问题,你本地单独执行"python -c 'import torch; import torch_npu; torch_npu.npu.synchronize()'" 试下。


因为我加了同步,所以错误报在同步这里,实际应该是算子调用出错了?或者是不是因为cann-ops-8.5.0出包时没有带上这个算子

torch_npu.npu_attention_worker_combine(schedule_context_npu, expert_scales_npu, layer_id_npu, H, token_dtype=torch.half, need_schedule=0)
torch_npu.npu.synchronize()


那可以再执行下上述用例,看是否还报torch_npu.npu.synchronize()错误


那可以再执行下上述用例,看是否还报torch_npu.npu.synchronize()错误
python3 -c 'import torch; import torch_npu; torch_npu.npu.synchronize()
python3 test_npu_attention_worker_combine.py
/usr/local/conda/lib/python3.11/site-packages/torch_npu/utils/storage.py:43: UserWarning: TypedStorage is deprecated. It will be removed in the future and UntypedStorage will be the only storage class. This should only matter to you if you are using storages directly. To access UntypedStorage directly, use tensor.untyped_storage() instead of tensor.storage()
if self.device.type != 'cpu':
/workdir/pytorch/third_party/op-plugin/test/test_custom_ops/test_npu_attention_worker_combine.py:216: UserWarning: The given buffer is not writable, and PyTorch does not support non-writable tensors. This means you can write to the underlying (supposedly non-writable) buffer using the tensor. You may want to copy the buffer to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at /pytorch/torch/csrc/utils/tensor_new.cpp:1581.)
schedule_context_tensor = torch.frombuffer(byte_data, dtype=torch.int8)
E
======================================================================
ERROR: test_npu_attention_worker_combine_001 (__main__.TestAttentionWorkerCombine.test_npu_attention_worker_combine_001)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/workdir/pytorch/third_party/op-plugin/test/test_custom_ops/test_npu_attention_worker_combine.py", line 225, in test_npu_attention_worker_combine_001
torch_npu.npu.synchronize()
File "/usr/local/conda/lib/python3.11/site-packages/torch_npu/npu/utils.py", line 72, in synchronize
return torch_npu._C._npu_synchronize()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: npuSynchronizeDevice:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:564 NPU function error: SUSPECT REMOTE ERROR, error code is 507057
[ERROR] 2026-01-23-18:30:50 (PID:657932, Device:0, RankID:-1) ERR00100 PTA call acl api failed
----------------------------------------------------------------------
Ran 1 test in 3.196s
FAILED (errors=1)


我看原来的测试用例没有这个torch_npu.npu.synchronize(),这是你手动添加的吗


提交提案之前,请先检索仓库内是否已有相同的提案,如已有请在同一提案中进行讨论。
💻 需求背景、当前现状、期望实现的功能内容、具体的设计方案、以及测试方案
当前需要再A3机器上实现AFD,目前看pytorch/third_party/op-plugin/test/test_custom_ops/下有如下单测:
test_attention_to_ffn.py - aclnnAttentionToFFN
test_ffn_worker_schedule.py - aclnnInplaceFfnWorkerScheduler
test_npu_ffn_worker_batching.py - aclnnFfnWorkerBatching
以及
test_ffn_to_attention.py - aclnnFFNToAttention
test_attention_worker_schedule.py - aclnnInplaceAttentionWorkerScheduler
test_npu_attention_worker_combine.py - aclnnAttentionWorkerCombine
几个文件以及需要调用的ops transformer算子,当前只能看到aclnnAttentionToFFN和aclnnFFNToAttention的kernel源代码,且跑不通test_npu_ffn_worker_batching.py和test_npu_attention_worker_combine.py的测试,请问什么时候算子会完全开源呢?
报错如下
---------------------------------------------------------------------- Traceback (most recent call last): File "/workdir/pytorch/third_party/op-plugin/test/test_custom_ops/test_npu_ffn_worker_batching.py", line 604, in test_npu_ffn_worker_batching_001 torch_npu.npu.synchronize() File "/usr/local/conda/lib/python3.11/site-packages/torch_npu/npu/utils.py", line 72, in synchronize return torch_npu._C._npu_synchronize() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: npuSynchronizeDevice:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:564 NPU function error: SUSPECT REMOTE ERROR, error code is 507057 [ERROR] 2026-01-22-20:08:25 (PID:621663, Device:0, RankID:-1) ERR00100 PTA call acl api failed替代方案
补充说明
欢迎加入社区,感谢您对社区的贡献 🎉!