- Description: Losslessly compresses the r matrix to reduce the memory usage of the r matrix using the msModelSlim tool during l@r matrix multiplication, and completes lossless decompression, matrix multiplication, and dequantization using this API.
- Formula:
x2 indicates the one-dimensional data of the r matrix after being compressed by the msModelSlim tool. compressIndex indicates the information related to the compression algorithm. is the data after lossless decompression in this API (consistent with the original r matrix data). For details about the compression and calling example of this API, see .
Each operator has calls. First, aclnnMatmulCompressGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnMatmulCompress 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 description:
- [object Object]Atlas training products[object Object] and [object Object]Atlas inference products[object Object]: aclnnMatmulCompress defaults to a deterministic implementation.
- Prepare the data before compression.
Assume that the input data is generated using the gen_data.py script. The following is an example for reference only:
Preprocess data.
Use the msModelSlim tool to compress the original weight to generate the compressed x2, compressIndex, and compressInfo. When using the following APIs, you need to compile the msModelSlim tool in the CANN package. For details, see README.md in the msmodelslim/pytorch/weight_compression directory in the .
[object Object]Call the aclnn API for computation.
The following example is for reference only. For details, see .