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] Simplify GridMapping #22552

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

gnecula
Copy link
Collaborator

@gnecula gnecula commented Jul 21, 2024

No description provided.

@gnecula gnecula self-assigned this Jul 21, 2024
@gnecula gnecula added the pull ready Ready for copybara import and testing label Jul 21, 2024
@gnecula gnecula force-pushed the pallas_grid branch 12 times, most recently from 15e9e6a to d7f28bc Compare July 22, 2024 19:45
`BlockSpec`, `GridSpec` and `PrefetchScalarGridSpec` are now simple
dataclasses that just store the parameters passed
from the API. They are then canonicalized and coverted
to `BlocMapping` and `GridMapping`, which contains fewer
optional metadata. In particular, `BlockMapping` is never
`None`. This simplifies the rest of the code.

`grid` now defaults to `()`.

We add the `array_shape_dtype`, `source`, `index_map_avals`,
`index_map_tree`, `num_inputs`, `num_outputs` to `BlockMapping`, it helps downstream.
Now we do not need the `in_shapes` and `out_shapes` parameters to
`pallas_call_p`, since it already has `grid_mapping`.OI

Moved some of the logic for handling scalar prefetch and
scratch shapes from `PrefetchScalarGridSpec.get_grid_mapping` to
`GridSpec.get_grid_mapping`, and thus removed code duplication.

Removed some dead code for implementing the interpret mode.

Added test for the calling convention, including dynamic grid dimensions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull ready Ready for copybara import and testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant