Skip to content

[LoweringContext] Support an optimized parameter mapping for SPMD#8453

Closed
rpsilva-aws wants to merge 5 commits intopytorch:masterfrom
rpsilva-aws:rpsilva_lc_mapping
Closed

[LoweringContext] Support an optimized parameter mapping for SPMD#8453
rpsilva-aws wants to merge 5 commits intopytorch:masterfrom
rpsilva-aws:rpsilva_lc_mapping

Conversation

@rpsilva-aws
Copy link
Copy Markdown
Collaborator

Currently, the existing parameter mapping for the lowering context is not well suited for SPMD. In case of large models, it will cause a large synchronous bottleneck when transferring all device data to the host. This is caused by each ReplicateShardedData computation that gathers and reassembles each sharded data across multiple devices. This is by design, since it is expected to collect all parameters regardless of their allocation.

In this PR, we introduce a new mapping that does not invoke the sharded replication, but instead uses references to the device data. This is generally sufficient and preferred in most cases, where the user only wants to access the validate parameters (those that are not returned as -1 from tensor_parameter_id, as 'fake' parameters).

@rpsilva-aws rpsilva-aws marked this pull request as ready for review December 4, 2024 21:42
@rpsilva-aws
Copy link
Copy Markdown
Collaborator Author

Note: Conflicts with #8418. Will handle rebase order based on merge timing.

@rpsilva-aws
Copy link
Copy Markdown
Collaborator Author

@JackCaoG @tengyifei

@miladm miladm requested review from bhavya01 and tengyifei December 5, 2024 00:04
Copy link
Copy Markdown
Collaborator

@tengyifei tengyifei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread test/test_operations.py
Comment thread test/test_operations.py
Comment thread test/run_tests.sh
Comment thread torch_xla/csrc/init_python_bindings.cpp
Comment thread torch_xla/csrc/init_python_bindings.cpp Outdated
Comment thread torch_xla/csrc/init_python_bindings.cpp Outdated
Comment thread test/test_operations.py
@tengyifei tengyifei added the tpuci label Dec 5, 2024
@tengyifei tengyifei self-requested a review December 5, 2024 23:14
@rpsilva-aws
Copy link
Copy Markdown
Collaborator Author

Replacing with #8460 to fix the merge commit, wrong local branch.

@rpsilva-aws rpsilva-aws closed this Dec 5, 2024
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.

2 participants