{"record":{"id":"c615c38dda387a75","repo":"vllm-project/vllm","slug":"unsupported-node-from-codegen-node-format-node","errorCode":null,"errorMessage":"Unsupported node from codegen: {node.format_node()}","messagePattern":"Unsupported node from codegen: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"vllm/compilation/codegen.py","lineNumber":112,"sourceCode":"                source = ref(node.args[0])\n                index = node.args[1]\n                assert isinstance(index, int)\n                lines.append(f\"    {node.name} = {source}[{index}]\")\n            else:\n                args_str = \", \".join(ref(a) for a in node.args)\n                kwargs_str = \", \".join(f\"{k}={ref(v)}\" for k, v in node.kwargs.items())\n                all_args = \", \".join(filter(None, [args_str, kwargs_str]))\n                lines.append(\n                    f\"    {node.name} = {_get_qualified_name(node.target)}({all_args})\"\n                )\n\n        elif node.op == \"output\":\n            assert len(node.args) == 1\n            ret = ref(node.args[0])\n            lines.append(f\"    return {ret}\")\n\n        else:\n            raise RuntimeError(f\"Unsupported node from codegen: {node.format_node()}\")\n\n        # Emit del for variables whose last use was this node.\n        if i in del_after and i < len(nodes) - 2:\n            names = sorted(del_after[i])\n            lines.append(f\"    del {', '.join(names)}\")\n\n    assert len(param_names) > 0\n    params = \", \".join(param_names)\n    kw_params = \", *, __vllm_submods__\" if with_submod else \"\"\n    header = f\"\\ndef {fn_name}({params}{kw_params}):\"\n    return (\n        \"\".join(inlined_submods) + \"\\n\".join([header] + lines) + \"\\n\",\n        submod_names,\n        consts,\n    )\n\n\n@dynamo_timed(\"vllm.generate_execution_code\")","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/vllm-project/vllm/blob/c794754062d49a8fdb63ab3c5215b488b865030c/vllm/compilation/codegen.py#L94-L130","documentation":"The code generator supports exactly placeholder, call_module (with_submod only), call_function, and output FX node ops. Any other op — typically call_method (tensor.method(...)) or get_attr — reaches the final else and raises RuntimeError with node.format_node() so the developer sees which node type broke codegen.","triggerScenarios":"Passing an FX graph to the codegen helper that contains call_method nodes (e.g. x.view(...), x.to(...) traced as methods) or get_attr nodes that dynamo did not lift into constants/placeholders.","commonSituations":"Dynamo/torch version behavior changes that leave call_method nodes unlowered; custom models whose method calls survive tracing; internal vLLM compile-pipeline bugs — end users usually see this via the compile cache path on unsupported model code.","solutions":["Update vLLM (and torch) to a matching pair where the compiler pipeline lowers call_method/get_attr before codegen","Refactor the offending model code from method calls to torch functional APIs (torch.reshape(x, ...) instead of x.view(...)) if the node name in the message points at your model","Disable piecewise compilation for that model (VLLM_DISABLE_COMPILE_CACHE=1 / -O0) to bypass codegen while investigating"],"exampleFix":"# before (model code that traces to call_method)\nx = x.view(B, S, H)\n# after\nx = torch.reshape(x, (B, S, H))","handlingStrategy":"validation","validationCode":"allowed = {\"placeholder\", \"call_function\", \"output\", \"call_module\"}\nbad = [n for n in graph.nodes if n.op not in allowed]\nassert not bad, f\"unsupported ops: {[(n.op, n.target) for n in bad]}\"","typeGuard":"def codegen_supported(graph: torch.fx.Graph, with_submod: bool = True) -> bool:\n    allowed = {\"placeholder\", \"call_function\", \"output\"} | ({\"call_module\"} if with_submod else set())\n    return all(n.op in allowed for n in graph.nodes)","tryCatchPattern":null,"preventionTips":["Prefer torch functional APIs over tensor methods in models slated for compile","Pin matched vLLM+torch versions; report unlowered call_method graphs upstream"],"tags":["compilation","torch-compile","fx-graph","codegen","internal"],"backgroundTag":null,"analyzedSha":"c794754062d49a8fdb63ab3c5215b488b865030c","analyzedAt":"2026-08-14T21:17:39.825Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}