Failure to compile ONNX Kokoro-TTS model
- Dominant language
- C++
- Stars
- 3.9k
- Forks
- 1k
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 47
Description
https://huggingface.co/onnx-community/Kokoro-82M-ONNX/blob/main/onnx/model.onnx
iree-compile --iree-hal-target-device=local --iree-hal-local-target-device-backends=llvm-cpu --iree-llvmcpu-target-cpu=host kokoro_fp32.mlir -o kokoro_fp32.vmfb
```
kokoro_fp32.mlir:2137:13: error: failed to legalize operation 'torch.operator' that was explicitly marked illegal
%2133 = torch.operator "onnx.STFT"(%2131, %313, %314, %315) {torch.onnx.onesided = 1 : si64} : (!torch.vtensor<[?,?],f32>, !torch.vtensor<[],si64>, !torch.vtensor<[20],f32>, !torch.vtensor<[],si64>) -> !torch.vtensor<[],f32>
^
kokoro_fp32.mlir:2137:13: note: see current operation: %13100 = "torch.operator"(%13096, %627, %629, %631) <{name = "onnx.STFT"}> {torch.onnx.onesided = 1 : si64} : (!torch.vtensor<[?,?],f32>, !torch.vtensor<[],si64>, !torch.vtensor<[20],f32>, !torch.vtensor<[],si64>) -> !torch.vtensor<[],f32>
```
iree-compile --iree-hal-target-device=vulkan kokoro_fp32.mlir -o kokoro_fp32.vmfb
```
kokoro_fp32.mlir:2137:13: error: failed to legalize operation 'torch.operator' that was explicitly marked illegal
%2133 = torch.operator "onnx.STFT"(%2131, %313, %314, %315) {torch.onnx.onesided = 1 : si64} : (!torch.vtensor<[?,?],f32>, !torch.vtensor<[],si64>, !torch.vtensor<[20],f32>, !torch.vtensor<[],si64>) -> !torch.vtensor<[],f32>
^
kokoro_fp32.mlir:2137:13: note: see current operation: %13100 = "torch.operator"(%13096, %627, %629, %631) <{name = "onnx.STFT"}> {torch.onnx.onesided = 1 : si64} : (!torch.vtensor<[?,?],f32>, !torch.vtensor<[],si64>, !torch.vtensor<[20],f32>, !torch.vtensor<[],si64>) -> !torch.vtensor<[],f32>
```
Contributor guide
Research direction
Start with kokoro_fp32.mlir at the reported operation and compare the model at onnx/model.onnx. Investigate how iree-compile legalizes torch.operator for onnx.STFT for both the llvm-cpu and Vulkan commands; done means the model compiles without the reported legalization error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100