llvm / llvm/torch-mlir

Missing dtype support for OnnxToTorch

Open
#3,255 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.9k
Forks
736
Avg merge
5d 22h
Merged PRs (30d)
15

Description

Current support: https://github.com/llvm/torch-mlir/blob/main/lib/Conversion/TorchOnnxToTorch/Utils.cpp#L64

According to [onnx dtype](https://onnx.ai/onnx/intro/concepts.html) and [torch dtype](https://github.com/llvm/torch-mlir/blob/main/include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h#L88), missing support:

- 4: onnx.TensorProto.UINT16
- 8: onnx.TensorProto.STRING
- 12: onnx.TensorProto.UINT32
- 13: onnx.TensorProto.UINT64
- 17: onnx.TensorProto.FLOAT8E4M3FN
- 18: onnx.TensorProto.FLOAT8E4M3FNUZ
- 19: onnx.TensorProto.FLOAT8E5M2
- 20: onnx.TensorProto.FLOAT8E5M2FNUZ
- 21: onnx.TensorProto.UINT4
- 22: onnx.TensorProto.INT4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/Conversion/TorchOnnxToTorch/Utils.cpp at the linked current dtype support and compare it with the ONNX dtype list and Torch types in include/torch-mlir/Dialect/Torch/Utils/TorchUpstream.h. Determine which listed UINT, STRING, FLOAT8, UINT4, and INT4 types have usable Torch representations; done means the supported mappings are handled consistently for every feasible listed dtype.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.