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

Abierto
#25,774 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@themanoj-025 ya está trabajando en esto.

Desde el 27/11/2026.

  • #25775 de @themanoj-025 — abierto
  • #25793 de @Roxen-AS — cerrado sin fusionar

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
70/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python, pytorch

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
5.2k
Forks
1.3k
Merge medio
1 d 7 h
PR fusionados (30 d)
644

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pytorch/executorch

Todos los issues de pytorch/executorch

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.