llvm / llvm/torch-mlir

More TorchToLinalg view failure cases

Open
#2,877 11 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

    %114 = torch.aten.view %112, %113 : !torch.vtensor<[?,?],i1>, !torch.list<int> -> !torch.vtensor<[1,1,?,?],i1>
<stdin>:929:10: error: failed to legalize operation 'torch.aten.view' that was explicitly marked illegal
    %7 = torch.aten.view %5, %6 : !torch.vtensor<[1,?],si64>, !torch.list<int> -> !torch.vtensor<[1,?],si64>  

For the latter, I know @ramiro050 landed https://github.com/huggingface/transformers/pull/26059 to avoid this issue for many models (the views are often no-ops).

While optimizing model developer code is great, eternally patching huggingface models seems worse than supporting the lowering and then having a pass remove it as a no-op.

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 by tracing the TorchToLinalg handling for the reported torch.aten.view failures and compare both error cases with the linked Transformers workaround. Done means the reported view cases lower successfully without requiring those model-specific patches, with no-op views handled as described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, pytorch
Domain
compilers, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.