-
Notifications
You must be signed in to change notification settings - Fork 444
Add Packing Support for Context Parallelism (Ring Attention) #2906
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
richjames0
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple of nits but lgtm
| # Handle packing configurations | ||
| if self.config.packing and self.config.dataset_type != "synthetic": | ||
| if using_context_parallelism and not using_load_balanced_ring_cp: | ||
| raise AssertionError("Packing is only supported for load balanced ring attention with context parallelism.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: AssertionError feels weird here to me. Maybe an argumenterror?
|
|
||
|
|
||
| def get_reorder_callable(cp_size, shard_mode): | ||
| def get_reorder_callable(cp_size, shard_mode, reorder_strategy=0): # 0=DualChunkSwap, 1=Striped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I read this late at night I imagine you're using an integer here so it's comprehensible by JAX but could this be made into an enum without breaking things (at worse using .value?
Description
Enables sequence packing for context parallelism with
ringstrategy using TransformerEngine's DotProductAttention. Includes comprehensive GPU tests for ring attention with packing for sm90+.reorder_causal_load_balancingapiTests
Added a GPU integration test that works for sm90+.
Checklist
Before submitting this PR, please make sure (put X in square brackets):
gemini-reviewlabel.