{"record":{"id":"f5f1052cc303d1d0","repo":"vllm-project/vllm","slug":"aot-compile-is-not-supported-by-the-current-config","errorCode":null,"errorMessage":"aot_compile is not supported by the current configuration. Please make sure torch.compile is enabled with the latest version of PyTorch (current using torch: {torch.__version__})","messagePattern":"aot_compile is not supported by the current configuration\\. Please make sure torch\\.compile is enabled with the latest version of PyTorch \\(current using torch: (.+?)\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"vllm/compilation/wrapper.py","lineNumber":164,"sourceCode":"\n        with aot_context:\n            self._compiled_callable = torch.compile(\n                compiled_ptr,\n                fullgraph=True,\n                dynamic=False,\n                backend=backend,\n                options=options,\n            )\n\n        if envs.VLLM_USE_BYTECODE_HOOK and mode != CompilationMode.STOCK_TORCH_COMPILE:\n            self._bytecode_hook_handle = (\n                torch._dynamo.convert_frame.register_bytecode_hook(self.bytecode_hook)\n            )\n            self._compiled_bytecode: CodeType | None = None\n\n    def aot_compile(self, *args: Any, **kwargs: Any) -> Any:\n        if not hasattr(self._compiled_callable, \"aot_compile\"):\n            raise RuntimeError(\n                \"aot_compile is not supported by the current configuration. \"\n                \"Please make sure torch.compile is enabled with the latest \"\n                f\"version of PyTorch (current using torch: {torch.__version__})\"\n            )\n        return self._compiled_callable.aot_compile((args, kwargs))\n\n    def __call__(self, *args: Any, **kwargs: Any) -> Any:\n        if envs.VLLM_USE_BYTECODE_HOOK:\n            if (\n                self.vllm_config.compilation_config.mode\n                == CompilationMode.STOCK_TORCH_COMPILE\n            ):\n                return self._compiled_callable(*args, **kwargs)\n\n            if not self._compiled_bytecode:\n                # Make sure a compilation is triggered by clearing dynamo\n                # cache.\n                torch._dynamo.eval_frame.remove_from_cache(self.original_code_object())","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/compilation/wrapper.py#L146-L182","documentation":"VllmBackend's compiled artifact exposes aot_compile() (used by vLLM's AOT compilation tooling) only when the backend was created with torch.compile enabled under a recent PyTorch (enable_aot_compile support). The wrapper method delegates to self._compiled_callable.aot_compile; if that attribute is absent — wrong compilation mode or old torch — it raises RuntimeError with the current torch version.","triggerScenarios":"Calling TorchCompileWrapper.aot_compile(...) when the underlying torch.compile'd callable (built with mode!=VLLM_COMPILE, or on a PyTorch lacking torch._dynamo.config.enable_aot_compile) has no aot_compile attribute. Typical when running the AOT compile script against a config compiled in stock mode or an old torch wheel.","commonSituations":"Using vLLM's AOT pre-compilation tooling on nightly/old torch mixes; setting compilation mode to STOCK_TORCH_COMPILE or NONE and still invoking aot_compile; running aot compile on CPU-only old builds.","solutions":["Upgrade PyTorch to the latest version supported by your vLLM build.","Set compilation_config.mode to CompilationMode.VLLM_COMPILE (the vLLM backend exposes aot_compile) before wrapping.","If AOT is not needed, skip calling aot_compile and run normal serving."],"exampleFix":"# before\nwrapper = TorchCompileWrapper(module, ...)  # mode=STOCK_TORCH_COMPILE\nartifacts = wrapper.aot_compile(*args)  # RuntimeError\n# after\nvllm_config.compilation_config.mode = CompilationMode.VLLM_COMPILE\nwrapper = TorchCompileWrapper(module, ...)\nartifacts = wrapper.aot_compile(*args)","handlingStrategy":"validation","validationCode":"from vllm.utils import is_torch_equal_or_newer\n\ndef aot_supported(wrapper) -> bool:\n    return hasattr(getattr(wrapper, '_compiled_callable', None), 'aot_compile') and is_torch_equal_or_newer('2.8')","typeGuard":null,"tryCatchPattern":"if not hasattr(wrapper._compiled_callable, 'aot_compile'):\n    raise SystemExit('AOT compile requires VLLM_COMPILE mode and latest torch')\nartifacts = wrapper.aot_compile(*args)","preventionTips":["Use the latest torch for AOT tooling","Set mode=VLLM_COMPILE before AOT compilation","Probe hasattr(_compiled_callable, 'aot_compile') before calling"],"tags":["aot-compile","version-compat","torch-compile","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}