jax.experimental.pallas.fuser.fusible

Contents

jax.experimental.pallas.fuser.fusible#

jax.experimental.pallas.fuser.fusible(f=None, *, output_fusion_prefix=True)[source]#

Decorator that marks a kernel wrapper function as a fusible for fuse.

The decorated function f is invoked as f(*in_fusions, output_fusions, **kwargs), where each positional argument in in_fusions preserves the PyTree structure of the corresponding input in *args with array leaves wrapped in Fusion objects, and output_fusions is a PyTree matching the structure of output_fusion_prefix whose leaves are Fusion objects or None when no output fusion is present. Keyword arguments are bound to f as static values. When called outside fuse, each input array leaf is wrapped in a trivial Fusion that returns it and all output_fusions leaves are None.

Parameters:
  • f – The fusible kernel function to decorate. If None, returns a decorator.

  • output_fusion_prefix (Any) – A PyTree prefix mask whose PyTree structure specifies how the outputs of f are grouped into separate output fusions (with the default True, all outputs are grouped into a single Fusion | None). Multiple output fusion groups are not supported when the output fusion writes to Refs.

Returns:

A wrapped function that binds a Fusible primitive when called, or a decorator if f is None.