jax.experimental.pallas.fuser.push_block_spec

jax.experimental.pallas.fuser.push_block_spec#

jax.experimental.pallas.fuser.push_block_spec(f, *in_spec_args, scalar_prefetch_handler=None, grid_len=None, strict_mode=True, return_out_type=False, **in_spec_kwargs)[source]#

Pushes input BlockSpecs forward through f to get output BlockSpecs.

Parameters:
  • f (Callable) – The function to propagate block specs forward through.

  • *in_spec_args – Positional input BlockSpecs (or PyTrees of BlockSpecs) matching the positional arguments of f.

  • scalar_prefetch_handler (Any | None) – Optional getter created by make_scalar_prefetch_handler that selects this fusion’s scalar prefetch values from the kernel’s scalar prefetch inputs.

  • grid_len (int | None) – Optional number of grid dimensions in the enclosing kernel. Required if any block index depends on scalar prefetch values. When set, the input BlockSpec index maps are expected to take grid_len grid indices followed by the scalar prefetch refs, and the returned output BlockSpec index maps follow the same convention.

  • strict_mode (bool) – If True, converging paths to the same operation must have identical block index maps. If False, only block shapes, memory spaces, and pipeline modes must match.

  • return_out_type (bool) – If True, also return a PyTree of ShapeDtypeStructs describing the output types of f.

  • **in_spec_kwargs – Keyword input BlockSpecs (or PyTrees of BlockSpecs) matching the keyword arguments of f.

Returns:

A function taking example (*args, **kwargs) (or their abstract types) and returning the output BlockSpec PyTree, or a tuple (out_block_specs, out_type) when return_out_type=True.