jax.experimental.pallas.fuser.pull_block_spec

jax.experimental.pallas.fuser.pull_block_spec#

jax.experimental.pallas.fuser.pull_block_spec(f, out_block_specs, *, scalar_prefetch_handler=None, grid_len=None, strict_mode=True)[source]#

Pulls output BlockSpecs backward through f to derive input BlockSpecs.

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

  • out_block_specs (pallas_core.BlockSpec | tuple[pallas_core.BlockSpec, ...]) – A BlockSpec or PyTree of BlockSpecs matching the output structure 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).

  • strict_mode (bool) – If True, converging paths to the same value must have equivalent block index transforms; if False, only block shapes must match.

Returns:

A function taking example (*args, **kwargs) (or their abstract types) and returning (kernel_fn, in_block_arg_specs, in_block_kwarg_specs) for evaluating f on a single block inside a Pallas kernel.