MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / decompressor

Function decompressor

hls_smartInfinity/src/kernel_cpp/adam_topk.cpp:54–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void decompressor( ivec* grad_idx, vec* grad_val, uint n_elements_compressed, float* grad )
55{
56 ivec g_idx[DATA_SIZE];
57 vec g_val[DATA_SIZE];
58
59 uint iteration = n_elements_compressed / VEC_SIZE;
60
61 decompressor : for ( uint i = 0 ; i < iteration ; i+= DATA_SIZE )
62 {
63 uint size = DATA_SIZE;
64 //boundary check
65 if (i + size > iteration) size = iteration - i;
66
67 read_grad_idx: for (uint x = 0 ; x < size; ++x)
68 {
69 #pragma HLS PIPELINE II=1
70 g_idx[x] = grad_idx[i + x];
71 }
72
73 read_grad_val: for (uint x = 0 ; x < size ; ++x)
74 {
75 #pragma HLS PIPELINE II=1
76 g_val[x] = grad_val[i + x];
77 }
78
79 write_grad: for (uint x = 0 ; x < size; ++x)
80 {
81 #pragma HLS loop_flatten
82 inner_write_grad: for (uint y = 0 ; y < VEC_SIZE; ++y)
83 {
84 #pragma HLS PIPELINE II=1 // Removed by completely unrolling
85 grad[ g_idx[x][y] ] = g_val[x][y];
86 }
87 }
88 }
89}
90
91void adam ( float* grad, vec* param, vec* exp_avg, vec* exp_avg_sq, hvec* param16, uint n_elements,
92 float betta1, float betta2, float bias_correction2, float eps, float w_decay, float step_size, float combined_unscale )

Callers 1

adam_topk.cppFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected