{"record":{"id":"ddc0dd9b4500d875","repo":"vllm-project/vllm","slug":"cudagraph-capture-sizes-not-supported-in-compile-s","errorCode":null,"errorMessage":"cudagraph_capture_sizes not supported in compile_sizes.This should be handled in `post_init_cudagraph_sizes`.","messagePattern":"cudagraph_capture_sizes not supported in compile_sizes\\.This should be handled in `post_init_cudagraph_sizes`\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"vllm/compilation/piecewise_backend.py","lineNumber":169,"sourceCode":"        log_string = f\"PiecewiseBackend: compile_ranges: {self.compile_ranges}\"\n        logger.debug_once(log_string)\n\n        self.compile_sizes = self.compilation_config.compile_sizes\n        log_string = f\"PiecewiseBackend: compile_sizes: {self.compile_sizes}\"\n        logger.debug_once(log_string)\n\n        self.sym_shape_indices = sym_shape_indices\n        self.returns_tuple = returns_tuple\n\n        # the entries for ranges that we need to either\n        self.range_entries: dict[Range, RangeEntry] = {}\n\n        # We only keep compilation management inside this class directly.\n        if self.compile_sizes is not None:\n            for size in self.compile_sizes:\n                if isinstance(size, str):\n                    assert size == \"cudagraph_capture_sizes\"\n                    raise NotImplementedError(\n                        \"cudagraph_capture_sizes not supported in compile_sizes.\"\n                        \"This should be handled in `post_init_cudagraph_sizes`.\"\n                    )\n                else:\n                    assert isinstance(size, int)\n                    range = Range(start=size, end=size)\n                    if range not in self.compile_ranges:\n                        self.range_entries[range] = RangeEntry(\n                            compile_range=range,\n                        )\n\n        for range in self.compile_ranges:\n            self.range_entries[range] = RangeEntry(\n                compile_range=range,\n            )\n\n        # Track whether we've logged the graph for this subgraph (only log once)\n        self._graph_logged = False","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/compilation/piecewise_backend.py#L151-L187","documentation":"PiecewiseBackend separates compile-time sizes (compile_sizes as concrete integers) from cudagraph capture sizes, which must be finalized after initialization (post_init_cudagraph_sizes) because they depend on runtime state. Passing the magic string 'cudagraph_capture_sizes' inside compile_sizes is explicitly rejected with NotImplementedError.","triggerScenarios":"Constructing PiecewiseBackend (or a backend factory returning it) with compile_sizes=['cudagraph_capture_sizes', ...] instead of leaving cudagraph sizes to the dedicated post-init mechanism.","commonSituations":"Writing a custom compilation backend that mimics vllm's VllmBackend sizes handling but forwards the cudagraph string into compile_sizes; misreading the backend API when porting from an older version where the string was tolerated.","solutions":["Remove 'cudagraph_capture_sizes' from compile_sizes and supply capture sizes via post_init_cudagraph_sizes().","Pass only concrete integer sizes in compile_sizes."],"exampleFix":"# before\nbackend = PiecewiseBackend(..., compile_sizes=['cudagraph_capture_sizes', 1, 2])\n# after\nbackend = PiecewiseBackend(..., compile_sizes=[1, 2, 4])\n# then set capture sizes via post_init_cudagraph_sizes","handlingStrategy":"validation","validationCode":"compile_sizes = [s for s in backend.compile_sizes or [] if not isinstance(s, str)]\nassert all(isinstance(s, int) for s in compile_sizes)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep cudagraph capture sizes out of compile_sizes","Use post_init_cudagraph_sizes for capture sizing","Read PiecewiseBackend docs before writing custom backends"],"tags":["compilation","piecewise-backend","cudagraph","vllm"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}