Quantizes token data (optional). When there is TP domain communication, AllToAllV communication in the EP domain is performed first, and then AllGatherV TP domain communication is performed. When there is no such communication, AllToAllV communication in the EP domain is performed.
[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][object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
- The
[object Object],[object Object],[object Object], and[object Object]data types are not supported. - The
[object Object]attribute value must be 0 or 2. - Shared ranks are not supported. The
[object Object],[object Object], and[object Object]attributes are not supported. - Only EP domains are supported and no TP domains are available. The
[object Object],[object Object], and[object Object]attributes are not supported.[object Object]is invalid. [object Object]is valid only when[object Object]is set to 1 and[object Object]is set to 0.
- The
[object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
- The
[object Object],[object Object],[object Object], and[object Object]data types are not supported. - The
[object Object]attribute value must be 0 or 2. [object Object]is not supported.
- The
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:
- aclnnMoeDistributeDispatch defaults to a deterministic implementation.
[object Object]and[object Object]must be used together. For details, see the example.The element values in the
[object Object],[object Object],[object Object], and[object Object]tensor output of[object Object]may vary depending on the product model, communication algorithm, or version. Pass the tensors directly to the corresponding parameters of[object Object]. Other service logics of the model should not depend on the tensors.The values of
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object], and[object Object]used during operator 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:
[object Object]: Maximum number of tokens that can be received by the current rank. The value range is as follows:- For shared experts,
[object Object]=[object Object][object Object][object Object]/[object Object]. - For MoE experts, when
[object Object]is 0,[object Object]>=[object Object][object Object]min([object Object],[object Object]). When[object Object]is not 0,[object Object]>=[object Object]* min([object Object],[object Object]).
- For shared experts,
[object Object]: Number of experts on the current rank.- For shared expert ranks,
[object Object]= 1. - For MoE expert ranks,
[object Object]=[object Object]/ ([object Object]-[object Object]). If[object Object]> 1, TP domain communication is not supported.
- For shared expert ranks,
In the formulas in this document,
[object Object]denotes integer division.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.
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
- The shape format is described as follows:
[object Object]: Size of the hidden layer. The value must be in the range (0, 7168] and be an integer multiple of 32.[object Object]: Batch sequence size (number of tokens output by the rank), which must be in the range [1, 256].[object Object]: indicates that top K experts are selected. The value must satisfy 0 <[object Object]≤ moeExpertNum and be in the range [1, 16].
[object Object]: Before calling this operator, check whether the value of the[object Object]environment variable is proper. The environment variable indicates the size of the memory occupied by a single communication domain, in MB. If the environment variable is not set, the default value 200 MB is used. The value must satisfy >= 2 ([object Object][object Object]min([object Object],[object Object])[object Object]* sizeof(uint16) + 2MB).[object Object]and[object Object]: Set the environment variables[object Object]to 1 and[object Object]to 0 to reduce cross-server communication and improve the operator performance. In this case,[object Object]>=[object Object][object Object]([object Object]sizeof(dtypeX) + 4 (([object Object]+ 7) / 8 8) sizeof(uint32)) + 4MB + 100MB. In addition, for the input parameter[object Object], only[object Object]%[object Object]= 0 is required, and[object Object]/[object Object]<= 24 is not required. However, the[object Object]feature is not supported.[object Object]: The value is 16, 32, or 64.[object Object]constraints:- If
[object Object]is set to 2, it indicates the pertoken dynamic quantization scenario. The data type of[object Object]can be[object Object].- For
[object Object], you can pass a null pointer. - If valid data is passed to
[object Object], the shape is ([object Object],[object Object]).
- For
- If
- Networking constraints: In multi-server scenarios, only switch-based networking is supported, and direct point-to-point networking between two servers is not supported.
- The shape format is described as follows:
[object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
- In this scenario, a single rank contains dual dies. Therefore, the "rank" in the parameter description indicates a single die.
- The shape format is described as follows:
[object Object]: Hidden layer size, which is 7168.[object Object]: Batch sequence size (number of tokens output by the rank), which must be in the range [1, 512].[object Object]: indicates that top K experts are selected. The value must satisfy 0 <[object Object]≤ moeExpertNum and be in the range [1, 8].
[object Object]: Before calling this operator, check whether the value of the HCCL_BUFFSIZE 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 (
[object Object]- 2) / 2 >=[object Object]2 ([object Object]+ 128) ([object Object]*[object Object]+[object Object]+ 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 (H 2 + 128) * 2.
- Within an EP communication domain: The value must be greater than or equal to 2 and satisfy 1024 ^ 2 (
[object Object]: The value is 8, 16, 32, 64, 128, 144, 256, or 288.[object Object]constraints:- If
[object Object]is set to 2, it indicates the pertoken dynamic quantization scenario. The data type of[object Object]can be[object Object].- For
[object Object], you can pass a null pointer. - If valid data is passed to
[object Object]and shared expert ranks exist, the shape is ([object Object]+[object Object],[object Object]). - If valid data is passed to
[object Object]but no shared expert ranks exist, the shape is ([object Object],[object Object]).
- For
- If
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object]:
Preparing files:
Create rank_table_m2.json and modify it.
Copy the project to the two servers and configure the rank_table_m2.json file based on the device IP address. Ensure that the rank_table_m2.json files on the two servers are the same.
Install the CANN package and compile and run it.
About rankTable:
You can configure the NPU resource information involved in collective communication through the ranktable file. For details, see "Communication Function Development > Cluster Information Configuration > Configuring Resource Information Through the Ranktable File" in .
Run the
[object Object]or[object Object]to query the device IP address. Then, set the JSON file following instructions in the collective communication guide.
[object Object]
Environment variable settings:
[object Object]Set the number of servers: In 2-server 16-rank scenarios, set
[object Object]to 2.[object Object]You do not need to set this variable in single-server 16-rank scenarios.
[object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
Environment variable settings:
[object Object]
The following example is for reference only. For details, see .
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object] and [object Object]Atlas A3 training products/Atlas A3 inference products[object Object]:
[object Object]