[CRL] Support pool-only registration and optimize regpool containers#482
Open
MC952-arch wants to merge 4 commits into
Open
[CRL] Support pool-only registration and optimize regpool containers#482MC952-arch wants to merge 4 commits into
MC952-arch wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to (1) allow flagcxCommRegister/flagcxCommDeregister to be called with a null comm (pool-only registration), and (2) optimize the registration pool’s internal containers by switching to std::unordered_map and std::vector, introducing a GLOBAL_POOL_KEY for null-comm registrations.
Changes:
- Allow null
comminflagcxCommRegister/flagcxCommDeregisterand skip backend registration steps whencomm == nullptr. - Refactor
flagcxRegPoolto use a global pool key and unordered containers; switch handle storage fromstd::listtostd::vectorand optimize erase loops. - Update reg-pool public types/signatures to reflect new container choices.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
flagcx/flagcx.cc |
Permits null-comm registration/deregistration and adjusts regKey selection + backend-step skipping. |
flagcx/core/reg_pool.cc |
Refactors reg-pool internals (global pool behavior, unordered containers, vector handle storage, updated cleanup logic). |
flagcx/core/include/register.h |
Switches flagcxRegItem::handles from std::list to std::vector. |
flagcx/core/include/reg_pool.h |
Introduces GLOBAL_POOL_KEY and changes reg-pool container types to unordered maps. |
Comments suppressed due to low confidence (1)
flagcx/flagcx.cc:1031
flagcxCommRegister()treatsregItem->refCount > 1as a re-registration and skips backend-specific steps (CCL registration / IPC handle creation / one-sided MR). After this PR,refCountis incremented in a global pool shared across comms, so a second different comm registering the same buffer can hit this fast path and return success without initializing comm-specific backend state. This can lead to missinghomoRegHandle/ipcHandleDatafor that comm and subsequent failures. You likely need refCounts (and the re-registration shortcut) to remain per-comm registration context, not global across comms, or store backend state per-comm instead of on the sharedflagcxRegItem.
// Re-registration: backend handle + IPC handle already set up
if (regItem->refCount > 1) {
return flagcxSuccess;
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
test/script/_gpu_check.sh:19
- The added
|| truemakes the script continue whennvidia-smifails, but the subsequent arithmetic expansions ($((${memory_usage_array[$i]})), etc.) will hit$(())with an empty value and can error out (or compute incorrect values) when the arrays are empty. Consider explicitly detectingnvidia-smifailure/empty output (andgpu_count==0) andsleep/continuerather than proceeding with empty arrays.
IFS=$'\n' read -d '' -r -a memory_usage_array <<< "$(nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits)" || true
IFS=$'\n' read -d '' -r -a memory_total_array <<< "$(nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits)" || true
need_wait=false
for ((i=0; i<$gpu_count; i++)); do
memory_usage_i=$((${memory_usage_array[$i]}))
memory_total_i=$((${memory_total_array[$i]}))
memory_remin_i=$(($memory_total_i-$memory_usage_i))
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.
PR Category
CRL
PR Types
Optimizations
PR Description
This PR aims to (1) allow flagcxCommRegister/flagcxCommDeregister to be called with a null comm (pool-only registration), and (2) optimize the registration pool’s internal containers by switching to std::unordered_map and std::vector, introducing a GLOBAL_POOL_KEY for null-comm registrations.