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

Enable dynamic shapes for pipeline parallel engine inputs #5481

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

tohtana
Copy link
Contributor

@tohtana tohtana commented Apr 30, 2024

This PR enables dynamic shapes for inputs to pipeline parallel (PP) engine.

Currently PP engine checks tensor shapes and allocates communication buffer at the first forward/backward passes. This causes a tensor shape mismatch error when input tensor shapes changed.

This PR adds an option to check tensor shapes at every iteration and allocate buffer based on the shapes. As shown below, you can enable this feature by passing dynamic_shape=True to PipelineModule.
Note that this might have a performance impact and the option is set to False as default.

model = PipelineModule(
...
   dynamic_shape=True
)

This will increase the overhead of buffer allocation and communication for tensor metadata. To mitigate the overhead, this PR also includes these improvements:

  • Consolidate multiple communication calls to send/recv tensor shapes 9f96ad4
  • Reuse (extend) communication buffer instead of creating a new one b3c0750

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.

None yet

1 participant