Skip to content

[Bug]: torch.compile fails for Gemma3n on pytorch 2.8 #24547

@sarckk

Description

@sarckk

Your current environment

The output of python collect_env.py
Your output of `python collect_env.py` here

🐛 Describe the bug

run

vllm serve google/gemma-3n-E2B-it -tp 1

on torch==2.8.0:

(EngineCore_DP0 pid=2805721)   File "/data/users/yhshin/gitrepos/vllm/vllm/compilation/backends.py", line 330, in call_module
(EngineCore_DP0 pid=2805721)     compiler_manager.compile(
(EngineCore_DP0 pid=2805721)                      ^^^^^^^^
(EngineCore_DP0 pid=2805721)   File "/data/users/yhshin/gitrepos/vllm/vllm/compilation/backends.py", line 179, in compile
(EngineCore_DP0 pid=2805721)     compiled_graph, handle = self.compiler.compile(
(EngineCore_DP0 pid=2805721)                              ^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP0 pid=2805721)   File "/data/users/yhshin/gitrepos/vllm/vllm/compilation/compiler_interface.py", line 217, in compile
(EngineCore_DP0 pid=2805721)     compiled_graph.save(path=path, format="unpacked")
(EngineCore_DP0 pid=2805721)   File "/home/yhshin/uv_env/vllm/lib/python3.12/site-packages/torch/_inductor/standalone_compile.py", line 73, in save
(EngineCore_DP0 pid=2805721)     assert len(cache_info.aot_autograd_artifacts) == 1, cache_info
(EngineCore_DP0 pid=2805721)            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(EngineCore_DP0 pid=2805721) torch._dynamo.exc.BackendCompilerFailed: backend='<vllm.compilation.backends.VllmBackend object at 0x7f5ad84e7d10>' raised:
(EngineCore_DP0 pid=2805721) AssertionError: CacheInfo(artifacts=defaultdict(<class 'list'>, {'inductor': ['frtb6xof4xglqbvww362mucq4jpbcm7hdkky7duecxlfqy7turzg'], 'autotune':...

fails in standalone_compile added in pytorch/pytorch#150670 due to no artifacts returned after compiling the second submodule (submod_2) of Gemma3n.

@zou3519 mentioned this happens when any output of a subgraph returns a view of the input

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions