Load2DMX
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
x |
|
x |
Function Usage
Supports data transfer over the following paths:
GM -> A1; GM -> B1; GM -> A2; GM -> B2;
A1 -> A2; B1 -> B2.
Prototype
- Load2DMX API
1 2
template <typename T, typename U = T> __aicore__ inline void LoadData(const LocalTensor<U>& dst, const LocalTensor<T>& src, const LocalTensor<fp8_e8m0_t>& srcMx, const LoadData2DParamsV2& loadDataParams, const LoadData2DMxParams& loadMxDataParams)
- The Load2Dv2MX API supports different data types for source and destination operands.
1 2
template <typename T, typename U> __aicore__ inline void LoadData(const LocalTensor<U>& dst, const LocalTensor<T>& src0, const LocalTensor<fp8_e8m0_t>& srcMx, const LoadData2DParamsV2& loadDataParams, const LoadData2DMxParams& loadMxDataParams)
Parameters
Parameter |
Description |
|---|---|
T |
Data types of the source and destination operands.
|
U |
|
Parameter |
Input/Output |
Description |
|---|---|---|
dst |
Output |
Destination operand, which is of the LocalTensor type. The sequential arrangement of data is determined by TPosition of the destination operand. The constraints are as follows:
|
src |
Input |
Source operand, which is of the LocalTensor or GlobalTensor type. Its data type must be the same as that of dst. |
srcMx |
Input |
Source operand, which is of the LocalTensor type. Only the fp8_e8m0_t type is supported. |
loadDataParams |
Input |
LoadData parameter structure. Supported types are as follows:
For details, see ${INSTALL_DIR}/include/ascendc/basic_api/interface/kernel_struct_mm.h. Replace ${INSTALL_DIR} with the actual path for storing files after the CANN software is installed. |
Parameter |
Description |
|---|---|
xStartPosition |
Start position along the X-axis (M dimension) of the source matrix. The unit is one fractal, where one unit corresponds to a 32-byte fractal. |
yStartPosition |
Start position along the Y-axis (K dimension) of the source matrix. The unit is 32 bytes. |
xStep |
Transfer length along the X-axis (M dimension) of the source matrix. The unit is one fractal, where one unit corresponds to a 32-byte fractal. Value range: xStep ∈ [0, 255]. |
yStep |
Transfer length along the Y-axis (K dimension) of the source matrix. The unit is 32 bytes. Value range: yStep ∈ [0, 255]. |
srcStride |
Interval between the start addresses of adjacent fractals along the X dimension of the source matrix. The unit is 32 bytes. |
dstStride |
Interval between the start addresses of adjacent fractals along the X dimension of the destination matrix. The unit is 32 bytes. |
The following uses an example to describe the parameters in the LoadData2DMX structure. Assume that the shape of matrix A is (M, K). Then, the shape of matrix ScaleA is (M, K/32), and the data type of ScaleA is fp8_e8m0_t. Figure 1 shows the fractal arrangement of ScaleA.
The following figure shows the configuration parameters for transferring ScaleA from L1 to L0A. Each row is 32 bytes, corresponding to one fractal in Figure 1. xStep indicates the number of fractals along the M dimension, for example, xStep = M/16 = 3 in the figure. yStep indicates the number of 32-byte units along the K dimension, for example, yStep = K/32/2 = 21 in the figure. srcStride and dstStride work in the same way and indicate the number of 32-byte units along the K dimension.

Restrictions
- For details about the operand address alignment requirements, see General Address Alignment Restrictions.
Returns
None
