Skip to content

Conversation

sharadmv
Copy link
Collaborator

@sharadmv sharadmv commented Mar 30, 2023

Enables autotuning in Pallas

Example:

@functools.partial(
  pl.pallas_call, out_shape=jax.ShapeDtypeStruct((8,), jnp.float32),
  autotuning_configs=[
    pl.KernelConfig(meta=dict(block_size=block_size),
                    in_specs=[
                      pl.BlockSpec(lambda i: i, (block_size,))
                    ],
                    out_specs=[
                      pl.BlockSpec(lambda i: i, (block_size,))
                    ],
                    grid=8 // block_size)
  for block_size in [1, 2, 4, 8]
])
def add_one(x_ref, o_ref, *, block_size):
  del block_size
  o_ref[...] = x_ref[...] + 1.

@sharadmv sharadmv marked this pull request as ready for review March 30, 2023 21:22
@sharadmv sharadmv requested a review from sbodenstein March 30, 2023 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant