vllm-project/vllm · error · ValueError

PostGradPassManager can not be kept in CompilationConfig.

Error message

PostGradPassManager can not be kept in CompilationConfig.

What it means

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.

Source

Thrown at vllm/compilation/backends.py:959

        )

        # Make sure pre_grad_custom_pass is not pickled
        # as part of AOTAutograd built-in cache key
        # TODO(luka) is there a cleaner way to do this
        import torch._inductor.config as inductor_config

        ignore = inductor_config._cache_config_ignore_prefix + [pre_grad_pass_key]
        assert "_cache_config_ignore_prefix" not in self.inductor_config
        self.inductor_config["_cache_config_ignore_prefix"] = ignore

        # Configure the (nominally post-grad) pass manager
        self.pass_manager.configure(self.vllm_config)

        # Post-grad custom passes are run using the post_grad_custom_post_pass
        # hook. If a pass for that hook exists, add it to the pass manager.
        if self.pass_key in self.inductor_config:
            if isinstance(self.inductor_config[self.pass_key], PostGradPassManager):
                raise ValueError(
                    "PostGradPassManager can not be kept in CompilationConfig."
                )
            else:
                # Config should automatically wrap all inductor passes
                assert isinstance(
                    self.compilation_config.inductor_compile_config[self.pass_key],
                    InductorPass,
                )
                self.pass_manager.add(
                    self.compilation_config.inductor_compile_config[self.pass_key]
                )
        self.inductor_config[self.pass_key] = self.pass_manager

    def _log_compilation_config(self):
        """Log vLLM compilation config for TORCH_TRACE/tlparse."""
        cc = self.compilation_config
        pass_cfg = cc.pass_config

View on GitHub (pinned to c794754062)

Solutions

  1. Pass an InductorPass instance (e.g. a custom pass class) in inductor_compile_config[pass_key]; vLLM wraps it into the manager for you
  2. Remove the post_grad_custom_post_pass key from your config entirely if you do not need custom post-grad passes
  3. Register custom passes via the supported VLLM_CUSTOM_INDUCTOR_PASS / config API surface rather than injecting a manager

Example fix

# before
config["inductor_compile_config"]["post_grad_custom_post_pass"] = my_pass_manager
# after
config["inductor_compile_config"]["post_grad_custom_post_pass"] = my_inductor_pass  # InductorPass instance
Defensive patterns

Strategy: validation

Validate before calling

from vllm.compilation.inductor_pass import InductorPass, PostGradPassManager
val = config.get("inductor_compile_config", {}).get("post_grad_custom_post_pass")
assert not isinstance(val, PostGradPassManager), "pass an InductorPass, not a manager"

Type guard

def is_valid_pass_config(v) -> bool:
    from vllm.compilation.inductor_pass import InductorPass, PostGradPassManager
    return v is None or (isinstance(v, InductorPass) and not isinstance(v, PostGradPassManager))

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/62415840558ebfc6. Report an issue: GitHub.