thunder.recipes.BaseRecipe

class thunder.recipes.BaseRecipe(show_progress=False, fuser='nvfuser', interpreter='thunder.jit', plugins=None)[source]

Bases: Recipe

Compilation recipe with Thunder defaults. The recipe wires a set of executors, transforms and debug options, while providing a single switch to pick the fusion backend (“nvfuser” or “torch.compile”). Should be used as a template to extend.

Parameters:
  • show_progress – bool, default False Print interpreter-side progress bars.

  • fuser – {“nvfuser”, “torch.compile”}, default “nvfuser” Fusion backend to register. Adjusts self.executor_names so the chosen backend is present and any mutually-exclusive one is removed.

  • interpreter – str, default “thunder.jit” Interpreter identifier forwarded to Recipe.

  • plugins – Iterable | None Extra Thunder plugins to enable.

__init__(show_progress=False, fuser='nvfuser', interpreter='thunder.jit', plugins=None)[source]

Methods

__init__([show_progress, fuser, ...])

add_plugins(plugins)

apply(model)

get_for_model(model)

register(key)

setup_config()

Build the per-run configuration dictionary.

setup_executors()

Resolves executor names to concrete Executor objects.

setup_fuser()

Reconciles the requested fusion backend with self.executor_names.

setup_lookasides()

rtype:

Optional[list[Lookaside]]

setup_transforms()

Constructs the list of graph-level transforms.

validate(model)

setup_config()[source]

Build the per-run configuration dictionary.

Returns:

{} when show_progress is False; otherwise {"debug_options": DebugOptions(show_interpreter_progress=True)}.

Return type:

dict[str, Any]

setup_executors()[source]

Resolves executor names to concrete Executor objects.

Returns:

Instantiated executors in the order given by self.executor_names.

Return type:

list[Executor]

Raises:
  • TypeError – If self.executor_names is not a list.

  • ValueError – If a non-nvfuser executor cannot be found.

setup_fuser()[source]

Reconciles the requested fusion backend with self.executor_names.

Raises:

NotImplementedError – If fuser is not "nvfuser" or "torch.compile".

Return type:

None

setup_transforms()[source]

Constructs the list of graph-level transforms.

Returns:

Currently [PrunePrologueChecks()]; extend as needed.

Return type:

list[Transform]