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

Function decompressor

hls_smartInfinity/src/kernel_cpp/g16_adam.cpp:48–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void decompressor( uint* grad_idx, half* grad_val, uint n_elements_compressed, half* grad16 )
49{
50 uint g_idx[DATA_SIZE];
51 half g_val[DATA_SIZE];
52 //#pragma HLS ARRAY_PARTITION variable=g_idx complete dim=1
53 //#pragma HLS ARRAY_PARTITION variable=g_val complete dim=1
54
55 uint iteration = n_elements_compressed;
56
57 decompressor : for ( uint i = 0 ; i < iteration ; i+= DATA_SIZE )
58 {
59 uint size = DATA_SIZE;
60 //boundary check
61 if (i + size > iteration) size = iteration - i;
62
63 read_grad_idx: for (uint x = 0 ; x < size; ++x)
64 {
65 #pragma HLS PIPELINE II=1
66 g_idx[x] = grad_idx[i + x];
67 }
68 read_grad_val: for (uint x = 0 ; x < size; ++x)
69 {
70 #pragma HLS PIPELINE II=1
71 g_val[x] = grad_val[i + x];
72 }
73 write_grad: for (uint x = 0 ; x < size; ++x)
74 {
75 #pragma HLS PIPELINE II=1
76 grad16[ g_idx[x] ] = g_val[x];
77 }
78 }
79}
80
81void adam ( hvec* grad16, hvec* param16, vec* param, vec* exp_avg, vec* exp_avg_sq, uint n_elements,
82 float betta1, float betta2, float bias_correction2, float eps, float w_decay, float step_size, float combined_unscale )

Callers 1

g16_adam.cppFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected