Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pallas autotuning #108

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Pallas autotuning #108

wants to merge 6 commits into from

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
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