TorchToTMTensor CumSum Lowering Only Supports Constant Axis
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 736
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 15
Description
Here,
the TorchToTMTensor lowering checks to make sure that dim is a TorchConstantInt.
However, ONNX forces the axis to be variable because it allows axis to be a tensor.
This causes (at least part of) the lowering failure described in https://github.com/nod-ai/iree-amd-aie/issues/103
opt-125M.fp32.onnx.mlir:231:12: error: failed to legalize operation 'torch.aten.cumsum' that was explicitly marked illegal
%228 = torch.operator "onnx.CumSum"(%226, %227) : (!torch.vtensor<[1,6],si64>, !torch.vtensor<[],si32>) -> !torch.vtensor<[1,6],si64>
^
opt-125M.fp32.onnx.mlir:231:12: note: see current operation: %287 = "torch.aten.cumsum"(%18, %286, %16) : (!torch.vtensor<[1,6],si64>, !torch.int, !torch.int) -> !torch.vtensor<[1,6],si64> loc("opt-125M.fp32.onnx.mlir":231:12)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/Conversion/TorchToTMTensor/TorchToTMTensor.cpp around line 1532 and inspect the TorchToTMTensor lowering for torch.aten.cumsum. Compare its constant-axis check with the ONNX-generated operation and the opt-125M.fp32.onnx.mlir diagnostic. Done means the lowering accepts the variable axis form described here and no longer fails to legalize that cumsum operation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, pytorch
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100