| 25 | typedef hls::vector<half, D_VEC_SIZE> hvec; // 256 bits |
| 26 | |
| 27 | static void initialize( half* grad16, uint n_elements ) |
| 28 | { |
| 29 | half z = 0.0f; |
| 30 | |
| 31 | uint iteration = n_elements / VEC_SIZE; |
| 32 | vadd_pipeline: for (uint i = 0 ; i < iteration ; i += DATA_SIZE) |
| 33 | { |
| 34 | uint size = DATA_SIZE; |
| 35 | //boundary check |
| 36 | if (i + size > iteration) size = iteration - i; |
| 37 | |
| 38 | init_grad: for ( uint x = 0; x < size; ++x) |
| 39 | { |
| 40 | #pragma HLS PIPELINE II=1 |
| 41 | for (uint y = 0 ; y < VEC_SIZE; ++y){ |
| 42 | grad16[(i+x) * VEC_SIZE + y] = z; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | void decompressor( uint* grad_idx, half* grad_val, uint n_elements_compressed, half* grad16 ) |
| 49 | { |