Skip to content

matmulOp miss the check with the dim of result #4309

@zhenliji

Description

@zhenliji

In the onnx level, I try express matmul of one dim. The mlir is legal that is "torch.operator "onnx.MatMul"(%arg0, %arg1) : (!torch.vtensor<[1],f16>, !torch.vtensor<[1],f16>) -> !torch.vtensor<[1],f16>". But the mlir that is "torch.operator "onnx.MatMul"(%arg0, %arg1) : (!torch.vtensor<[],f16>, !torch.vtensor<[1],f16>) -> !torch.vtensor<[],f16>" is also legal, so when only have one dim, matmulOp's result allow 0 rank and 1 rank.

This lead to a failure when convert AtenMatmulOp. The code location is the "torch-mlir/lib/Conversion/TorchToLinalg/Linear.cpp". The patten transform the matmulOp into a dotOp, which is a 0 rank result by default. If the result is 1 rank in the onnx level, that would be failed.

Should we add verify of the result's dim for the matmul operator?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions