Skip to content

vllm.compilation.piecewise_backend

Classes:

Functions:

PiecewiseBackend

Methods:

  • __init__ –

    The backend for piecewise compilation.

  • compile_all_ranges –

    Compile all range entries for this piecewise subgraph up front.

  • load_all_ranges –

    Load all pre-compiled runnables for this piecewise subgraph.

__init__(graph, vllm_config, piecewise_compile_index, total_piecewise_compiles, sym_shape_indices, vllm_backend, returns_tuple, compiled_runnables=None, submod_name='')

The backend for piecewise compilation. It mainly handles the compilation of static shapes and dispatching based on runtime shape.

We will compile self.graph once for the general shape, and then compile for different shapes specified in compilation_config.compile_sizes.

This class supports two mutually exclusive modes: 1. Compilation (graph is set, compiled_runnables is None): Used during initial compilation when we have the FX graph and need to compile it for each shape range. 2. Precompilation (graph is None, compiled_runnables is set): Used when loading from cache/AOT artifacts where we already have pre-compiled callables and don't need the original graph.

Exactly one of graph or compiled_runnables must be provided.

_log_compile_start(compile_range)

Log compilation event for TORCH_TRACE/tlparse.

compile_all_ranges()

Compile all range entries for this piecewise subgraph up front.

load_all_ranges()

Load all pre-compiled runnables for this piecewise subgraph.

Called during warm start to wrap all cached compiled_runnables into range_entry.runnable up front, analogous to compile_all_ranges() for the cold start path.

create_concrete_args(graph, size)

Create Fake example inputs with symbolic dims replaced by a concrete size.

Used for single-size compilation where we need concrete-shaped inputs. The Dynamo-captured graph gives us example inputs with SymInts in them.

get_fake_args_from_graph(graph)

Get fake args directly from graph placeholder nodes.