[exir] operator.pow on a SymInt has no emitter target

Offen
#25,767 0 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@JacobSzwejbka arbeitet bereits daran.

Seit 30.11.2026.

  • #25768 von @themanoj-025 — offen

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
python, pytorch

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

🐛 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.

Vorherrschende Sprache
Python
Sterne
5.2k
Forks
1.3k
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
644

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus pytorch/executorch

Alle Issues in pytorch/executorch

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.