Refactor communication nodes and post methods into separate files#5970
Refactor communication nodes and post methods into separate files#5970
Conversation
|
!test |
|
Review updated until commit eac2df6 Description
|
| Relevant files | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Enhancement | 11 files
| ||||||||||||||||||||||
| Tests | 4 files
| ||||||||||||||||||||||
| Configuration changes | 1 files
|
PR Reviewer Guide
Here are some key observations to aid the review process:
| 🧪 PR contains tests |
| ⚡ Recommended focus areas for review |
Method Declaration Mismatch
|
Greptile SummaryThis PR extracts the Additionally, the free function
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Before["Before: communication.h / communication.cpp"]
CH_OLD["communication.h\n- Communication class\n- P2PCommunication class\n- MoeDispatch / MoeCombine\n- postSingleCommunication decls"]
CC_OLD["communication.cpp\n- Communication impl\n- P2PCommunication impl\n- MoeDispatch / MoeCombine impl\n- getRelativeIndex (free fn)\n- getRootRelativeIndex (member)\n- postBroadcast, postGather, ...\n- postSingleCommunication impls"]
end
subgraph After["After: Split into two file pairs"]
CH_NEW["communication.h\n- Communication class\n (with getRelativeIndex member)\n- P2PCommunication class\n- MoeDispatch / MoeCombine"]
CC_NEW["communication.cpp\n- Communication impl\n- P2PCommunication impl\n- MoeDispatch / MoeCombine impl\n- getRelativeIndex (member)"]
PH_NEW["post_communication.h\n- #include communication.h\n- postSingleCommunication decls"]
PC_NEW["post_communication.cpp\n- postBroadcast, postGather, ...\n- postSingleCommunication impls\n- Helper utilities"]
end
PH_NEW -->|includes| CH_NEW
PC_NEW -->|includes| PH_NEW
Last reviewed commit: 12c70d4 |
wujingyue
left a comment
There was a problem hiding this comment.
I like separating them to different files but I'd do it slightly differently: communication_nodes.h => communication.h because of class Communication (https://google.github.io/styleguide/cppguide.html#File_Names); communication.h => post_communication.h
|
!test |
|
!test |
|
!test |
csrc/multidevice/communication.cpp
Outdated
| int64_t Communication::getRootRelativeIndex(DeviceIdxType root_val) { | ||
| return getRelativeIndex(team(), root_val); | ||
| int64_t Communication::getRelativeIndex(DeviceIdxType rank) { | ||
| const Team& team = team(); |
There was a problem hiding this comment.
I slightly prefer getRelativeIndex(team, rank) than Communication::getRelativeIndex even though it's a bit more typing. Communication::getRelativeIndex doesn't use any private methods/fields of Communication, so making it a method of Communication is an overkill.
That said, I understood this PR didn't make anything worse. So LGTM as is.
There was a problem hiding this comment.
Sure, will address it separately.
No description provided.