Note: This API will be deprecated in later versions. Use aclnnWeightQuantMatmulAllReduce and aclnnAddRmsNorm instead.
Note: When using this API, ensure that the driver firmware package and CANN package are in the 8.0.RC2 version or later. Otherwise, an error, such as BUS ERROR, will be reported.
- Operator function: Performs the MatMul, AllReduce, addition, and RMSNorm computation in sequence.
- Formula:
[object Object]and[object Object]implement the same function in different ways. Select a proper operator based on your requirements.[object Object]: Output tensor objects[object Object]and[object Object]need to be created to store the computation result.[object Object]: Output tensor[object Object]needs to be created. The results that would have been stored in the output tensor[object Object]in the original non-inplace scenario are directly written to the memory of the input tensor[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 flow. 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 computation:
- By default, aclnnWeightQuantMatmulAllReduceAddRmsNorm is implemented in non-deterministic mode. You can enable deterministic computing by setting the HCCL_DETERMINISTIC environment variable to true.
The application scenario is the same as that of
[object Object]. MC2 is disabled in incremental scenarios but enabled in full scenarios.The input
[object Object]can be two-dimensional or three-dimensional, with shape (b, s, k) or (s, k), respectively. x2 must be two-dimensional, and its shape is (k, n). The axis meets the input parameter requirements of the MM operator. The k axis is the same, and the ranges of b*s and s are [1, 2147483647], and the ranges of k and n are [1, 65535]. If[object Object]is not empty, it must be one-dimensional, with shape (n).The input
[object Object]must be three-dimensional, with its shape being (b, s, n). When[object Object]is two-dimensional, (b*s) of[object Object]is equal to s of[object Object]. The input[object Object]must be one-dimensional, with shape (n).In the pertensor scenario, the shape of antiquantScale is (1); in the perchannel scenario, the shape is (1, n)/(n); in the pergroup scenario, the shape is (ceil(k, antiquantGroupSize), n). If antiquantOffset is not empty, its shape is the same as that of antiquantScale.
The dimensions and data types of the outputs
[object Object]and[object Object]are the same as those of[object Object]. If[object Object]is not empty, its shape is equal to the last dimension of[object Object].The data type of
[object Object]must be int8 or int4. The data types of the inputs[object Object],[object Object],[object Object],[object Object],[object Object], and[object Object]must be the same.The
[object Object]matrix cannot be transposed. The[object Object]matrix can be transposed or not transposed.The value of
[object Object]falls in the range [32, min(k-1, INT_MAX)] and must be a multiple of 32.1, 2, 4, and 8 ranks are supported, and only the all-mesh networking of HCCS links is supported.
Empty tensors with (b*s) and n being 0 are supported. Empty tensors with k being 0 are not supported.
[object Object]Atlas A2 training products/Atlas A2 inference products[object Object]: Only one communication domain for MC2 operators within a model is supported.
The following example is for reference only. For details, see .