已关闭
[Question|问题咨询]: CANN 8.3.RC2版本上调用torch.istft, n_fft>=2048时报异常 #31
XTechFly创建于 3月26日关闭于 4月9日
3月26日 修改了issue 的描述
demoauguste
3月27日 评论:
3月27日 评论:
您好,能提供下具体的调用部分代码吗?


XTechFly
3月28日 评论:
3月28日 评论:
b35d2916b73f43efb555ebecf478723d.zip
# 不支持 n_fft 320、640、4096
import torch
try:
import torch_npu
from torch_npu.contrib import transfer_to_npu
except ImportError:
print("⚠️ torch_npu not found, NPU tests will be skipped.")
# Check if CUDA/NPU is available and set device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
input = torch.randn(480000).to(device)
for fft_size in [320, 480, 640, 960, 1920, 512, 1024, 2048, 4096]:
try:
output = torch.stft(input, n_fft=fft_size, hop_length=fft_size//2, window=torch.hann_window(fft_size).to(device), return_complex=True)
print(f"✅ torch.stft with n_fft={fft_size} - Output size: {output.size()}, device: {output.device}, output dtype: {output.dtype}")
except RuntimeError as e:
print(f"❌ torch.stft with n_fft={fft_size} - Error: {e}")
print()
for fft_size in [320, 480, 640, 960, 1920, 512, 1024, 2048, 4096]:
try:
spec = torch.stft(input, n_fft=fft_size, hop_length=fft_size//2, window=torch.hann_window(fft_size).to(device), return_complex=True)
recon = torch.istft(spec, n_fft=fft_size, hop_length=fft_size//2, window=torch.hann_window(fft_size).to(device), length=input.shape[-1])
print(f"✅ torch.istft with n_fft={fft_size} - Output size: {recon.size()}, device: {recon.device}, output dtype: {recon.dtype}")
except RuntimeError as e:
print(f"❌ torch.istft with n_fft={fft_size} - Error: {e}")
""" 测试结果
✅ torch.stft with n_fft=320 - Output size: torch.Size([161, 1001]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=480 - Output size: torch.Size([241, 667]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=640 - Output size: torch.Size([321, 501]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=960 - Output size: torch.Size([481, 334]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=1920 - Output size: torch.Size([961, 167]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=512 - Output size: torch.Size([257, 626]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=1024 - Output size: torch.Size([513, 313]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=2048 - Output size: torch.Size([1025, 157]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=4096 - Output size: torch.Size([2049, 79]), device: npu:0, output dtype: torch.complex64
[W324 07:42:50.139033988 GetCANNInfo.cpp:117] Warning: Driver Version: B is invalid or not supported yet. (function operator())
✅ torch.istft with n_fft=320 - Output size: torch.Size([160000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=480 - Output size: torch.Size([160000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=640 - Output size: torch.Size([160000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=960 - Output size: torch.Size([160000]), device: npu:0, output dtype: torch.float32
❌ torch.istft with n_fft=1920 - Error: unfold_backward:third_party/op-plugin/op_plugin/ops/opapi/UnfoldBackwardLernelNpuOpApi.cpp:38 NPU function error: call aclnnUnfoldGrad failed, error code is 561002
[ERROR] 2026-03-24-07:42:50 (PID:6196, Device:0, RankID:0) ERR00100 PTA call acl api failed.
EZ9999: Inner Error!
EZ9999[PID: 6196] 2026-03-24-07:42:50.518.011 (EZ9999): TasksOnceMaxPerCore 0 must be greater than 0.[FUNC:Tiling4Block][FILE:unfold_grad_tiling.cpp][LINE:300]
TraceBack (most recent call last):
Tiling4Block failed.[FUNC:DoTiling][FILE:unfold_grad_tiling.cpp][LINE:374]
UnfoldGrad do tiling failed, ret is -1.
Check NnopbaseExecutorDoTiling(executor) failed
Check NnopbaseExecutorTilingAndUpdateBinInfo(executor) failed
Check NnopbaseExecutorMatchCache(executor) failed
Check NnopbaseRunForWorkspace(*executor, workspaceSize) failed
✅ torch.istft with n_fft=512 - Output size: torch.Size([160000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=1024 - Output size: torch.Size([160000]), device: npu:0, output dtype: torch.float32
❌ torch.istft with n_fft=2048 - Error: unfold_backward:third_party/op-plugin/op_plugin/ops/opapi/UnfoldBackwardLernelNpuOpApi.cpp:38 NPU function error: call aclnnUnfoldGrad failed, error code is 561002
[ERROR] 2026-03-24-07:42:50 (PID:6196, Device:0, RankID:0) ERR00100 PTA call acl api failed.
EZ9999: Inner Error!
EZ9999[PID: 6196] 2026-03-24-07:42:50.574.437 (EZ9999): TasksOnceMaxPerCore 0 must be greater than 0.[FUNC:Tiling4Block][FILE:unfold_grad_tiling.cpp][LINE:300]
TraceBack (most recent call last):
Tiling4Block failed.[FUNC:DoTiling][FILE:unfold_grad_tiling.cpp][LINE:374]
UnfoldGrad do tiling failed, ret is -1.
Check NnopbaseExecutorDoTiling(executor) failed
Check NnopbaseExecutorTilingAndUpdateBinInfo(executor) failed
Check NnopbaseExecutorMatchCache(executor) failed
Check NnopbaseRunForWorkspace(*executor, workspaceSize) failed
❌ torch.istft with n_fft=4096 - Error: unfold_backward:third_party/op-plugin/op_plugin/ops/opapi/UnfoldBackwardLernelNpuOpApi.cpp:38 NPU function error: call aclnnUnfoldGrad failed, error code is 561002
[ERROR] 2026-03-24-07:42:50 (PID:6196, Device:0, RankID:0) ERR00100 PTA call acl api failed.
EZ9999: Inner Error!
EZ9999[PID: 6196] 2026-03-24-07:42:50.725.019 (EZ9999): TasksOnceMaxPerCore 0 must be greater than 0.[FUNC:Tiling4Block][FILE:unfold_grad_tiling.cpp][LINE:300]
TraceBack (most recent call last):
Tiling4Block failed.[FUNC:DoTiling][FILE:unfold_grad_tiling.cpp][LINE:374]
UnfoldGrad do tiling failed, ret is -1.
Check NnopbaseExecutorDoTiling(executor) failed
Check NnopbaseExecutorTilingAndUpdateBinInfo(executor) failed
Check NnopbaseExecutorMatchCache(executor) failed
Check NnopbaseRunForWorkspace(*executor, workspaceSize) failed
"""


demoauguste
3月31日 评论:
3月31日 评论:
您好,从报错信息上分析,是op-plugin在调用UnfoldBackward算子的时候,没有将数据转为连续内存,建议在op-plugin开源仓提相关issue,这个算子调用目前暂不涉及sip仓的算子实现。
op-plugin代码仓链接:https://gitcode.com/Ascend/op-plugin


4月9日 issue状态由 进行中 改变为 已完成
4月9日 关闭了 issue
4月9日 添加了label:Accepted
huangyunlong
4月16日 评论:
4月16日 评论:
同样的torch_npu版本,配套cann 8.3就报错,升级cann到最新版本9.0.0就好了,我理解这就是cann中算子问题


在8.3.RC2上报以下错误, 相关版本:
toolkit_running_version=[8.3.0.2.220:8.3.RC2]
torch 2.8.0+cpu
torch_npu 2.8.0
torchaudio 2.8.0+cpu
torchvision 0.23.0+cpu
CANN 8.2.RC1没有问题
Welcome to ask questions and discuss with other members.
问题描述
✅ torch.stft with n_fft=320 - Output size: torch.Size([161, 3001]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=480 - Output size: torch.Size([241, 2001]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=640 - Output size: torch.Size([321, 1501]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=960 - Output size: torch.Size([481, 1001]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=1920 - Output size: torch.Size([961, 501]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=512 - Output size: torch.Size([257, 1876]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=1024 - Output size: torch.Size([513, 938]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=2048 - Output size: torch.Size([1025, 469]), device: npu:0, output dtype: torch.complex64
✅ torch.stft with n_fft=4096 - Output size: torch.Size([2049, 235]), device: npu:0, output dtype: torch.complex64
[W326 19:25:01.837237151 GetCANNInfo.cpp:117] Warning: Driver Version: X[.@h is invalid or not supported yet. (function operator())
✅ torch.istft with n_fft=320 - Output size: torch.Size([480000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=480 - Output size: torch.Size([480000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=640 - Output size: torch.Size([480000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=960 - Output size: torch.Size([480000]), device: npu:0, output dtype: torch.float32
❌ torch.istft with n_fft=1920 - Error: unfold_backward:third_party/op-plugin/op_plugin/ops/opapi/UnfoldBackwardLernelNpuOpApi.cpp:38 NPU function error: call aclnnUnfoldGrad failed, error code is 561002
[ERROR] 2026-03-26-19:25:02 (PID:332703, Device:0, RankID:-1) ERR00100 PTA call acl api failed.
EZ9999: Inner Error!
EZ9999[PID: 332703] 2026-03-26-19:25:02.203.151 (EZ9999): TasksOnceMaxPerCore 0 must be greater than 0.[FUNC:Tiling4Block][FILE:unfold_grad_tiling.cpp][LINE:300]
TraceBack (most recent call last):
Tiling4Block failed.[FUNC:DoTiling][FILE:unfold_grad_tiling.cpp][LINE:374]
UnfoldGrad do tiling failed, ret is -1.
Check NnopbaseExecutorDoTiling(executor) failed
Check NnopbaseExecutorTilingAndUpdateBinInfo(executor) failed
Check NnopbaseExecutorMatchCache(executor) failed
Check NnopbaseRunForWorkspace(*executor, workspaceSize) failed
✅ torch.istft with n_fft=512 - Output size: torch.Size([480000]), device: npu:0, output dtype: torch.float32
✅ torch.istft with n_fft=1024 - Output size: torch.Size([480000]), device: npu:0, output dtype: torch.float32
❌ torch.istft with n_fft=2048 - Error: unfold_backward:third_party/op-plugin/op_plugin/ops/opapi/UnfoldBackwardLernelNpuOpApi.cpp:38 NPU function error: call aclnnUnfoldGrad failed, error code is 561002
[ERROR] 2026-03-26-19:25:02 (PID:332703, Device:0, RankID:-1) ERR00100 PTA call acl api failed.
EZ9999: Inner Error!
EZ9999[PID: 332703] 2026-03-26-19:25:02.257.913 (EZ9999): TasksOnceMaxPerCore 0 must be greater than 0.[FUNC:Tiling4Block][FILE:unfold_grad_tiling.cpp][LINE:300]
TraceBack (most recent call last):
Tiling4Block failed.[FUNC:DoTiling][FILE:unfold_grad_tiling.cpp][LINE:374]
UnfoldGrad do tiling failed, ret is -1.
Check NnopbaseExecutorDoTiling(executor) failed
Check NnopbaseExecutorTilingAndUpdateBinInfo(executor) failed
Check NnopbaseExecutorMatchCache(executor) failed
Check NnopbaseRunForWorkspace(*executor, workspaceSize) failed
❌ torch.istft with n_fft=4096 - Error: unfold_backward:third_party/op-plugin/op_plugin/ops/opapi/UnfoldBackwardLernelNpuOpApi.cpp:38 NPU function error: call aclnnUnfoldGrad failed, error code is 561002
[ERROR] 2026-03-26-19:25:02 (PID:332703, Device:0, RankID:-1) ERR00100 PTA call acl api failed.
EZ9999: Inner Error!
EZ9999[PID: 332703] 2026-03-26-19:25:02.402.132 (EZ9999): TasksOnceMaxPerCore 0 must be greater than 0.[FUNC:Tiling4Block][FILE:unfold_grad_tiling.cpp][LINE:300]
TraceBack (most recent call last):
Tiling4Block failed.[FUNC:DoTiling][FILE:unfold_grad_tiling.cpp][LINE:374]
UnfoldGrad do tiling failed, ret is -1.
Check NnopbaseExecutorDoTiling(executor) failed
Check NnopbaseExecutorTilingAndUpdateBinInfo(executor) failed
Check NnopbaseExecutorMatchCache(executor) failed
Check NnopbaseRunForWorkspace(*executor, workspaceSize) failed