[PyTorch] torch.compile fails on FusedAttnBackend IntEnum comparisons
I maintainer di solito rispondono entro 2 giorni
@pggPL ci sta già lavorando.
Dal 20/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Describe the bug
torch.compile(fullgraph=True) fails in TE's fused DotProductAttention path when comparing FusedAttnBackend members:
fused_attention_backend != FusedAttnBackend["No_Backend"]
-> FusedAttnBackend.__ne__
-> FusedAttnBackend.__eq__
-> int.__eq__(self, other)
torch._dynamo.exc.Unsupported: Missing tp_richcompare_impl override
Developer debug context:
tp_richcompare_impl UserDefinedObjectVariable(FusedAttnBackend) __eq__
This affects the fused DPA cases in tests/pytorch/test_torch_compile.py, before an attention kernel runs. The same failure can be reproduced using only PyTorch on CPU.
Minimal reproduction
from enum import IntEnum
import torch
class Backend(IntEnum):
NO = 0
YES = 1
def __eq__(self, other):
return int.__eq__(self, other)
def __ne__(self, other):
result = self.__eq__(other)
return result if result is NotImplemented else not result
def f(x, backend):
return x + 1 if backend != Backend.NO else x - 1
x = torch.ones(2)
print("eager:", f(x, Backend.YES))
print("compiled:", torch.compile(f, backend="eager", fullgraph=True)(x, Backend.YES))
Expected behavior
Both calls return tensor([2., 2.]). The compiled call instead raises the Dynamo error above.
Environment
- CPU reproduction: Linux x86_64, Docker, Python 3.12.3.
- PyTorch:
2.15.0a0+fd23299d96.nvinternal.main. - The reproducer requires neither TE nor CUDA.
- The original TE failures were observed on A100, H100, B200, and GB200.
Upstream diagnosis and existing fix
The regression was introduced by pytorch/pytorch@95dddcf5d6388e7216717857b546df7cbfa073a7, “Remove _base_vt” (pytorch/pytorch#193679). With the same installed PyTorch binaries, importing the complete Dynamo sources from its parent 8ab021bb passes the reproducer; importing the sources from 95dddcf5 fails.
BuiltinVariable.call_method routes int.__eq__ through call_base_method before reaching the existing constant-folding path for explicit comparisons. Enum members use UserDefinedObjectVariable, whose MRO lacks the ConstantVariable implementation required by that route.
The open pytorch/pytorch#199496 (“Support unbound builtin method descriptors”, by KarhouTam) removes this early dispatch as part of a broader fix. Applying its relevant isolated change resolves this reproducer and passes 105 focused comparison checks; the full PR has not been validated here.
As of 2026-10-20, PyTorch main at ec16340feb88f278c3a76ded17e21ec3a143c7c4 still contains the problematic dispatch ordering (source inspection). This issue tracks the impact on TE and the upstream resolution.
- Lingua principale
- Python
- Stelle
- 3.6k
- Fork
- 872
- Merge medio
- 4g 11h
- PR unite (30g)
- 59
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/TransformerEngine
-
[PyTorch] fp8_cs_quantize fake implementation returns a vector inverse scale instead of a scalarForse di nuovo libera @sanjana658 l’ha presa 16 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA/TransformerEngine#3636 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug] Backend selection picks FA3 for training with head_dim_qk=192 / v_head_dim=128, but FA3 backward cannot run itForse di nuovo libera @modelpath-dev l’ha presa 50 giorni fa e non c’è nessuna pull request aperta. Apertaattention
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
NVIDIA/TransformerEngine#3481 · 4 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Increase MAX_TENSOR_NUMApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
NVIDIA/TransformerEngine#2189 · 7 commenti · 5 reazioni ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
NVIDIA/TransformerEngine#3729 ·
I maintainer di solito rispondono entro 2 giorni
-
[Feature] Fused gated RMSNorm (RMSNorm(x) * SiLU(gate)) for GDN output normForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
NVIDIA/TransformerEngine#3724 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di NVIDIA/TransformerEngine
Issue simili
-
Project submission:Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
slavakurilyak/awesome-ai-agents#845 ·
I maintainer di solito rispondono entro 1 giorno
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertadifficulty:2 enhancement good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 92/100
MakazhanAlpamys/Soup#2178 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
scverse/rapids-singlecell#854 ·
I maintainer di solito rispondono entro 1 giorno
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLForse già presa @ninglinLiu l’ha presa oggi. Apertaarea:frontend backend:slang bug direction:input
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 13 giorni