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

未關閉
#25,774 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@themanoj-025 已經在處理了。

開始於 2026年11月27日。

  • #25775 來自 @themanoj-025 —— 未關閉
  • #25793 來自 @Roxen-AS —— 已關閉,未合併

評估

難度
3/5
預估耗時
1-2 天
新手友好度
70/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python, pytorch

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
5.2k
分支
1.3k
平均合併
1 天 7 小時
30 天內合併 PR
644

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

pytorch/executorch 的其他 Issue

查看 pytorch/executorch 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。