{"record":{"id":"62415840558ebfc6","repo":"vllm-project/vllm","slug":"postgradpassmanager-can-not-be-kept-in-compilation","errorCode":null,"errorMessage":"PostGradPassManager can not be kept in CompilationConfig.","messagePattern":"PostGradPassManager can not be kept in CompilationConfig\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vllm/compilation/backends.py","lineNumber":959,"sourceCode":"        )\n\n        # Make sure pre_grad_custom_pass is not pickled\n        # as part of AOTAutograd built-in cache key\n        # TODO(luka) is there a cleaner way to do this\n        import torch._inductor.config as inductor_config\n\n        ignore = inductor_config._cache_config_ignore_prefix + [pre_grad_pass_key]\n        assert \"_cache_config_ignore_prefix\" not in self.inductor_config\n        self.inductor_config[\"_cache_config_ignore_prefix\"] = ignore\n\n        # Configure the (nominally post-grad) pass manager\n        self.pass_manager.configure(self.vllm_config)\n\n        # Post-grad custom passes are run using the post_grad_custom_post_pass\n        # hook. If a pass for that hook exists, add it to the pass manager.\n        if self.pass_key in self.inductor_config:\n            if isinstance(self.inductor_config[self.pass_key], PostGradPassManager):\n                raise ValueError(\n                    \"PostGradPassManager can not be kept in CompilationConfig.\"\n                )\n            else:\n                # Config should automatically wrap all inductor passes\n                assert isinstance(\n                    self.compilation_config.inductor_compile_config[self.pass_key],\n                    InductorPass,\n                )\n                self.pass_manager.add(\n                    self.compilation_config.inductor_compile_config[self.pass_key]\n                )\n        self.inductor_config[self.pass_key] = self.pass_manager\n\n    def _log_compilation_config(self):\n        \"\"\"Log vLLM compilation config for TORCH_TRACE/tlparse.\"\"\"\n        cc = self.compilation_config\n        pass_cfg = cc.pass_config\n","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/compilation/backends.py#L941-L977","documentation":"InductorAdaptor.configure() stores its PostGradPassManager under inductor_config[pass_key] (post_grad_custom_post_pass). If the user-supplied compilation config already contains a raw PostGradPassManager at that key (instead of a serializable InductorPass), it is rejected, because everything kept in CompilationConfig/inductor_config must be config data that can be serialized and cached, and the adapter wraps passes itself.","triggerScenarios":"Setting -O3/compilation config like compilation_config={'inductor_compile_config': {'post_grad_custom_post_pass': <PostGradPassManager instance>}} or passing such a config programmatically; configure() detects the manager instance and raises ValueError.","commonSituations":"Advanced users porting older vLLM config recipes that passed a pass manager directly; code that constructs its own PostGradPassManager and injects it into inductor_compile_config.","solutions":["Pass an InductorPass instance (e.g. a custom pass class) in inductor_compile_config[pass_key]; vLLM wraps it into the manager for you","Remove the post_grad_custom_post_pass key from your config entirely if you do not need custom post-grad passes","Register custom passes via the supported VLLM_CUSTOM_INDUCTOR_PASS / config API surface rather than injecting a manager"],"exampleFix":"# before\nconfig[\"inductor_compile_config\"][\"post_grad_custom_post_pass\"] = my_pass_manager\n# after\nconfig[\"inductor_compile_config\"][\"post_grad_custom_post_pass\"] = my_inductor_pass  # InductorPass instance","handlingStrategy":"validation","validationCode":"from vllm.compilation.inductor_pass import InductorPass, PostGradPassManager\nval = config.get(\"inductor_compile_config\", {}).get(\"post_grad_custom_post_pass\")\nassert not isinstance(val, PostGradPassManager), \"pass an InductorPass, not a manager\"","typeGuard":"def is_valid_pass_config(v) -> bool:\n    from vllm.compilation.inductor_pass import InductorPass, PostGradPassManager\n    return v is None or (isinstance(v, InductorPass) and not isinstance(v, PostGradPassManager))","tryCatchPattern":null,"preventionTips":["Never store live manager objects in compilation config; config must stay serializable","Follow the documented custom-inductor-pass registration API"],"tags":["compilation","torch-compile","configuration","api-misuse"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}