From 508eeec3c7545251041bb65c09c7e9b0e1a20421 Mon Sep 17 00:00:00 2001 From: xjtu-L <2701938983@qq.com> Date: Wed, 20 May 2026 13:52:06 +0000 Subject: [PATCH] fix(backend): re-raise RuntimeError when no pass matched in pass_mgr_direct When the backend raises RuntimeError (no pass matched), dynamo internally catches it and falls back to eager execution. The _CompileOnceWrapper then returns the eager result normally, causing the test framework to incorrectly report "success" instead of "failed". This patch detects the fallback (optimized_gm is None) and re-raises RuntimeError, making the behavior consistent with pass_mgr. --- pass_bench/torch/backend/pass_mgr_direct.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pass_bench/torch/backend/pass_mgr_direct.py b/pass_bench/torch/backend/pass_mgr_direct.py index 551e94ecf7..8db56b6502 100644 --- a/pass_bench/torch/backend/pass_mgr_direct.py +++ b/pass_bench/torch/backend/pass_mgr_direct.py @@ -517,5 +517,10 @@ def forward(self, *args, **kwargs): self.__dict__['forward'] = gm.forward # Release dynamo-compiled object — no longer needed. del self._compiled + else: + # Backend raised RuntimeError (no pass matched), dynamo fell back + # to eager. Re-raise so test framework treats this as failed, + # consistent with pass_mgr behavior. + raise RuntimeError("[PassMgrDirect] No passes modified the graph.") return result