Memory planning asserts `graph_output_allocated not set` when a graph output carries no tensors
@larryliu0820 is already working on this.
Since Sep 10, 2026.
- Dominant language
- Python
- Stars
- 5k
- Forks
- 1.2k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 581
Description
🐛 Describe the bug
Verifier.verify_graph_input_output in exir/memory_planning.py walks the placeholder and output nodes and records whether the planner allocated each one. A node with no tensor specs is skipped, and the skip happens before graph_output_allocated is assigned:
for nd in graph_module.graph.nodes:
if nd.op in check_list:
if not (specs := get_node_tensor_specs(nd)):
continue
So a graph whose output node carries only non-tensor values never sets the flag, and lowering fails on:
AssertionError: graph_output_allocated not set
even though the graph is fully planned. There is nothing to allocate for that node. The neighbouring len(specs) == 0 branch already treats "nothing to allocate" as success for the all-const case.
This is reachable from a normal export. Lowering a llama-family model to Vulkan with dynamic shapes produces a partition whose only outputs are symints (sym_size / et_vk.select_as_symint), and every such export aborts here.
Versions
Reproduces on main (a6b115bff6).
Repro:
from executorch.examples.models.llama.export_llama_lib import export_llama
from executorch.extension.llm.export.config.llm_config import LlmConfig
cfg = LlmConfig()
# ... qwen3 0.6B checkpoint/params ...
cfg.model.use_kv_cache = True
cfg.model.use_sdpa_with_kv_cache = True
cfg.model.enable_dynamic_shape = True
cfg.backend.vulkan.enabled = True
export_llama(cfg)
A standalone unit repro, no backend needed:
from torch.fx import Graph, GraphModule
from executorch.exir.memory_planning import Verifier
graph = Graph()
sym = graph.placeholder("sym")
graph.output((sym,))
Verifier(
GraphModule({}, graph),
alloc_graph_input=True,
alloc_graph_output=True,
alloc_mutable_buffers=True,
).verify_graph_input_output()
cc @JacobSzwejbka @angelayi
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.