[exir] operator.pow on a SymInt has no emitter target
維護者通常 1 天內回覆
評估
- 難度
- 4/5
- 預估耗時
- 1-2 天
- 新手友好度
- 25/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
研究方向
Start with executorch/exir/passes/replace_edge_with_backend_pass.py and trace how EdgeToBackendOpsPass handles symbolic operators and propagates meta["val"]. The issue describes rewriting integer powers as multiplication chains and includes a minimal reproducer; check for existing tests covering symbolic power lowering. Done means the reproducer exports successfully and tests cover the lowering. A linked pull request is already open.
由索引模型根據 Issue 內容生成。
描述
🐛 Describe the bug
When lowering an exported program with dynamic shapes where a SymInt is raised to an integer power (such as x.shape[0] ** 2, used in SeamlessM4T's relative positional bias calculation), to_executorch() fails with:
executorch.exir.error.InternalError: Failed with error: invalid target for call_function <built-in function pow>
While executing %pow_1 : [num_users=1] = call_function[target=operator.pow](args = (%sym_size, 2), kwargs = {})
Because executorch_prim does not have a pow kernel, EdgeToBackendOpsPass leaves operator.pow untouched, and _Emitter.call_function fails on the unregistered operator.
This bug breaks export of real models such as Hugging Face's SeamlessM4T, tracked in huggingface/transformers#51303 (Item 1).
Versions / Environment
executorch: 1.6.0 / main
PyTorch: 2.15.0+cpu
Python: 3.12 / 3.11
OS: Windows 11 / Linux
Minimal Reproducer
import torch
from executorch.exir import to_edge_transform_and_lower
class M(torch.nn.Module):
def forward(self, x):
return x.new_zeros(x.shape[0] ** 2)
ep = torch.export.export(M(), (torch.randn(4),), dynamic_shapes=({0: torch.export.Dim.AUTO},))
to_edge_transform_and_lower(ep).to_executorch()
Proposed Fix & Investigation
In EdgeToBackendOpsPass (executorch/exir/passes/replace_edge_with_backend_pass.py):
Rewrite operator.pow(base, exp) for integer exponents ($n \ge 1$) into a multiplication chain using _PYTHON_SYM_OPS_TO_EXECUTORCH_SYM_OPS[operator.mul], properly propagating symbolic meta["val"] across intermediate nodes. I have verified this fix and will submit a pull request with unit test coverage.
- 主要語言
- Python
- 星號
- 5.2k
- 分支
- 1.3k
- 平均合併
- 1 天 7 小時
- 30 天內合併 PR
- 644
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
pytorch/executorch 的其他 Issue
-
to_edge_transform_and_lower ignores some ops_to_not_decompose requests: multi-output ops, and non-core ops without a decomposition可能已有人在做 @Eureka-Zhang 於 7 天前認領。 未關閉module: exir
難度 2/5 1-3 小時 新手友好度 66/100
pytorch/executorch#25620 ·
維護者通常 1 天內回覆
-
Qualcomm AI Engine Direct - fp16a8w quantization crashes on layer_norm可能已有人在做 @psiddh 於 21 天前認領。 未關閉bug module: qnn partner: qualcomm
難度 2/5 1-3 小時 新手友好度 74/100
pytorch/executorch#24434 · 已指派 1 人 ·
維護者通常 1 天內回覆
-
enhancement triaged
難度 2/5 半天 新手友好度 68/100
pytorch/executorch#21640 ·
維護者通常 1 天內回覆
-
quantize_per_channel and dequantize_per_tensor.tensor abort the process on a float32 scale可能已有人在做 @AxelNoun 今天認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
pytorch/executorch#25873 ·
維護者通常 1 天內回覆
-
XNNPACK INT4 linear returns incorrect per-channel outputs and fails groupwise FP16 on Apple M4 Max可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉bug module: quantization module: xnnpack
難度 4/5 3-5 天 新手友好度 43/100
pytorch/executorch#25854 ·
維護者通常 1 天內回覆
查看 pytorch/executorch 的全部 Issue
相似的 Issue
-
needs-triage
難度 2/5 1-3 小時 新手友好度 86/100
MakazhanAlpamys/Soup#3589 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 88/100
ClickHouse/clickhouse-connect#1266 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
biosustain/growthcurves_app#89 ·
維護者通常 1 天內回覆
-
`LogProxyConsumer._on_relation_departed` raises `APIError` when the promtail service does not exist未關閉
難度 2/5 1-3 小時 新手友好度 78/100
canonical/loki-k8s-operator#695 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
維護者通常 1 天內回覆