| AI Engine-ML Intrinsics User Guide (v2025.2)

Loading...
Searching...
No Matches
Topics
Sparse Vector Types
Vector Data Types

## Overview

Sparse vector data-types are stored in the vector registers within the AIE-ML. They can be used as the second argument to mac operations.

## Sparse Data Format

The supported sparse data layout requires a minimum of 50% sparsity.
Specifically, two zero values within each group of four consecutive values.
This 50% is a lower bound on the sparsity, meaning that further compression is possible if more zeroes are present.

Loading sparse data from memory will interpret the first 64 bits as a mask:

- If a mask bit is not set, then 8 bits will be initialized to zero at its corresponding position.
- If a mask bit is set, then the 8 bits will be loaded from the incompressible data that follows the mask.

Hence, masks describe the layout of 512 bits after decompression.
Each mask must be aligned to a 32-bit boundary. Failure to meet this requirement will result in incorrect parsing.

When loading sparse data, a partial decompression is carried out to reconstruct the data such that:

- A 64-bit mask is paired with 256-bit partially decompressed data.
- 4 bits of the mask are used to represent two elements of the partially decompressed data.

### Sparse partial decompression

Mask bits | Partially decompressed data
--- | ---
0 | 0 | 0 | 0 | 0 , 0
0 | 0 | 0 | 1 | 0 , A
0 | 0 | 1 | 0 | 0 , B
0 | 0 | 1 | 1 | B , A
0 | 1 | 0 | 0 | C , 0
0 | 1 | 0 | 1 | C , A
0 | 1 | 1 | 0 | C , B
0 | 1 | 1 | 1 | C , B
1 | 0 | 0 | 0 | D , 0
1 | 0 | 0 | 1 | D , A
1 | 0 | 1 | 0 | D , B
1 | 1 | 0 | 0 | D , C

## Topics
| Sparse floating-point vector types
| Sparse integer vector types