Operator functions: When TP domain communication is involved, ReduceScatterV is performed first, followed by AlltoAllV, and finally the received data is aggregated (multiplied by weights and then summed). When TP domain communication is not involved, AlltoAllV is performed, after which the received data is aggregated (multiplied by weights and then summed), followed by fused Add + RMSNorm.
Formula:
[object Object]
Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] is called to perform computation.
Parameters
[object Object]Returns
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown.
[object Object]
Deterministic computing:
[object Object]defaults to a deterministic implementation.
[object Object]and[object Object]must be used together. For details, see the example.The values of
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object], and[object Object]used during API calling must be the same for all ranks, at all network layers, and the same as those of[object Object].The shape format is described as follows:
- A: Maximum number of tokens to be distributed by the current rank. The value range is as follows:
- For shared experts, A = Bs epWorldSize sharedExpertNum / sharedExpertRankNum.
- For MoE experts, when
[object Object]is 0, A >= Bs epWorldSize min(localExpertNum, K). When[object Object]is not 0, A >= globalBS * min(localExpertNum, K).
- H: Hidden layer size, which must be in the range [1024, 8192].
- Bs: Batch sequence size (number of tokens output by the rank), which must be in the range 0 < Bs ≤ 512.
- K: Number of top K experts, which must be in the ranges 0 < K ≤ 16 and 0 < K ≤ moeExpertNum.
- localExpertNum: Number of experts on the current rank.
- For shared expert ranks, localExpertNum = 1.
- For MoE expert ranks, localExpertNum = moeExpertNum/(epWorldSize - sharedExpertRankNum). If localExpertNum > 1, TP domain communication is not supported.
- A: Maximum number of tokens to be distributed by the current rank. The value range is as follows:
HCCL_BUFFSIZE: Before calling this API, check whether the value of the
[object Object]environment variable is proper. This environment variable indicates the buffer size occupied by a single communication domain, in MB. If this environment variable is not set, the default value 200 MB is used.- Within an EP communication domain: The value must be greater than or equal to 2 and satisfy (1024^2 (HCCL_BUFFSIZE - 2) / 2 ≥ Bs 2 (H + 128) (epWorldSize * localExpertNum + K + 1)).
[object Object]must be the number of experts assigned to the current rank when using MoE. - Within a TP communication domain: The value must satisfy >= (A * Align512(Align32(h * 2) + 44) + A * Align512(h * 2)) * 2.
- Within an EP communication domain: The value must be greater than or equal to 2 and satisfy (1024^2 (HCCL_BUFFSIZE - 2) / 2 ≥ Bs 2 (H + 128) (epWorldSize * localExpertNum + K + 1)).
Constraints on the use of communication domains:
[object Object]and[object Object]in a model support only the same EP communication domain, and no other operators are allowed in the communication domain.[object Object]and[object Object]in a model support only the same TP communication domain or both do not support a TP communication domain. If a TP communication domain is supported, no other operators are allowed in the communication domain.- [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]: Nodes in a communication domain must be in the same SuperPoD. Cross-SuperPoD nodes are not supported.
The following example is for reference only. For details, see .
[object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
[object Object]