AI Engine-ML Intrinsics User Guide  (v2023.2)
Compressed Load Operations

Compressed load operations load a compressed vector and expand it into an AIE-ML register. More...

Overview

Compressed load operations load a compressed vector and expand it into an AIE-ML register.

The decompression treats the first 32 bits as a mask where each bit will correspond to an eight bits word. If 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 location from which the next eight bits will be read.

Example of pointer use

The following code snippet shows how the pointers are used. Here, p points to the memory location from which the buffer will be filled and p2 points to the next available data inside the buffer. 32 bit must always be read from memory as that is the mask that will be used for the decompression. This example shows the extreme cases in which either all mask bits are zero or all mask bits are one. Depending on the amount of data decmpressed from pointer p2 is incremented accordingly. This is also needed if the program switches between different streams of data. In that case p2 must be backed up before the switch to another data stream takes place.

start: p=0x00, p2=0x00
reset: p=0x20, p2=0x00
fill: p=0x40, p2=0x00
fill: p=0x60, p2=0x00
pop: p=0x80, p2=0x14 // all data non-zero, read 32 bit + 256 bit from memory
peek: p=0xA0, p2=0x14
pop: p=0xC0, p2=0x18 // all data zeros, read 32 bit + 0 bit from memory

Alternating between streams of data

To switch between streams of data the internal buffer pointer p2 must be backed up. This pointer is given as an output in some versions of the pop, fill and reset functions. Once p2 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 compr_reset function.
To return to the original stream of data the backup of p2 is passed as the memory pointer to compr_reset. The following example shows how to switch between different streams of data.

v128int4_compress *p_stream1 = //init
v128int4_compress *p2_stream1;
v128int4_compress *p_stream2 = //init
v128int4_compress *p2_stream2;
v128int4 o1, o2;
compr_reset(p_stream1);
compr_pop2(p_stream1, p2_stream1, o1, o2);
p_stream1 = p2_stream1; //save internal buffer pointer for stream 1
compr_reset(p_stream2); //switch to alternate stream
compr_pop2(p_stream_2, p2_stream2, o1, o2);
p_stream2 = p2_stream2; //save internal buffer pointer for stream 2
compr_reset(p_stream1); //return to original stream
Note
After switching to a different stream of data the initialization procedure must be repeated!

Modules

 Compressed Load Reset Operations
 
 Compressed Load of Eight Vectors
 
 Compressed Load of Four Vectors
 
 Compressed Load of One Vector
 
 Compressed Load of Two Vectors
 
compr_reset
void compr_reset(v64int4_compress *&p)
Resets and fills the internal buffer.
Definition: me_ldst.h:338
v128int4_compress
Definition: me_chess.h:731
compr_pop2
void compr_pop2(v64int4_compress *&p, v64int4_compress *&p2, v64int4 &o1, v64int4 &o2)
Fill the internal buffer from memory location p. Reads two decompressed vectors from the internal buf...
Definition: me_ldst.h:338
v128int4
Definition: me_chess.h:499