[DEVICE] Enable PAT algo for RCCL 1ppn (#1756)

* Enable PAT algo for RCCL 1ppn


[ROCm/rccl commit: e96c8473a1]
This commit is contained in:
Bertan Dogancay
2025-07-04 13:45:18 -04:00
committed by GitHub
parent 82a822b646
commit 471fc6bff2
12 changed files with 108 additions and 92 deletions
+30 -17
View File
@@ -693,48 +693,61 @@ extern int const ncclDevFuncRowToId[];
inline int ncclDevFuncId(int coll, int devRedOp, int type, int algo, int proto) {
int row = 0;
do {
// RING / <all_protos> / Sum / int8_t
// RING/PAT | <all_protos> | Sum | int8_t
int nAlgos = 2;
if (coll == ncclFuncAllGather) {
row += proto;
int algo1 = algo == NCCL_ALGO_RING ? 0 :
/*algo == NCCL_ALGO_PAT*/ 1;
row += algo1 * NCCL_NUM_PROTOCOLS + proto;
break;
}
row += NCCL_NUM_PROTOCOLS;
row += nAlgos * NCCL_NUM_PROTOCOLS;
// <all_algos> / <all_protos> / <all_redops> / <all_types>
// RING/TREE | <all_protos> | <all_redops> | <all_types>
nAlgos = 2;
if (coll == ncclFuncAllReduce) {
row += (((algo * NCCL_NUM_PROTOCOLS + proto) * ncclNumDevRedOps + devRedOp) * ncclNumTypes + type) - NCCL_NUM_FLOATS * (algo * NCCL_NUM_PROTOCOLS + proto);
int algo1 = algo == NCCL_ALGO_TREE ? 0 :
/*algo == NCCL_ALGO_RING*/ 1;
row += (((algo1 * NCCL_NUM_PROTOCOLS + proto) * ncclNumDevRedOps + devRedOp) * ncclNumTypes + type) - NCCL_NUM_FLOATS * (algo1 * NCCL_NUM_PROTOCOLS + proto);
break;
}
row += (NCCL_NUM_ALGORITHMS - 5) * NCCL_NUM_PROTOCOLS * (ncclNumDevRedOps * ncclNumTypes - NCCL_NUM_FLOATS);
row += nAlgos * NCCL_NUM_PROTOCOLS * (ncclNumDevRedOps * ncclNumTypes - NCCL_NUM_FLOATS);
// RING / SIMPLE / Sum / int8_t
// RING | SIMPLE | Sum | int8_t
nAlgos = 1;
if (coll == ncclFuncAllToAllPivot) break;
row += 1;
row += nAlgos * 1;
// RING / <all_protos> / Sum / int8_t
// RING | <all_protos> | Sum | int8_t
nAlgos = 1;
if (coll == ncclFuncBroadcast) {
row += proto;
break;
}
row += NCCL_NUM_PROTOCOLS;
row += nAlgos * NCCL_NUM_PROTOCOLS;
// RING / <all_protos> / <all_redops> / <all_types>
// RING | <all_protos> | <all_redops> | <all_types>
nAlgos = 1;
if (coll == ncclFuncReduce) {
row += ((proto * ncclNumDevRedOps + devRedOp) * ncclNumTypes + type) - NCCL_NUM_FLOATS * proto;
row += ((proto * ncclNumDevRedOps + devRedOp) * ncclNumTypes + type) - NCCL_NUM_FLOATS * proto;
break;
}
row += NCCL_NUM_PROTOCOLS * (ncclNumDevRedOps * ncclNumTypes - NCCL_NUM_FLOATS);
row += nAlgos * NCCL_NUM_PROTOCOLS * (ncclNumDevRedOps * ncclNumTypes - NCCL_NUM_FLOATS);
// RING / <all_protos> / <all_redops> / <all_types>
// RING/PAT | <all_protos> | <all_redops> | <all_types>
nAlgos = 2;
if (coll == ncclFuncReduceScatter) {
row += ((proto * ncclNumDevRedOps + devRedOp) * ncclNumTypes + type) - NCCL_NUM_FLOATS * proto;
int algo1 = algo == NCCL_ALGO_RING ? 0 :
/*algo == NCCL_ALGO_PAT*/ 1;
row += (((algo1 * NCCL_NUM_PROTOCOLS + proto) * ncclNumDevRedOps + devRedOp) * ncclNumTypes + type) - NCCL_NUM_FLOATS * (algo1 * NCCL_NUM_PROTOCOLS + proto);
break;
}
row += NCCL_NUM_PROTOCOLS * (ncclNumDevRedOps * ncclNumTypes - NCCL_NUM_FLOATS);
// RING / SIMPLE / Sum / int8_t
// RING | SIMPLE | Sum | int8_t
nAlgos = 1;
if (coll == ncclFuncSendRecv) break;
row += 1;
row += nAlgos * 1;
} while (false);