Repository navigation
feat(rccl/gin): enable rocSHMEM GDA alongside other GIN backends #14219
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
Merged
alex-breslow-amd
merged 15 commits into
develop
from
users/dondai/aicomrccl-3418-gda-alongside
Nov 10, 2026
Merged
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c6dbbfe
feat(rccl/gin): enable rocSHMEM GDA alongside other GIN backends
dlamd1dai 79a372a
test(rccl/gin): cover rocSHMEM GDA alongside Anvil SDMA and the proxy
dlamd1dai 46c7fda
fix(rccl/gin): address ARGUS review on NCCL_GIN_TYPES CI coverage
dlamd1dai d8ef52f
style(rccl/gin): shorten NCCL_GIN_TYPES comments per ARGUS review
dlamd1dai 85a839c
Merge remote-tracking branch 'upstream/develop' into users/dondai/aic…
dlamd1dai 137f0eb
Merge remote-tracking branch 'upstream/develop' into users/dondai/aic…
dlamd1dai d9798cc
Merge remote-tracking branch 'upstream/develop' into users/dondai/aic…
dlamd1dai ba55da2
refactor(rccl/gin): rename NCCL_GIN_TYPES to RCCL_GIN_TYPE_LIST
dlamd1dai 8f4bf8b
feat(rccl/gin): request the SDMA backend explicitly in built-in SDMA …
dlamd1dai 054b3cd
Revert "feat(rccl/gin): request the SDMA backend explicitly in built-…
dlamd1dai f7ab571
Reapply "feat(rccl/gin): request the SDMA backend explicitly in built…
dlamd1dai 22bb53b
Merge branch 'develop' into users/dondai/aicomrccl-3418-gda-alongside
dlamd1dai 77782ff
Merge remote-tracking branch 'upstream/develop' into users/dondai/aic…
dlamd1dai 9d23431
[rccl] GIN: treat empty NCCL_GIN_TYPE as unset, bound RCCL_GIN_TYPE_L…
dlamd1dai 3b39e40
Merge remote-tracking branch 'upstream/develop' into users/dondai/aic…
dlamd1dai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /************************************************************************* | ||
| * Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * See LICENSE.txt for license information | ||
| ************************************************************************/ | ||
|
|
||
| #ifndef RCCL_GIN_TYPE_ENV_H_ | ||
| #define RCCL_GIN_TYPE_ENV_H_ | ||
|
|
||
| #include <cerrno> | ||
| #include <cstdint> | ||
| #include <cstdlib> | ||
|
|
||
| // NCCL_GIN_TYPE forces one backend; if unset, NCCL_GIN_TYPES lists the types allowed together. | ||
| // Uncached getenv() so tests can setenv() between cases. | ||
|
|
||
| // Parses list into a bitmask of GIN types (bit t set for type t). Returns false if | ||
| // any entry is not an integer in [1, 63]; valid entries are still recorded in *mask. | ||
| static inline bool ncclGinParseTypeList(const char* list, uint64_t* mask) { | ||
| bool valid = true; | ||
| *mask = 0; | ||
| const char* p = list; | ||
| while (*p) { | ||
| while (*p == ' ' || *p == '\t') p++; | ||
| char* end = nullptr; | ||
| errno = 0; | ||
| long type = strtol(p, &end, 10); | ||
| while (*end == ' ' || *end == '\t') end++; | ||
| if (end == p || errno != 0 || type < 1 || type > 63 || (*end != ',' && *end != '\0')) { | ||
| valid = false; | ||
| while (*end != ',' && *end != '\0') end++; | ||
| } else { | ||
| *mask |= (uint64_t)1 << type; | ||
| } | ||
| p = (*end == ',') ? end + 1 : end; | ||
| } | ||
| return valid; | ||
| } | ||
|
|
||
| // Returns true and fills *mask when NCCL_GIN_TYPE is unset and NCCL_GIN_TYPES names | ||
| // at least one valid type. Otherwise the list does not apply. | ||
| static inline bool ncclGinTypeListMask(uint64_t* mask) { | ||
| if (getenv("NCCL_GIN_TYPE")) return false; | ||
| const char* list = getenv("NCCL_GIN_TYPES"); | ||
|
Kapil-Shyam-Pawar marked this conversation as resolved.
Resolved
|
||
| if (!list) return false; | ||
| ncclGinParseTypeList(list, mask); | ||
| return *mask != 0; | ||
| } | ||
|
|
||
| // Whether the backend of the given type may initialize. enabledByDefault is its | ||
| // behavior when neither NCCL_GIN_TYPE nor a usable NCCL_GIN_TYPES is set. | ||
| static inline bool ncclGinTypeEnabled(int type, bool enabledByDefault) { | ||
| const char* single = getenv("NCCL_GIN_TYPE"); | ||
| if (single) return atoi(single) == type; | ||
| uint64_t mask; | ||
| if (ncclGinTypeListMask(&mask)) return (mask >> type) & 1; | ||
| return enabledByDefault; | ||
| } | ||
|
|
||
| #endif // RCCL_GIN_TYPE_ENV_H_ | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,13 +14,15 @@ | |
| #include "nccl_gin.h" | ||
| #include "graph/topo.h" | ||
| #include "gin/gin_host_proxy.h" | ||
| #include "gin/gin_type_env.h" | ||
| #ifdef ENABLE_ROCSHMEM_GIN | ||
| #include "gin/gin_host_rocshmem_gda.h" | ||
| #include "gin/gin_host_anvil_sdma.h" | ||
| #endif | ||
|
|
||
| #include <string.h> | ||
| #include <errno.h> | ||
| #include <stdlib.h> | ||
| #include <mutex> | ||
|
|
||
| typedef ncclGin_t* getNcclGin_t(void* ginPluginLib); | ||
|
|
@@ -175,6 +177,13 @@ static ncclResult_t ncclGinPluginAssignToComm(struct ncclComm* comm, int pluginI | |
| return ncclSuccess; | ||
| } | ||
|
|
||
| uint64_t ginTypeMask; | ||
| if (ginType == -1 && ncclGinTypeListMask(&ginTypeMask) && !(ginTypeMask & BIT(props.netDeviceType))) { | ||
| INFO(NCCL_INIT | NCCL_NET, "GIN/Plugin: Skipping plugin %s index %d type %d: not in NCCL_GIN_TYPES=%s", gin->name, | ||
| pluginIndex, props.netDeviceType, getenv("NCCL_GIN_TYPES")); | ||
| return ncclSuccess; | ||
| } | ||
|
|
||
| for (int idx = 0; idx < pluginIndex; idx++) { | ||
| if (pluginLibs[idx].state >= ncclGinPluginStateInitReady) { | ||
| ncclNetProperties_t prev_props; | ||
|
|
@@ -240,6 +249,24 @@ static void initPluginLibsOnceFunc() { | |
| int pluginCounter = 0; | ||
|
|
||
| memset(pluginLibs, 0, NCCL_GIN_MAX_PLUGINS * sizeof(ginPluginLib_t)); | ||
|
|
||
| // Same getenv() source as ncclGinTypeListMask / ncclGinTypeEnabled, so an | ||
| // NCCL_ENV_PLUGIN value cannot be logged here and then ignored at init. | ||
| const char* envGinTypes = getenv("NCCL_GIN_TYPES"); | ||
| if (envGinTypes) { | ||
| uint64_t ginTypeMask; | ||
| bool valid = ncclGinParseTypeList(envGinTypes, &ginTypeMask); | ||
| if (getenv("NCCL_GIN_TYPE")) { | ||
| INFO(NCCL_ENV | NCCL_NET, "NCCL_GIN_TYPES=%s ignored: NCCL_GIN_TYPE is set", envGinTypes); | ||
| } else if (ginTypeMask == 0) { | ||
| WARN("NCCL_GIN_TYPES=%s names no valid GIN type, ignoring it", envGinTypes); | ||
| } else if (!valid) { | ||
| WARN("NCCL_GIN_TYPES=%s contains an invalid entry, ignoring that entry", envGinTypes); | ||
| } else { | ||
| INFO(NCCL_ENV | NCCL_NET, "NCCL_GIN_TYPES set by environment to %s", envGinTypes); | ||
| } | ||
| } | ||
|
|
||
| envGinPlugin = ncclGetEnv("NCCL_GIN_PLUGIN"); | ||
| if (envGinPlugin) { | ||
| INFO(NCCL_ENV | NCCL_NET, "NCCL_GIN_PLUGIN set by environment to %s", envGinPlugin); | ||
|
|
@@ -313,7 +340,7 @@ static void initPluginLibsOnceFunc() { | |
| pluginCounter++; | ||
|
|
||
| #ifdef ENABLE_ROCSHMEM_GIN | ||
| // Add internal rocshmem GDA plugin (device-initiated, NCCL_GIN_TYPE=6) | ||
| // Add internal rocshmem GDA plugin (device-initiated, NCCL_GIN_TYPE=6 or listed in NCCL_GIN_TYPES) | ||
| pluginLibs[pluginCounter].ncclGin = &ncclGinRocshmemGdaPlugin; | ||
| pluginLibs[pluginCounter].state = ncclGinPluginStateInitReady; | ||
| pluginLibs[pluginCounter].version = ncclGinVersion[0]; | ||
|
|
@@ -407,16 +434,17 @@ static int ncclGetBackendPriority(struct ncclGinBackendState* backend) { | |
| case NCCL_GIN_TYPE_GDAKI: | ||
| return 0; | ||
| #ifdef ENABLE_ROCSHMEM_GIN | ||
| // [RCCL] Device-initiated AMD backends rank with GDAKI, ahead of the host proxy. | ||
| case NCCL_GIN_TYPE_ROCSHMEM_GDA: | ||
| // [RCCL] Distinct priorities: qsort is unstable, so ties would make the default backend arbitrary. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that being said the high priority conflicts here are mutually exclusive at selection time. Is it a real issue that the ordering between GDA/SDMA is unstable? |
||
| case NCCL_GIN_TYPE_ANVIL_SDMA: | ||
| return 0; | ||
| case NCCL_GIN_TYPE_ROCSHMEM_GDA: | ||
| return 1; | ||
| #endif | ||
| case NCCL_GIN_TYPE_PROXY: | ||
| return 1; | ||
| return 2; | ||
| case NCCL_GIN_TYPE_EFA_GDA: | ||
| case NCCL_GIN_TYPE_GPI: | ||
| return 2; | ||
| return 3; | ||
| default: | ||
| return INT_MAX; | ||
| } | ||
|
|
||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new file would be a target for elimination if we can reuse the existing infra for parsing string-based lists (e.g. from GIN_PLUGINS). Defer to string-based list.