AI Engine-ML Intrinsics User Guide
(v2023.2)
|
Compressed sparse load operations load a compressed sparse vector and expand it into an AIE-ML register. More...
Compressed sparse load operations load a compressed sparse vector and expand it into an AIE-ML register.
The decompression treats the first 64 bits as a mask where each bit will correspond to an eight bit word. If a given bit of the mask has value zero, then eight bits of zeros will be inserted in the corresponding position. Otherwise, eight bits will be taken from the values received from memory. As the amount of data read from the memory depends on the mask a second pointer is used to mark the memory location from which the next eight bits will be read.
This part works similar to the decompression algorithm in Compressed Load Operations. The difference is that the result is not completely uncompressed. The partial uncompressed results of 256 bits have a compression ratio of 50%. The fully uncompressed vector would take 512 bits. The partial uncompression has the requirement that there must be at least two zero entities in every two entities of the partially uncompressed vector. The following tables show the definition of an entity depending on the selected size mode as well as the correlation to the partially uncompressed output vector.
Size Mode | Compression granularity | Size entity | Mask bits per entity |
---|---|---|---|
4 bits | 8 bits | 8 bits | 1 |
8 bits | 8 bits | 8 bits | 1 |
16 bits | 8 bits | 16 bits | 2 (or'ed) |
Mask bit | Fully Uncompressed Vector (8/16 bit entities) | Partially Uncompressed Vector (8/16 bit entities) | Address of memory accesses | |||||||
---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | - |
0 | 0 | 0 | 1 | 0 | 0 | 0 | A | 0 | A | M[0] |
0 | 0 | 1 | 0 | 0 | 0 | B | 0 | 0 | B | M[0] |
0 | 0 | 1 | 1 | 0 | 0 | B | A | B | A | M[1] and M[0] |
0 | 1 | 0 | 0 | 0 | C | 0 | 0 | C | 0 | M[0] |
0 | 1 | 0 | 1 | 0 | C | 0 | A | C | A | M[1] and M[0] |
0 | 1 | 1 | 0 | 0 | C | B | 0 | C | B | M[1] and M[0] |
1 | 0 | 0 | 0 | D | 0 | 0 | 0 | D | 0 | M[0] |
1 | 0 | 0 | 1 | D | 0 | 0 | A | D | A | M[1] and M[0] |
1 | 0 | 1 | 0 | D | 0 | B | 0 | D | B | M[1] and M[0] |
1 | 1 | 0 | 0 | D | C | 0 | 0 | D | C | M[1] and M[0] |
To initilize the internal buffer first sparse_reset must be called followed by five copies of sparse_fill. The memory pointer p, with which sparse_reset is called, must be 32-bit aligned. If it is 256-bit aligned only four copies of sparse_fill are needed.
Once the internal buffer has been initialized, data can be read from it using the various pop an peek functions.
To switch between streams of data the internal buffer pointer must be backed up. This pointer is given as an output in the get_pointer version of the functions. Once it has been backed up, the internal buffer can be initialized with data from the the second stream of data. This is done by passing the memory pointer to this second stream to the sparse_reset function.
To return to the original stream of data the backup is passed as the memory pointer to sparse_reset. The following example shows how to switch between different streams of data.
Modules | |
Sparse Load Fill Operations | |
Sparse Load Peek Operations | |
Sparse Load Pop Operations | |
Sparse Load Reset Operations | |