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

Can provide a End-to-end example (like a Transformer block) to show the sharding propagation + spmdization ? #298

Open
shoveller86 opened this issue Jan 10, 2025 · 2 comments

Comments

@shoveller86
Copy link

No description provided.

@shoveller86 shoveller86 changed the title Can provide a End-to-end example (like a Transformer block) to show the sharding propagation + spmdization Can provide a End-to-end example (like a Transformer block) to show the sharding propagation + spmdization ? Jan 10, 2025
@samkellett
Copy link

I'm interested in how to go from a shardy-fied graph after propagation into some sort of SPMD form too (loop over modified ops or outlined to a function or similar).

@bartchr808
Copy link
Collaborator

Hey! So we are integrated in JAX, and what you could do is write a little MLP or transformer block in JAX, and since we are integrated in XLA, you can use the xla_dump_to command to dump the module. There will be a shardy/ directory and inside you should see:

sdy_module_before_xla_import.mlir // feel free to ignore, this has to do with how Shardy is integrated in XLA
sdy_module_before_sdy_import.mlir // initial MLIR module that Shardy will see 
sdy_module_after_sdy_import.mlir // MLIR module after some preprocessing to make propagation work correctly. E.g. constant splitting, adding data flow edges, etc
sdy_module_after_user_priority_0.mlir // If you use user priorities on the sharding (which isn't in JAX at the moment), one will print for each of your priorities
sdy_module_after_propagation.mlir // the module after propagation finishes.
sdy_module_after_sdy_export.mlir // cleaned up the module from what was done in sdy_import

Longer term we want to possibly have a little markdown tutorial walking through each of these steps starting from a basic MLIR module, but let me know if this is enough and if you have any questions!

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

No branches or pull requests

3 participants