[Bug] RemoveCloneOpsTransform folds a clone onto an input that is also an output

Ouverte
#25,774 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@themanoj-025 y travaille déjà.

Depuis le 27/11/2026.

  • #25775 par @themanoj-025 — ouverte
  • #25793 par @Roxen-AS — fermée sans fusion

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
70/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python, pytorch

Piste de recherche

Find RemoveCloneOpsTransform in the ExecuTorch codebase and read its implementation and nearby tests. Reproduce the issue with the supplied model and XNNPACK lowering command, then check how the transform handles graph outputs. Done when the clone is preserved when both it and its input are outputs, and the reproduction completes without the duplicate-output error.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

When a model returns both a value and its .contiguous()\ clone (hit by CLVP and PerceptionLM in Hugging Face Transformers), \RemoveCloneOpsTransform\ erases the clone and replaces all its uses with the clone's input.
Because both the clone and its input were returned in the graph output, replacing the clone with its input causes the same node to appear twice in the output tuple (e.g. (y, y)).

Subsequently, during backend lowering (such as XNNPACK's \generate_node_to_external_map), preprocessing fails with:
\RuntimeError: Output node 'aten_permute_copy_default' is already in the inputs. This is likely due to pass through arguments, which are not supported in XNNPACK Delegate.\

This issue tracks item 3 from https://github.com/huggingface/transformers/issues/51303.

Repro

\\python
import torch
from executorch.backends.xnnpack.partition.xnnpack_partitioner import XnnpackPartitioner
from executorch.exir import to_edge_transform_and_lower

class M(torch.nn.Module):
def forward(self, x):
y = (x * 2).permute(0, 2, 1)
return y, y.contiguous()

ep = torch.export.export(M(), (torch.randn(1, 4, 8),))
to_edge_transform_and_lower(ep, partitioner=[XnnpackPartitioner()]).to_executorch()
\\

Expected behavior

\RemoveCloneOpsTransform\ should not fold a clone onto an input when both the clone node and its input node produce an output, preserving distinct nodes in the graph output tuple.

Langage dominant
Python
Étoiles
5.2k
Forks
1.3k
Merge moyen
1 j 7 h
PR mergées (30 j)
644

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de pytorch/executorch

Toutes les issues de pytorch/executorch

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.