Repository navigation
[RCCL] Pick the gfx1250 tuning table by compute-partition mode (RCCL_TUNING_PARTITION_MODE) #13416
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0b7c156
feat(rccl): pick the gfx1250 tuning table by compute-partition mode (…
ankith117 8b9302e
Remove env var `RCCL_TUNING_PARTITION_MODE`
ankith117 921eb0e
Revert "Remove env var `RCCL_TUNING_PARTITION_MODE`"
ankith117 1d538a8
perf(rccl): tune the gfx1250 DPX table from DPX measurements
pvallem d57e7b2
Merge branch 'develop' into users/saverine/rccl_spx_dpx_flag
pvallem 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -129,6 +129,14 @@ struct rcclArchThresholds { | |
| bool forceCeScratch; | ||
| }; | ||
|
|
||
| const rcclArchThresholds* rcclGetArchThresholds(const char* gcn); | ||
| // Compute-partition mode a gfx1250 comm is tuned for (RCCL_TUNING_PARTITION_MODE). It picks | ||
| // the table only; other archs have one table for every mode. | ||
| enum rcclTuningPartition { | ||
|
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. enum struct would have been better, but ok. |
||
| RCCL_TUNING_PARTITION_SPX = 0, | ||
| RCCL_TUNING_PARTITION_DPX = 1, | ||
| }; | ||
|
|
||
| const rcclArchThresholds* rcclGetArchThresholds(const char* gcn, | ||
| rcclTuningPartition partition = RCCL_TUNING_PARTITION_SPX); | ||
|
|
||
| #endif // RCCL_ARCH_THRESHOLDS_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 |
|---|---|---|
|
|
@@ -1264,6 +1264,46 @@ static const char* mnnvlDegradedBwStr(unsigned int healthMask) { | |
| } | ||
| #endif | ||
|
|
||
| // RCCL_TUNING_PARTITION_MODE: the gfx1250 tuning table this rank asks for. "auto" (or unset) | ||
| // follows the compute-partition mode the GPU reports; "SPX" / "DPX" force one. It only picks | ||
| // tuning thresholds. Any mode other than DPX (CPX, or none reported) asks for SPX. An invalid | ||
| // value is reported once and treated as "auto". | ||
| static rcclTuningPartition rcclTuningPartitionRequest(const char* computePartition) { | ||
| const char* mode = ncclGetEnv("RCCL_TUNING_PARTITION_MODE"); | ||
| if (mode != nullptr && mode[0] != '\0' && strcasecmp(mode, "auto") != 0) { | ||
| if (strcasecmp(mode, "SPX") == 0) return RCCL_TUNING_PARTITION_SPX; | ||
| if (strcasecmp(mode, "DPX") == 0) return RCCL_TUNING_PARTITION_DPX; | ||
| static std::once_flag invalidModeOnce; | ||
| std::call_once(invalidModeOnce, [mode] { | ||
| ATTN("Invalid value %s for RCCL_TUNING_PARTITION_MODE (expected auto, SPX or DPX), using auto", mode); | ||
| }); | ||
| } | ||
| return computePartition != nullptr && strcasecmp(computePartition, "DPX") == 0 ? RCCL_TUNING_PARTITION_DPX | ||
| : RCCL_TUNING_PARTITION_SPX; | ||
| } | ||
|
|
||
| // Ranks pick algorithms on their own, so every rank of a comm must read the same table: DPX only | ||
| // when all of them ask for it, SPX otherwise. *mixed reports ranks that disagree. | ||
| static rcclTuningPartition rcclTuningPartitionForComm(const struct ncclPeerInfo* peers, int nRanks, bool* mixed) { | ||
| int nDpx = 0; | ||
| for (int i = 0; i < nRanks; i++) nDpx += peers[i].tuningPartition == RCCL_TUNING_PARTITION_DPX; | ||
| *mixed = nDpx > 0 && nDpx < nRanks; | ||
| return nDpx == nRanks ? RCCL_TUNING_PARTITION_DPX : RCCL_TUNING_PARTITION_SPX; | ||
| } | ||
|
|
||
| // Re-picks comm->archThresholds once every rank's request is known (after AllGather1). | ||
| static void rcclSetTuningPartition(struct ncclComm* comm) { | ||
| bool mixed = false; | ||
| const rcclTuningPartition partition = rcclTuningPartitionForComm(comm->peerInfo, comm->nRanks, &mixed); | ||
| comm->archThresholds = rcclGetArchThresholds(comm->archName, partition); | ||
| if (comm->rank != 0 || !IsArchMatch(comm->archName, "gfx1250")) return; | ||
| if (mixed) { | ||
| ATTN("gfx1250 tuning table: ranks ask for different tables (RCCL_TUNING_PARTITION_MODE or GPU partition mode), " | ||
| "using SPX on every rank"); | ||
| } | ||
| INFO(NCCL_INIT | NCCL_TUNING, "gfx1250 tuning table: %s", partition == RCCL_TUNING_PARTITION_DPX ? "DPX" : "SPX"); | ||
| } | ||
|
|
||
| static ncclResult_t fillInfo(struct ncclComm* comm, struct ncclPeerInfo* info, uint64_t commHash) { | ||
| cudaDeviceProp prop; | ||
| info->rank = comm->rank; | ||
|
|
@@ -1311,18 +1351,19 @@ static ncclResult_t fillInfo(struct ncclComm* comm, struct ncclPeerInfo* info, u | |
| // partition 0 are both function 0 with an accelerator class, so read the mode from sysfs and | ||
| // leave mloPart undefined on an unpartitioned GPU, which must not get the DEV overlay (it breaks | ||
| // Rome gpuId matching and disables GIN/GDR). | ||
| // The partition mode lives on the physical device. A CPX alias at .1-.7 is usually absent | ||
| // from sysfs entirely, so ask function 0 rather than our own BDF. | ||
| char physBusIdStr[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; | ||
| char partition[MAX_STR_LEN]; | ||
| partition[0] = '\0'; | ||
| if (int64ToBusId(info->busId & ~0xfLL, physBusIdStr) == ncclSuccess) { | ||
| (void)ncclOsGetPciDeviceComputePartitionByBusId(physBusIdStr, partition, sizeof(partition)); | ||
|
Comment on lines
+1355
to
+1360
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. This code is gross but inherited I guess. |
||
| } | ||
| info->tuningPartition = rcclTuningPartitionRequest(partition); | ||
| if (info->mloPart == NCCL_TOPO_UNDEF) { | ||
| int fn = (int)(info->busId & 0xf); | ||
| if (fn < NCCL_TOPO_MLOPART_DEV_MAX) { | ||
| char busIdStr[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; | ||
| // The partition mode lives on the physical device. A CPX alias at .1-.7 is usually absent | ||
| // from sysfs entirely, so ask function 0 rather than our own BDF. | ||
| char physBusIdStr[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; | ||
| char partition[MAX_STR_LEN]; | ||
| partition[0] = '\0'; | ||
| if (int64ToBusId(info->busId & ~0xfLL, physBusIdStr) == ncclSuccess) { | ||
| (void)ncclOsGetPciDeviceComputePartitionByBusId(physBusIdStr, partition, sizeof(partition)); | ||
| } | ||
| // A partitioned device makes every function a partition, function 0 included: partition 0 is | ||
| // a partition, not an unpartitioned GPU, and must carry index 0 so all of a device's | ||
| // partitions share one DEV overlay group. An empty string means the platform does not report | ||
|
|
@@ -1854,6 +1895,7 @@ static ncclResult_t initTransportsRank(struct ncclComm* comm, struct ncclComm* p | |
| } | ||
| } | ||
| } | ||
| rcclSetTuningPartition(comm); | ||
|
|
||
| // AllGather1 - end | ||
| timers[TIMER_INIT_ALLGATHER] = clockNano() - timers[TIMER_INIT_ALLGATHER]; | ||
|
|
@@ -3109,6 +3151,7 @@ static ncclResult_t ncclCommInitRankFunc(struct ncclAsyncJob* job_) { | |
| comm->ll128LineElems = rcclLL128LineElemsFromArch(comm->archName); | ||
| comm->ll128DataElems = rcclLL128DataElemsFromArch(comm->archName); | ||
| comm->ll128ShmemElemsPerThread = rcclLL128ShmemElemsPerThreadFromArch(comm->archName); | ||
| // SPX until initTransportsRank knows every rank's RCCL_TUNING_PARTITION_MODE request (rcclSetTuningPartition). | ||
| comm->archThresholds = rcclGetArchThresholds(comm->archName); | ||
| comm->maxSharedMemOptin = maxSharedMem; | ||
|
|
||
|
|
||
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.
Medium
The
RCCL_TUNING_PARTITION_MODEentry says the DPX table "is currently a copy of the SPX table, so tuning is unchanged", butrcclArchThresholds_gfx1250_dpxdiffers in 14 fields (e.g.ddaLLMax[AG]512K vs 128K,ddaVmmMax[RS]16M vs 0,agRingLL128MaxPerRank16M vs 64M), and RcclWrapTests.cpp:3114 asserts they differ. With the defaultauto, DPX nodes get the new tuning without opting in. Could we update the entry (and the PR description)?