forked from dillonhuff/clockwork
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conv_layer.cpp
260 lines (228 loc) · 24.2 KB
/
conv_layer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#include "example_progs.h"
prog conv_layer() {
prog prg;
prg.compute_unit_file = "conv_layer_compute.h";
prg.name = "conv_layer";
// Stencil<uint16_t, 18, 18, 4> &input_copy_stencil = arg_0;
prg.add_input("input_copy_stencil");
prg.buffer_port_widths["input_copy_stencil"] = 16;
// Stencil<uint8_t, 16, 16, 3> &hw_output_stencil = arg_1;
prg.add_output("hw_output_stencil");
prg.buffer_port_widths["hw_output_stencil"] = 16;
////producing hw_input.stencil
auto hw_input_s0_c = prg.add_loop("hw_input_s0_c", 0, 4);
auto hw_input_s0_y = hw_input_s0_c->add_loop("hw_input_s0_y", 0, 18);
auto hw_input_s0_x = hw_input_s0_y->add_loop("hw_input_s0_x", 0, 18);
//store is: hw_input.stencil(hw_input_s0_x, hw_input_s0_y, hw_input_s0_c) = input_copy.stencil(hw_input_s0_x, hw_input_s0_y, hw_input_s0_c)
auto hcompute_hw_input_stencil = hw_input_s0_x->add_op("op_hcompute_hw_input_stencil");
hcompute_hw_input_stencil->add_function("hcompute_hw_input_stencil");
hcompute_hw_input_stencil->add_load("input_copy_stencil", "hw_input_s0_x", "hw_input_s0_y", "hw_input_s0_c");
prg.buffer_port_widths["hw_input_stencil"] = 16;
hcompute_hw_input_stencil->add_store("hw_input_stencil", "hw_input_s0_x", "hw_input_s0_y", "hw_input_s0_c");
//consuming hw_input.stencil
////producing dw_conv.stencil
auto dw_conv_s0_c = prg.add_loop("dw_conv_s0_c", 0, 4);
auto dw_conv_s0_y = dw_conv_s0_c->add_loop("dw_conv_s0_y", 0, 16);
auto dw_conv_s0_x = dw_conv_s0_y->add_loop("dw_conv_s0_x", 0, 16);
//store is: dw_conv.stencil(dw_conv_s0_x, dw_conv_s0_y, dw_conv_s0_c) = (int16)0
auto hcompute_dw_conv_stencil = dw_conv_s0_x->add_op("op_hcompute_dw_conv_stencil");
hcompute_dw_conv_stencil->add_function("hcompute_dw_conv_stencil");
prg.buffer_port_widths["dw_conv_stencil"] = 16;
hcompute_dw_conv_stencil->add_store("dw_conv_stencil", "dw_conv_s0_x", "dw_conv_s0_y", "dw_conv_s0_c");
auto dw_conv_s1_y = prg.add_loop("dw_conv_s1_y", 0, 16);
auto dw_conv_s1_x = dw_conv_s1_y->add_loop("dw_conv_s1_x", 0, 16);
//store is: dw_conv.stencil(dw_conv_s1_x, dw_conv_s1_y, 0) = (((((((((dw_conv.stencil(dw_conv_s1_x, dw_conv_s1_y, 0) + int16(hw_input.stencil(dw_conv_s1_x, dw_conv_s1_y, 0))) + int16(hw_input.stencil((dw_conv_s1_x + 1), dw_conv_s1_y, 0))) + int16(hw_input.stencil((dw_conv_s1_x + 2), dw_conv_s1_y, 0))) + int16(hw_input.stencil(dw_conv_s1_x, (dw_conv_s1_y + 1), 0))) + int16(hw_input.stencil((dw_conv_s1_x + 1), (dw_conv_s1_y + 1), 0))) + int16(hw_input.stencil((dw_conv_s1_x + 2), (dw_conv_s1_y + 1), 0))) + int16(hw_input.stencil(dw_conv_s1_x, (dw_conv_s1_y + 2), 0))) + int16(hw_input.stencil((dw_conv_s1_x + 1), (dw_conv_s1_y + 2), 0))) + int16(hw_input.stencil((dw_conv_s1_x + 2), (dw_conv_s1_y + 2), 0)))
auto hcompute_dw_conv_stencil_1 = dw_conv_s1_x->add_op("op_hcompute_dw_conv_stencil_1");
hcompute_dw_conv_stencil_1->add_function("hcompute_dw_conv_stencil_1");
hcompute_dw_conv_stencil_1->add_load("dw_conv_stencil", "dw_conv_s1_x", "dw_conv_s1_y", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "dw_conv_s1_x", "dw_conv_s1_y", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "(dw_conv_s1_x + 1)", "dw_conv_s1_y", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "(dw_conv_s1_x + 2)", "dw_conv_s1_y", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "dw_conv_s1_x", "(dw_conv_s1_y + 1)", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "(dw_conv_s1_x + 1)", "(dw_conv_s1_y + 1)", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "(dw_conv_s1_x + 2)", "(dw_conv_s1_y + 1)", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "dw_conv_s1_x", "(dw_conv_s1_y + 2)", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "(dw_conv_s1_x + 1)", "(dw_conv_s1_y + 2)", "0");
hcompute_dw_conv_stencil_1->add_load("hw_input_stencil", "(dw_conv_s1_x + 2)", "(dw_conv_s1_y + 2)", "0");
hcompute_dw_conv_stencil_1->add_store("dw_conv_stencil", "dw_conv_s1_x", "dw_conv_s1_y", "0");
auto dw_conv_s1_y_1 = prg.add_loop("dw_conv_s1_y_1", 0, 16);
auto dw_conv_s1_x_1 = dw_conv_s1_y_1->add_loop("dw_conv_s1_x_1", 0, 16);
//store is: dw_conv.stencil(dw_conv_s1_x_1, dw_conv_s1_y_1, 1) = (((((((((dw_conv.stencil(dw_conv_s1_x_1, dw_conv_s1_y_1, 1) + int16(hw_input.stencil(dw_conv_s1_x_1, dw_conv_s1_y_1, 1))) + int16(hw_input.stencil((dw_conv_s1_x_1 + 1), dw_conv_s1_y_1, 1))) + int16(hw_input.stencil((dw_conv_s1_x_1 + 2), dw_conv_s1_y_1, 1))) + int16(hw_input.stencil(dw_conv_s1_x_1, (dw_conv_s1_y_1 + 1), 1))) + int16(hw_input.stencil((dw_conv_s1_x_1 + 1), (dw_conv_s1_y_1 + 1), 1))) + int16(hw_input.stencil((dw_conv_s1_x_1 + 2), (dw_conv_s1_y_1 + 1), 1))) + int16(hw_input.stencil(dw_conv_s1_x_1, (dw_conv_s1_y_1 + 2), 1))) + int16(hw_input.stencil((dw_conv_s1_x_1 + 1), (dw_conv_s1_y_1 + 2), 1))) + int16(hw_input.stencil((dw_conv_s1_x_1 + 2), (dw_conv_s1_y_1 + 2), 1)))
auto hcompute_dw_conv_stencil_2 = dw_conv_s1_x_1->add_op("op_hcompute_dw_conv_stencil_2");
hcompute_dw_conv_stencil_2->add_function("hcompute_dw_conv_stencil_2");
hcompute_dw_conv_stencil_2->add_load("dw_conv_stencil", "dw_conv_s1_x_1", "dw_conv_s1_y_1", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "dw_conv_s1_x_1", "dw_conv_s1_y_1", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "(dw_conv_s1_x_1 + 1)", "dw_conv_s1_y_1", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "(dw_conv_s1_x_1 + 2)", "dw_conv_s1_y_1", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "dw_conv_s1_x_1", "(dw_conv_s1_y_1 + 1)", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "(dw_conv_s1_x_1 + 1)", "(dw_conv_s1_y_1 + 1)", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "(dw_conv_s1_x_1 + 2)", "(dw_conv_s1_y_1 + 1)", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "dw_conv_s1_x_1", "(dw_conv_s1_y_1 + 2)", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "(dw_conv_s1_x_1 + 1)", "(dw_conv_s1_y_1 + 2)", "1");
hcompute_dw_conv_stencil_2->add_load("hw_input_stencil", "(dw_conv_s1_x_1 + 2)", "(dw_conv_s1_y_1 + 2)", "1");
hcompute_dw_conv_stencil_2->add_store("dw_conv_stencil", "dw_conv_s1_x_1", "dw_conv_s1_y_1", "1");
auto dw_conv_s1_y_2 = prg.add_loop("dw_conv_s1_y_2", 0, 16);
auto dw_conv_s1_x_2 = dw_conv_s1_y_2->add_loop("dw_conv_s1_x_2", 0, 16);
//store is: dw_conv.stencil(dw_conv_s1_x_2, dw_conv_s1_y_2, 2) = (((((((((dw_conv.stencil(dw_conv_s1_x_2, dw_conv_s1_y_2, 2) + int16(hw_input.stencil(dw_conv_s1_x_2, dw_conv_s1_y_2, 2))) + int16(hw_input.stencil((dw_conv_s1_x_2 + 1), dw_conv_s1_y_2, 2))) + int16(hw_input.stencil((dw_conv_s1_x_2 + 2), dw_conv_s1_y_2, 2))) + int16(hw_input.stencil(dw_conv_s1_x_2, (dw_conv_s1_y_2 + 1), 2))) + int16(hw_input.stencil((dw_conv_s1_x_2 + 1), (dw_conv_s1_y_2 + 1), 2))) + int16(hw_input.stencil((dw_conv_s1_x_2 + 2), (dw_conv_s1_y_2 + 1), 2))) + int16(hw_input.stencil(dw_conv_s1_x_2, (dw_conv_s1_y_2 + 2), 2))) + int16(hw_input.stencil((dw_conv_s1_x_2 + 1), (dw_conv_s1_y_2 + 2), 2))) + int16(hw_input.stencil((dw_conv_s1_x_2 + 2), (dw_conv_s1_y_2 + 2), 2)))
auto hcompute_dw_conv_stencil_3 = dw_conv_s1_x_2->add_op("op_hcompute_dw_conv_stencil_3");
hcompute_dw_conv_stencil_3->add_function("hcompute_dw_conv_stencil_3");
hcompute_dw_conv_stencil_3->add_load("dw_conv_stencil", "dw_conv_s1_x_2", "dw_conv_s1_y_2", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "dw_conv_s1_x_2", "dw_conv_s1_y_2", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "(dw_conv_s1_x_2 + 1)", "dw_conv_s1_y_2", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "(dw_conv_s1_x_2 + 2)", "dw_conv_s1_y_2", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "dw_conv_s1_x_2", "(dw_conv_s1_y_2 + 1)", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "(dw_conv_s1_x_2 + 1)", "(dw_conv_s1_y_2 + 1)", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "(dw_conv_s1_x_2 + 2)", "(dw_conv_s1_y_2 + 1)", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "dw_conv_s1_x_2", "(dw_conv_s1_y_2 + 2)", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "(dw_conv_s1_x_2 + 1)", "(dw_conv_s1_y_2 + 2)", "2");
hcompute_dw_conv_stencil_3->add_load("hw_input_stencil", "(dw_conv_s1_x_2 + 2)", "(dw_conv_s1_y_2 + 2)", "2");
hcompute_dw_conv_stencil_3->add_store("dw_conv_stencil", "dw_conv_s1_x_2", "dw_conv_s1_y_2", "2");
auto dw_conv_s1_y_3 = prg.add_loop("dw_conv_s1_y_3", 0, 16);
auto dw_conv_s1_x_3 = dw_conv_s1_y_3->add_loop("dw_conv_s1_x_3", 0, 16);
//store is: dw_conv.stencil(dw_conv_s1_x_3, dw_conv_s1_y_3, 3) = (((((((((dw_conv.stencil(dw_conv_s1_x_3, dw_conv_s1_y_3, 3) + int16(hw_input.stencil(dw_conv_s1_x_3, dw_conv_s1_y_3, 3))) + int16(hw_input.stencil((dw_conv_s1_x_3 + 1), dw_conv_s1_y_3, 3))) + int16(hw_input.stencil((dw_conv_s1_x_3 + 2), dw_conv_s1_y_3, 3))) + int16(hw_input.stencil(dw_conv_s1_x_3, (dw_conv_s1_y_3 + 1), 3))) + int16(hw_input.stencil((dw_conv_s1_x_3 + 1), (dw_conv_s1_y_3 + 1), 3))) + int16(hw_input.stencil((dw_conv_s1_x_3 + 2), (dw_conv_s1_y_3 + 1), 3))) + int16(hw_input.stencil(dw_conv_s1_x_3, (dw_conv_s1_y_3 + 2), 3))) + int16(hw_input.stencil((dw_conv_s1_x_3 + 1), (dw_conv_s1_y_3 + 2), 3))) + int16(hw_input.stencil((dw_conv_s1_x_3 + 2), (dw_conv_s1_y_3 + 2), 3)))
auto hcompute_dw_conv_stencil_4 = dw_conv_s1_x_3->add_op("op_hcompute_dw_conv_stencil_4");
hcompute_dw_conv_stencil_4->add_function("hcompute_dw_conv_stencil_4");
hcompute_dw_conv_stencil_4->add_load("dw_conv_stencil", "dw_conv_s1_x_3", "dw_conv_s1_y_3", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "dw_conv_s1_x_3", "dw_conv_s1_y_3", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "(dw_conv_s1_x_3 + 1)", "dw_conv_s1_y_3", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "(dw_conv_s1_x_3 + 2)", "dw_conv_s1_y_3", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "dw_conv_s1_x_3", "(dw_conv_s1_y_3 + 1)", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "(dw_conv_s1_x_3 + 1)", "(dw_conv_s1_y_3 + 1)", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "(dw_conv_s1_x_3 + 2)", "(dw_conv_s1_y_3 + 1)", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "dw_conv_s1_x_3", "(dw_conv_s1_y_3 + 2)", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "(dw_conv_s1_x_3 + 1)", "(dw_conv_s1_y_3 + 2)", "3");
hcompute_dw_conv_stencil_4->add_load("hw_input_stencil", "(dw_conv_s1_x_3 + 2)", "(dw_conv_s1_y_3 + 2)", "3");
hcompute_dw_conv_stencil_4->add_store("dw_conv_stencil", "dw_conv_s1_x_3", "dw_conv_s1_y_3", "3");
//consuming dw_conv.stencil
////producing pw_conv.stencil
auto pw_conv_s0_k = prg.add_loop("pw_conv_s0_k", 0, 3);
auto pw_conv_s0_y = pw_conv_s0_k->add_loop("pw_conv_s0_y", 0, 16);
auto pw_conv_s0_x = pw_conv_s0_y->add_loop("pw_conv_s0_x", 0, 16);
auto pw_conv_s0_c = pw_conv_s0_x->add_loop("pw_conv_s0_c", 0, 4);
//store is: pw_conv.stencil(pw_conv_s0_k, pw_conv_s0_x, pw_conv_s0_y, pw_conv_s0_c) = (int16)0
auto hcompute_pw_conv_stencil = pw_conv_s0_c->add_op("op_hcompute_pw_conv_stencil");
hcompute_pw_conv_stencil->add_function("hcompute_pw_conv_stencil");
prg.buffer_port_widths["pw_conv_stencil"] = 16;
hcompute_pw_conv_stencil->add_store("pw_conv_stencil", "pw_conv_s0_k", "pw_conv_s0_x", "pw_conv_s0_y", "pw_conv_s0_c");
auto pw_conv_s1_y = prg.add_loop("pw_conv_s1_y", 0, 16);
auto pw_conv_s1_x = pw_conv_s1_y->add_loop("pw_conv_s1_x", 0, 16);
//store is: pw_conv.stencil(0, pw_conv_s1_x, pw_conv_s1_y, 0) = (pw_conv.stencil(0, pw_conv_s1_x, pw_conv_s1_y, 0) + (dw_conv.stencil(pw_conv_s1_x, pw_conv_s1_y, 0)*(int16)3))
auto hcompute_pw_conv_stencil_1 = pw_conv_s1_x->add_op("op_hcompute_pw_conv_stencil_1");
hcompute_pw_conv_stencil_1->add_function("hcompute_pw_conv_stencil_1");
hcompute_pw_conv_stencil_1->add_load("dw_conv_stencil", "pw_conv_s1_x", "pw_conv_s1_y", "0");
hcompute_pw_conv_stencil_1->add_load("pw_conv_stencil", "0", "pw_conv_s1_x", "pw_conv_s1_y", "0");
hcompute_pw_conv_stencil_1->add_store("pw_conv_stencil", "0", "pw_conv_s1_x", "pw_conv_s1_y", "0");
//store is: pw_conv.stencil(1, pw_conv_s1_x, pw_conv_s1_y, 0) = (pw_conv.stencil(1, pw_conv_s1_x, pw_conv_s1_y, 0) + (dw_conv.stencil(pw_conv_s1_x, pw_conv_s1_y, 0)*(int16)3))
auto hcompute_pw_conv_stencil_2 = pw_conv_s1_x->add_op("op_hcompute_pw_conv_stencil_2");
hcompute_pw_conv_stencil_2->add_function("hcompute_pw_conv_stencil_2");
hcompute_pw_conv_stencil_2->add_load("dw_conv_stencil", "pw_conv_s1_x", "pw_conv_s1_y", "0");
hcompute_pw_conv_stencil_2->add_load("pw_conv_stencil", "1", "pw_conv_s1_x", "pw_conv_s1_y", "0");
hcompute_pw_conv_stencil_2->add_store("pw_conv_stencil", "1", "pw_conv_s1_x", "pw_conv_s1_y", "0");
//store is: pw_conv.stencil(2, pw_conv_s1_x, pw_conv_s1_y, 0) = (pw_conv.stencil(2, pw_conv_s1_x, pw_conv_s1_y, 0) + (dw_conv.stencil(pw_conv_s1_x, pw_conv_s1_y, 0)*(int16)3))
auto hcompute_pw_conv_stencil_3 = pw_conv_s1_x->add_op("op_hcompute_pw_conv_stencil_3");
hcompute_pw_conv_stencil_3->add_function("hcompute_pw_conv_stencil_3");
hcompute_pw_conv_stencil_3->add_load("dw_conv_stencil", "pw_conv_s1_x", "pw_conv_s1_y", "0");
hcompute_pw_conv_stencil_3->add_load("pw_conv_stencil", "2", "pw_conv_s1_x", "pw_conv_s1_y", "0");
hcompute_pw_conv_stencil_3->add_store("pw_conv_stencil", "2", "pw_conv_s1_x", "pw_conv_s1_y", "0");
auto pw_conv_s1_y_1 = prg.add_loop("pw_conv_s1_y_1", 0, 16);
auto pw_conv_s1_x_1 = pw_conv_s1_y_1->add_loop("pw_conv_s1_x_1", 0, 16);
//store is: pw_conv.stencil(0, pw_conv_s1_x_1, pw_conv_s1_y_1, 1) = (pw_conv.stencil(0, pw_conv_s1_x_1, pw_conv_s1_y_1, 1) + (dw_conv.stencil(pw_conv_s1_x_1, pw_conv_s1_y_1, 1)*(int16)3))
auto hcompute_pw_conv_stencil_4 = pw_conv_s1_x_1->add_op("op_hcompute_pw_conv_stencil_4");
hcompute_pw_conv_stencil_4->add_function("hcompute_pw_conv_stencil_4");
hcompute_pw_conv_stencil_4->add_load("dw_conv_stencil", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
hcompute_pw_conv_stencil_4->add_load("pw_conv_stencil", "0", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
hcompute_pw_conv_stencil_4->add_store("pw_conv_stencil", "0", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
//store is: pw_conv.stencil(1, pw_conv_s1_x_1, pw_conv_s1_y_1, 1) = (pw_conv.stencil(1, pw_conv_s1_x_1, pw_conv_s1_y_1, 1) + (dw_conv.stencil(pw_conv_s1_x_1, pw_conv_s1_y_1, 1)*(int16)3))
auto hcompute_pw_conv_stencil_5 = pw_conv_s1_x_1->add_op("op_hcompute_pw_conv_stencil_5");
hcompute_pw_conv_stencil_5->add_function("hcompute_pw_conv_stencil_5");
hcompute_pw_conv_stencil_5->add_load("dw_conv_stencil", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
hcompute_pw_conv_stencil_5->add_load("pw_conv_stencil", "1", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
hcompute_pw_conv_stencil_5->add_store("pw_conv_stencil", "1", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
//store is: pw_conv.stencil(2, pw_conv_s1_x_1, pw_conv_s1_y_1, 1) = (pw_conv.stencil(2, pw_conv_s1_x_1, pw_conv_s1_y_1, 1) + (dw_conv.stencil(pw_conv_s1_x_1, pw_conv_s1_y_1, 1)*(int16)3))
auto hcompute_pw_conv_stencil_6 = pw_conv_s1_x_1->add_op("op_hcompute_pw_conv_stencil_6");
hcompute_pw_conv_stencil_6->add_function("hcompute_pw_conv_stencil_6");
hcompute_pw_conv_stencil_6->add_load("dw_conv_stencil", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
hcompute_pw_conv_stencil_6->add_load("pw_conv_stencil", "2", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
hcompute_pw_conv_stencil_6->add_store("pw_conv_stencil", "2", "pw_conv_s1_x_1", "pw_conv_s1_y_1", "1");
auto pw_conv_s1_y_2 = prg.add_loop("pw_conv_s1_y_2", 0, 16);
auto pw_conv_s1_x_2 = pw_conv_s1_y_2->add_loop("pw_conv_s1_x_2", 0, 16);
//store is: pw_conv.stencil(0, pw_conv_s1_x_2, pw_conv_s1_y_2, 2) = (pw_conv.stencil(0, pw_conv_s1_x_2, pw_conv_s1_y_2, 2) + (dw_conv.stencil(pw_conv_s1_x_2, pw_conv_s1_y_2, 2)*(int16)3))
auto hcompute_pw_conv_stencil_7 = pw_conv_s1_x_2->add_op("op_hcompute_pw_conv_stencil_7");
hcompute_pw_conv_stencil_7->add_function("hcompute_pw_conv_stencil_7");
hcompute_pw_conv_stencil_7->add_load("dw_conv_stencil", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
hcompute_pw_conv_stencil_7->add_load("pw_conv_stencil", "0", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
hcompute_pw_conv_stencil_7->add_store("pw_conv_stencil", "0", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
//store is: pw_conv.stencil(1, pw_conv_s1_x_2, pw_conv_s1_y_2, 2) = (pw_conv.stencil(1, pw_conv_s1_x_2, pw_conv_s1_y_2, 2) + (dw_conv.stencil(pw_conv_s1_x_2, pw_conv_s1_y_2, 2)*(int16)3))
auto hcompute_pw_conv_stencil_8 = pw_conv_s1_x_2->add_op("op_hcompute_pw_conv_stencil_8");
hcompute_pw_conv_stencil_8->add_function("hcompute_pw_conv_stencil_8");
hcompute_pw_conv_stencil_8->add_load("dw_conv_stencil", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
hcompute_pw_conv_stencil_8->add_load("pw_conv_stencil", "1", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
hcompute_pw_conv_stencil_8->add_store("pw_conv_stencil", "1", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
//store is: pw_conv.stencil(2, pw_conv_s1_x_2, pw_conv_s1_y_2, 2) = (pw_conv.stencil(2, pw_conv_s1_x_2, pw_conv_s1_y_2, 2) + (dw_conv.stencil(pw_conv_s1_x_2, pw_conv_s1_y_2, 2)*(int16)3))
auto hcompute_pw_conv_stencil_9 = pw_conv_s1_x_2->add_op("op_hcompute_pw_conv_stencil_9");
hcompute_pw_conv_stencil_9->add_function("hcompute_pw_conv_stencil_9");
hcompute_pw_conv_stencil_9->add_load("dw_conv_stencil", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
hcompute_pw_conv_stencil_9->add_load("pw_conv_stencil", "2", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
hcompute_pw_conv_stencil_9->add_store("pw_conv_stencil", "2", "pw_conv_s1_x_2", "pw_conv_s1_y_2", "2");
auto pw_conv_s1_y_3 = prg.add_loop("pw_conv_s1_y_3", 0, 16);
auto pw_conv_s1_x_3 = pw_conv_s1_y_3->add_loop("pw_conv_s1_x_3", 0, 16);
//store is: pw_conv.stencil(0, pw_conv_s1_x_3, pw_conv_s1_y_3, 3) = (pw_conv.stencil(0, pw_conv_s1_x_3, pw_conv_s1_y_3, 3) + (dw_conv.stencil(pw_conv_s1_x_3, pw_conv_s1_y_3, 3)*(int16)3))
auto hcompute_pw_conv_stencil_10 = pw_conv_s1_x_3->add_op("op_hcompute_pw_conv_stencil_10");
hcompute_pw_conv_stencil_10->add_function("hcompute_pw_conv_stencil_10");
hcompute_pw_conv_stencil_10->add_load("dw_conv_stencil", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
hcompute_pw_conv_stencil_10->add_load("pw_conv_stencil", "0", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
hcompute_pw_conv_stencil_10->add_store("pw_conv_stencil", "0", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
//store is: pw_conv.stencil(1, pw_conv_s1_x_3, pw_conv_s1_y_3, 3) = (pw_conv.stencil(1, pw_conv_s1_x_3, pw_conv_s1_y_3, 3) + (dw_conv.stencil(pw_conv_s1_x_3, pw_conv_s1_y_3, 3)*(int16)3))
auto hcompute_pw_conv_stencil_11 = pw_conv_s1_x_3->add_op("op_hcompute_pw_conv_stencil_11");
hcompute_pw_conv_stencil_11->add_function("hcompute_pw_conv_stencil_11");
hcompute_pw_conv_stencil_11->add_load("dw_conv_stencil", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
hcompute_pw_conv_stencil_11->add_load("pw_conv_stencil", "1", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
hcompute_pw_conv_stencil_11->add_store("pw_conv_stencil", "1", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
//store is: pw_conv.stencil(2, pw_conv_s1_x_3, pw_conv_s1_y_3, 3) = (pw_conv.stencil(2, pw_conv_s1_x_3, pw_conv_s1_y_3, 3) + (dw_conv.stencil(pw_conv_s1_x_3, pw_conv_s1_y_3, 3)*(int16)3))
auto hcompute_pw_conv_stencil_12 = pw_conv_s1_x_3->add_op("op_hcompute_pw_conv_stencil_12");
hcompute_pw_conv_stencil_12->add_function("hcompute_pw_conv_stencil_12");
hcompute_pw_conv_stencil_12->add_load("dw_conv_stencil", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
hcompute_pw_conv_stencil_12->add_load("pw_conv_stencil", "2", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
hcompute_pw_conv_stencil_12->add_store("pw_conv_stencil", "2", "pw_conv_s1_x_3", "pw_conv_s1_y_3", "3");
//consuming pw_conv.stencil
////producing pw_conv_reduction.stencil
auto pw_conv_reduction_s0_y = prg.add_loop("pw_conv_reduction_s0_y", 0, 16);
auto pw_conv_reduction_s0_x = pw_conv_reduction_s0_y->add_loop("pw_conv_reduction_s0_x", 0, 16);
auto pw_conv_reduction_s0_k = pw_conv_reduction_s0_x->add_loop("pw_conv_reduction_s0_k", 0, 3);
//store is: pw_conv_reduction.stencil(pw_conv_reduction_s0_k, pw_conv_reduction_s0_x, pw_conv_reduction_s0_y) = (int16)0
auto hcompute_pw_conv_reduction_stencil = pw_conv_reduction_s0_k->add_op("op_hcompute_pw_conv_reduction_stencil");
hcompute_pw_conv_reduction_stencil->add_function("hcompute_pw_conv_reduction_stencil");
prg.buffer_port_widths["pw_conv_reduction_stencil"] = 16;
hcompute_pw_conv_reduction_stencil->add_store("pw_conv_reduction_stencil", "pw_conv_reduction_s0_k", "pw_conv_reduction_s0_x", "pw_conv_reduction_s0_y");
auto pw_conv_reduction_s1_r_pw_x = prg.add_loop("pw_conv_reduction_s1_r_pw_x", 0, 4);
auto pw_conv_reduction_s1_y = pw_conv_reduction_s1_r_pw_x->add_loop("pw_conv_reduction_s1_y", 0, 16);
auto pw_conv_reduction_s1_x = pw_conv_reduction_s1_y->add_loop("pw_conv_reduction_s1_x", 0, 16);
//store is: pw_conv_reduction.stencil(0, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y) = (pw_conv_reduction.stencil(0, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y) + pw_conv.stencil(0, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y, pw_conv_reduction_s1_r_pw_x))
auto hcompute_pw_conv_reduction_stencil_1 = pw_conv_reduction_s1_x->add_op("op_hcompute_pw_conv_reduction_stencil_1");
hcompute_pw_conv_reduction_stencil_1->add_function("hcompute_pw_conv_reduction_stencil_1");
hcompute_pw_conv_reduction_stencil_1->add_load("pw_conv_stencil", "0", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y", "pw_conv_reduction_s1_r_pw_x");
hcompute_pw_conv_reduction_stencil_1->add_load("pw_conv_reduction_stencil", "0", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y");
hcompute_pw_conv_reduction_stencil_1->add_store("pw_conv_reduction_stencil", "0", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y");
//store is: pw_conv_reduction.stencil(1, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y) = (pw_conv_reduction.stencil(1, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y) + pw_conv.stencil(1, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y, pw_conv_reduction_s1_r_pw_x))
auto hcompute_pw_conv_reduction_stencil_2 = pw_conv_reduction_s1_x->add_op("op_hcompute_pw_conv_reduction_stencil_2");
hcompute_pw_conv_reduction_stencil_2->add_function("hcompute_pw_conv_reduction_stencil_2");
hcompute_pw_conv_reduction_stencil_2->add_load("pw_conv_stencil", "1", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y", "pw_conv_reduction_s1_r_pw_x");
hcompute_pw_conv_reduction_stencil_2->add_load("pw_conv_reduction_stencil", "1", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y");
hcompute_pw_conv_reduction_stencil_2->add_store("pw_conv_reduction_stencil", "1", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y");
//store is: pw_conv_reduction.stencil(2, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y) = (pw_conv_reduction.stencil(2, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y) + pw_conv.stencil(2, pw_conv_reduction_s1_x, pw_conv_reduction_s1_y, pw_conv_reduction_s1_r_pw_x))
auto hcompute_pw_conv_reduction_stencil_3 = pw_conv_reduction_s1_x->add_op("op_hcompute_pw_conv_reduction_stencil_3");
hcompute_pw_conv_reduction_stencil_3->add_function("hcompute_pw_conv_reduction_stencil_3");
hcompute_pw_conv_reduction_stencil_3->add_load("pw_conv_stencil", "2", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y", "pw_conv_reduction_s1_r_pw_x");
hcompute_pw_conv_reduction_stencil_3->add_load("pw_conv_reduction_stencil", "2", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y");
hcompute_pw_conv_reduction_stencil_3->add_store("pw_conv_reduction_stencil", "2", "pw_conv_reduction_s1_x", "pw_conv_reduction_s1_y");
//consuming pw_conv_reduction.stencil
auto hw_output_s0_k = prg.add_loop("hw_output_s0_k", 0, 3);
auto hw_output_s0_y_yi = hw_output_s0_k->add_loop("hw_output_s0_y_yi", 0, 16);
auto hw_output_s0_x_xi = hw_output_s0_y_yi->add_loop("hw_output_s0_x_xi", 0, 16);
//store is: hw_output.stencil(hw_output_s0_x_xi, hw_output_s0_y_yi, hw_output_s0_k) = uint8(max(pw_conv_reduction.stencil(hw_output_s0_k, hw_output_s0_x_xi, hw_output_s0_y_yi), (int16)0))
auto hcompute_hw_output_stencil = hw_output_s0_x_xi->add_op("op_hcompute_hw_output_stencil");
hcompute_hw_output_stencil->add_function("hcompute_hw_output_stencil");
hcompute_hw_output_stencil->add_load("pw_conv_reduction_stencil", "hw_output_s0_k", "hw_output_s0_x_xi", "hw_output_s0_y_yi");
hcompute_hw_output_stencil->add_store("hw_output_stencil", "hw_output_s0_x_xi", "hw_output_s0_y_yi", "hw_output_s0_k");
return prg;
}