Cherry-pick #4174 and #4186 from 2.7 to main#4193
Open
pcnudde wants to merge 3 commits intoNVIDIA:mainfrom
Open
Cherry-pick #4174 and #4186 from 2.7 to main#4193pcnudde wants to merge 3 commits intoNVIDIA:mainfrom
pcnudde wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
### Description Do not hold the lock around produce_item. It is not needed and this operation can be slow. We do not want/need to hold up everying during this time. ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Quick tests passed locally by running `./runtest.sh`. - [ ] In-line docstrings updated. - [ ] Documentation updated.
…VIDIA#4186) ## Summary - avoid synchronous self-message path when trainer submits learn result to itself (aggr == self.me) - process local submission via _process_learn_result with local peer context, while keeping remote path unchanged - add unit coverage to verify local self-aggregation submission does not call broadcast_and_wait ## Problem PR NVIDIA#4141 fixed self-message deadlock in _scatter, but result submission in do_learn_task still used broadcast_and_wait(targets=[aggr]). When aggr == self.me with tensor streaming enabled, this can deadlock in synchronous self-message processing. ## Test Plan - added focused unit test in tests/unit_test/app_common/ccwf/test_swarm_self_message_deadlock.py - validated syntax locally for modified files - full pytest not run in this environment (pytest not available)
Collaborator
Author
|
/build |
Contributor
Greptile OverviewGreptile SummaryThis PR cherry-picks two critical concurrency fixes from the 2.7 branch: reducing lock scope in Key Changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Trainer as SwarmClientController (Trainer)
participant Engine as FL Engine
participant Aggregator as SwarmClientController (Aggregator)
Note over Trainer: Scenario: Self-submission (aggr == self.me)
Trainer->>Engine: Request submission permission
Engine-->>Trainer: Permission granted
alt Before Fix: Using broadcast_and_wait
Trainer->>Trainer: broadcast_and_wait([self])
Note over Trainer: DEADLOCK: Synchronous self-message<br/>blocks waiting for own response
end
alt After Fix: Local submission
Trainer->>Trainer: Detect aggr == self.me
Trainer->>Trainer: Clone FL context
Trainer->>Trainer: Set peer context
Trainer->>Trainer: _process_learn_result(result, local_fl_ctx)
Note over Trainer: Direct method call,<br/>no message passing
Trainer-->>Trainer: Reply (OK)
end
Note over Trainer,Aggregator: Scenario: Remote submission (aggr != self.me)
Trainer->>Engine: Request submission permission
Engine-->>Trainer: Permission granted
Trainer->>Aggregator: broadcast_and_wait([aggr])
Aggregator->>Aggregator: _process_learn_result()
Aggregator-->>Trainer: Reply (OK)
Last reviewed commit: 15d616e |
Collaborator
Author
|
/build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cacheable._get_item—produce_itemnow runs outside the lock so concurrent receivers aren't blockedbroadcast_and_wait, adds unit test coverage