To reduce network traffic conflicts, the AI compute cluster usually uses a hierarchical network architecture. That is, directly connected cables are used for intra-server connection, and logical devices with the same ID between servers are interconnected through switches. To adapt to this network topology, the collective communication uses a hierarchical algorithm policy. That is, global communication operations are decomposed into local operations at multiple levels, and the phase-by-phase and hierarchical progressive method is used to improve communication efficiency.
Take the AllGather operator as an example. The AllGather operation is performed among devices with the same ID on different servers, and then the AllGather operation is performed within a server to complete the data gathering process of the entire cluster. However, this method will cause waste of link bandwidth to some extent. When data is transmitted between servers, the links within a server are idle and the bandwidth resources are not fully utilized.
To solve this problem, HCCL uses the fine-grained hierarchical pipeline algorithm. By mining the data dependency of the communication algorithm and combining the pipeline parallelism mode, the bandwidth utilization can be improved.
Take AllGather as an example. The Ring algorithm is used for inter-server communication, and the FullMesh algorithm is used for intra-server communication, as shown in the following figure.

As shown in the preceding figure, the green data block is sent from rank 5 to rank 1 (only the behavior of some ranks is described here, and other ranks are symmetrically processed). In the next step, rank 1 continues to send the green data block to rank 3 (standard step of the Ring algorithm), and rank 1 can also send the green data block to rank 0 in the same server. The execution of the Ring algorithm continues. In each step, data is transmitted between servers, and the data block received in the previous step is transmitted to other ranks in the server. After the last step of the Ring algorithm is complete, only one data block transmission needs to be performed in the server to complete all algorithm steps. (The initial data block of the rank can be transmitted in the server in the first step of the Ring algorithm.)
The following figure shows the orchestration of all transmission tasks from the perspective of rank 0. The local copy operation is performed only when the input memory and output memory are different. It is used to move data blocks from the input memory to the output memory. If the input memory and output memory are the same, this operation is not required.

|
Operation |
Time Required |
|---|---|
|
ReduceScatter |
|
|
AllGather |
|
|
AllReduce |
|
p indicates the total number of devices for completing collective communication,
indicates the number of servers, s indicates the total data size of collective communication operations,
indicates the time required for transmitting each byte of data over the inter-server link,
indicates the time required for transmitting each byte of data over the intra-server link,
indicates the fixed time required for transmitting data over the inter-server link, and
indicates the fixed time required for transmitting data over the intra-server link.