driver.cpp 17.7 KB
Newer Older
Chao Liu's avatar
Chao Liu committed
1
#include <iostream>
Chao Liu's avatar
Chao Liu committed
2
3
#include <numeric>
#include <initializer_list>
Chao Liu's avatar
Chao Liu committed
4
#include <cstdlib>
Chao Liu's avatar
Chao Liu committed
5
#include <stdlib.h>
Chao Liu's avatar
Chao Liu committed
6
7
8
#include "config.hpp"
#include "ConstantTensorDescriptor.hpp"
#include "device.hpp"
Chao Liu's avatar
Chao Liu committed
9
#include "conv_common.hpp"
10
#include "host_conv.hpp"
Chao Liu's avatar
Chao Liu committed
11
#include "device_convolution_direct_v2_nchw_kcyx_nkhw.hpp"
Chao Liu's avatar
Chao Liu committed
12
#include "device_convolution_implicit_gemm_v1_chwn_cyxk_khwn.hpp"
13
#include "device_convolution_implicit_gemm_v1_chwn_cyxk_khwn_padded.hpp"
14
15
16
//#include "device_convolution_implicit_gemm_v1_nchw_cyxk_nkhw.hpp"
//#include "device_convolution_implicit_gemm_v2_chwn_cyxk_khwn.hpp"
//#include "device_convolution_implicit_gemm_v3_nchw_cyxk_nkhw.hpp"
Chao Liu's avatar
Chao Liu committed
17
#include "device_convolution_implicit_gemm_v4r1_nchw_kcyx_nkhw.hpp"
Chao Liu's avatar
Chao Liu committed
18
#include "device_convolution_implicit_gemm_v4r1_nchw_kcyx_nkhw_padded.hpp"
19
20
//#include "device_convolution_implicit_gemm_v4r2_nchw_kcyx_nkhw.hpp"
//#include "device_convolution_implicit_gemm_v4r3_nchw_kcyx_nkhw.hpp"
21
#include "device_convolution_implicit_gemm_v4r4_nchw_kcyx_nkhw.hpp"
22

Chao Liu's avatar
Chao Liu committed
23
struct GeneratorTensor_1
Chao Liu's avatar
Chao Liu committed
24
25
{
    template <class... Is>
Chao Liu's avatar
Chao Liu committed
26
    double operator()(Is... is)
Chao Liu's avatar
Chao Liu committed
27
    {
Chao Liu's avatar
Chao Liu committed
28
        return 1;
Chao Liu's avatar
Chao Liu committed
29
30
31
    }
};

Chao Liu's avatar
Chao Liu committed
32
33
34
35
36
37
38
39
40
41
42
43
struct GeneratorTensor_2
{
    int min_value = 0;
    int max_value = 1;

    template <class... Is>
    double operator()(Is...)
    {
        return (std::rand() % (max_value - min_value)) + min_value;
    }
};

44
45
46
47
48
49
50
struct GeneratorTensor_3
{
    template <class... Is>
    double operator()(Is... is)
    {
        std::array<index_t, sizeof...(Is)> dims = {{static_cast<index_t>(is)...}};

51
        auto f_acc = [](auto a, auto b) { return 100 * a + b; };
52

53
        return std::accumulate(dims.begin(), dims.end(), index_t(0), f_acc);
54
55
56
    }
};

Chao Liu's avatar
Chao Liu committed
57
58
59
60
61
struct GeneratorTensor_Checkboard
{
    template <class... Ts>
    double operator()(Ts... Xs) const
    {
Chao Liu's avatar
Chao Liu committed
62
        std::array<index_t, sizeof...(Ts)> dims = {{Xs...}};
Chao Liu's avatar
Chao Liu committed
63
64
65
        return std::accumulate(dims.begin(),
                               dims.end(),
                               true,
Chao Liu's avatar
Chao Liu committed
66
                               [](bool init, index_t x) -> int { return init != (x % 2); })
Chao Liu's avatar
Chao Liu committed
67
68
69
70
71
                   ? 1
                   : -1;
    }
};

Chao Liu's avatar
Chao Liu committed
72
int main(int argc, char* argv[])
Chao Liu's avatar
Chao Liu committed
73
{
Chao Liu's avatar
Chao Liu committed
74
75
    using namespace ck;

Chao Liu's avatar
Chao Liu committed
76
#if 0
Chao Liu's avatar
Chao Liu committed
77
78
    constexpr index_t N  = 32;
    constexpr index_t C  = 8;
Chao Liu's avatar
Chao Liu committed
79
80
    constexpr index_t HI = 1;
    constexpr index_t WI = 1;
Chao Liu's avatar
Chao Liu committed
81
    constexpr index_t K  = 128;
Chao Liu's avatar
Chao Liu committed
82
83
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;
Chao Liu's avatar
Chao Liu committed
84
85
86

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;
Chao Liu's avatar
Chao Liu committed
87

Chao Liu's avatar
Chao Liu committed
88
89
    using LeftPads  = Sequence<1, 1>;
    using RightPads = Sequence<0, 0>;
Chao Liu's avatar
Chao Liu committed
90
#elif 1
91
    // 3x3, 34x34
Chao Liu's avatar
Chao Liu committed
92
    constexpr index_t N  = 64;
93
    constexpr index_t C  = 256;
Chao Liu's avatar
Chao Liu committed
94
95
    constexpr index_t HI = 34;
    constexpr index_t WI = 34;
96
97
98
    constexpr index_t K  = 128;
    constexpr index_t Y  = 3;
    constexpr index_t X  = 3;
Chao Liu's avatar
Chao Liu committed
99

Chao Liu's avatar
Chao Liu committed
100
    using ConvStrides   = Sequence<1, 1>;
101
102
    using ConvDilations = Sequence<1, 1>;

Chao Liu's avatar
Chao Liu committed
103
104
    using LeftPads  = Sequence<0, 0>;
    using RightPads = Sequence<0, 0>;
Chao Liu's avatar
Chao Liu committed
105
#elif 0
Chao Liu's avatar
Chao Liu committed
106
    // 1x1 filter, 8x8 image
Chao Liu's avatar
Chao Liu committed
107
    // cudnn@V100 68%, ck@V100 72%, ck@P100 52%, ck@VII 42%
Chao Liu's avatar
Chao Liu committed
108
109
110
111
112
113
114
115
116
117
118
119
120
    constexpr index_t N  = 64;
    constexpr index_t C  = 1536;
    constexpr index_t HI = 8;
    constexpr index_t WI = 8;
    constexpr index_t K  = 256;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
121
#elif 0
Chao Liu's avatar
Chao Liu committed
122
    // 1x1 filter, 8x8 image
Chao Liu's avatar
Chao Liu committed
123
    // cudnn@V100 77%, ck@V100 76%, ck@P100 79%, ck@VII 51%
Chao Liu's avatar
Chao Liu committed
124
125
126
127
128
129
130
131
132
133
134
135
136
    constexpr index_t N  = 128;
    constexpr index_t C  = 2048;
    constexpr index_t HI = 8;
    constexpr index_t WI = 8;
    constexpr index_t K  = 384;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
137
#elif 0
Chao Liu's avatar
Chao Liu committed
138
    // 1x1 filter, 7x7 image
Chao Liu's avatar
Chao Liu committed
139
    // cudnn@V100 82%, ck@V100 76%, ck@P100 67%, ck@VII 64%
Chao Liu's avatar
Chao Liu committed
140
141
142
143
144
145
146
147
148
149
150
151
152
    constexpr index_t N  = 128;
    constexpr index_t C  = 832;
    constexpr index_t HI = 7;
    constexpr index_t WI = 7;
    constexpr index_t K  = 384;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
153
#elif 0
Chao Liu's avatar
Chao Liu committed
154
    // 1x1 filter, 8x8 image
Chao Liu's avatar
Chao Liu committed
155
    // cudnn@V100 83%, ck@V100 75%, ck@P100 78%, ck@VII 65%
Chao Liu's avatar
Chao Liu committed
156
157
158
159
160
161
162
163
164
165
166
167
168
    constexpr index_t N  = 128;
    constexpr index_t C  = 1280;
    constexpr index_t HI = 8;
    constexpr index_t WI = 8;
    constexpr index_t K  = 384;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
169
#elif 0
Chao Liu's avatar
Chao Liu committed
170
    // 1x1 filter, 14x14 image
Chao Liu's avatar
Chao Liu committed
171
    // cudnn@V100 62%, ck@V100 68%, ck@P100 70%, ck@VII 50%
Chao Liu's avatar
Chao Liu committed
172
173
174
175
176
177
178
179
180
181
182
183
184
    constexpr index_t N  = 128;
    constexpr index_t C  = 512;
    constexpr index_t HI = 14;
    constexpr index_t WI = 14;
    constexpr index_t K  = 128;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
185
#elif 0
Chao Liu's avatar
Chao Liu committed
186
    // 1x1 filter, 8x8 image
Chao Liu's avatar
Chao Liu committed
187
    // cudnn@V100 74%, ck@V100 57%, ck@P100 78%, ck@VII 61%
Chao Liu's avatar
Chao Liu committed
188
189
190
191
192
193
194
195
196
197
198
199
200
    constexpr index_t N  = 64;
    constexpr index_t C  = 1536;
    constexpr index_t HI = 8;
    constexpr index_t WI = 8;
    constexpr index_t K  = 384;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
201
#elif 0
Chao Liu's avatar
Chao Liu committed
202
    // 1x1 filter, 28x28 image
Chao Liu's avatar
Chao Liu committed
203
    // cudnn@V100 86%, ck@V100 84%, ck@P100 80%, ck@VII 69%
Chao Liu's avatar
Chao Liu committed
204
205
206
207
208
209
210
211
212
213
214
215
216
    constexpr index_t N  = 128;
    constexpr index_t C  = 256;
    constexpr index_t HI = 28;
    constexpr index_t WI = 28;
    constexpr index_t K  = 128;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
217
#elif 0
Chao Liu's avatar
Chao Liu committed
218
    // 1x1 filter, 7x7 image
Chao Liu's avatar
Chao Liu committed
219
    // cudnn@V100 71%, ck@V100 55%, ck@P100 70%, ck@VII 62%
Chao Liu's avatar
Chao Liu committed
220
221
222
223
224
225
226
227
228
229
230
231
232
    constexpr index_t N  = 128;
    constexpr index_t C  = 832;
    constexpr index_t HI = 7;
    constexpr index_t WI = 7;
    constexpr index_t K  = 256;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
233
#elif 0
Chao Liu's avatar
Chao Liu committed
234
    // 3x3 filter, 2x2 stride, 35x35 input, 17x17 output
Chao Liu's avatar
Chao Liu committed
235
    // cudnn@V100 90%, ck@V100 93%, ck@P100 83%, ck@VII 81%
Chao Liu's avatar
Chao Liu committed
236
237
238
239
240
241
242
243
244
245
246
247
248
    constexpr index_t N  = 128;
    constexpr index_t C  = 288;
    constexpr index_t HI = 35;
    constexpr index_t WI = 35;
    constexpr index_t K  = 384;
    constexpr index_t Y  = 3;
    constexpr index_t X  = 3;

    using ConvStrides   = Sequence<2, 2>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
249
#elif 1
Chao Liu's avatar
Chao Liu committed
250
    // 1x1 filter, 17x17 input
Chao Liu's avatar
Chao Liu committed
251
    // cudnn@V100 81%, ck@V100 76%, ck@P100 70%, ck@VII 76%
Chao Liu's avatar
Chao Liu committed
252
253
254
255
256
257
258
259
260
261
262
263
264
    constexpr index_t N  = 128;
    constexpr index_t C  = 768;
    constexpr index_t HI = 17;
    constexpr index_t WI = 17;
    constexpr index_t K  = 128;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
265
#elif 0
Chao Liu's avatar
Chao Liu committed
266
    // 1x1 filter, 14x14 image
Chao Liu's avatar
Chao Liu committed
267
    // cudnn@V100 73%, ck@V100 71%, ck@P100 70%, ck@VII 64%
Chao Liu's avatar
Chao Liu committed
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
    constexpr index_t N  = 128;
    constexpr index_t C  = 528;
    constexpr index_t HI = 14;
    constexpr index_t WI = 14;
    constexpr index_t K  = 128;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
#elif 0
    // 1x1 filter, 14x14 image
Chao Liu's avatar
Chao Liu committed
283
    // cudnn@V100 73%, ck@V100 72%, ck@P100 79%, ck@VII 75%
Chao Liu's avatar
Chao Liu committed
284
285
286
287
288
289
290
291
292
293
294
295
296
    constexpr index_t N  = 128;
    constexpr index_t C  = 528;
    constexpr index_t HI = 14;
    constexpr index_t WI = 14;
    constexpr index_t K  = 256;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
297
#elif 0
Chao Liu's avatar
Chao Liu committed
298
    // 1x1 filter, 7x7 image
Chao Liu's avatar
Chao Liu committed
299
    // cudnn@V100 49%, ck@V100 50%, ck@P100 61%, ck@VII 52%
Chao Liu's avatar
Chao Liu committed
300
301
302
303
    constexpr index_t N  = 128;
    constexpr index_t C  = 832;
    constexpr index_t HI = 7;
    constexpr index_t WI = 7;
Chao Liu's avatar
Chao Liu committed
304
305
306
    constexpr index_t K  = 128;
    constexpr index_t Y  = 1;
    constexpr index_t X  = 1;
Chao Liu's avatar
Chao Liu committed
307
308
309
310

    using ConvStrides   = Sequence<1, 1>;
    using ConvDilations = Sequence<1, 1>;

Chao Liu's avatar
Chao Liu committed
311
312
    constexpr index_t HPad = 0;
    constexpr index_t WPad = 0;
Chao Liu's avatar
Chao Liu committed
313
#endif
Chao Liu's avatar
Chao Liu committed
314

Chao Liu's avatar
Chao Liu committed
315
316
    auto in_nchw_desc  = make_ConstantTensorDescriptor_packed(Sequence<N, C, HI, WI>{});
    auto wei_kcyx_desc = make_ConstantTensorDescriptor_packed(Sequence<K, C, Y, X>{});
317
    auto out_nkhw_desc = get_convolution_with_padding_output_default_4d_tensor_descriptor(
Chao Liu's avatar
Chao Liu committed
318
        in_nchw_desc, wei_kcyx_desc, ConvStrides{}, ConvDilations{}, LeftPads{}, RightPads{});
Chao Liu's avatar
Chao Liu committed
319

Chao Liu's avatar
Chao Liu committed
320
    ostream_ConstantTensorDescriptor(in_nchw_desc, std::cout << "in_nchw_desc: ");
Chao Liu's avatar
Chao Liu committed
321
    ostream_ConstantTensorDescriptor(wei_kcyx_desc, std::cout << "wei_kcyx_desc: ");
Chao Liu's avatar
Chao Liu committed
322
    ostream_ConstantTensorDescriptor(out_nkhw_desc, std::cout << "out_nkhw_desc: ");
Chao Liu's avatar
Chao Liu committed
323

Chao Liu's avatar
Chao Liu committed
324
325
    using in_data_t  = float;
    using out_data_t = float;
326
327
328
329
    Tensor<in_data_t> in_nchw(make_TensorDescriptor(in_nchw_desc));
    Tensor<in_data_t> wei_kcyx(make_TensorDescriptor(wei_kcyx_desc));
    Tensor<out_data_t> out_nkhw_host(make_TensorDescriptor(out_nkhw_desc));
    Tensor<out_data_t> out_nkhw_device(make_TensorDescriptor(out_nkhw_desc));
Chao Liu's avatar
Chao Liu committed
330

Chao Liu's avatar
Chao Liu committed
331
    std::size_t num_thread = std::thread::hardware_concurrency();
Chao Liu's avatar
Chao Liu committed
332

Chao Liu's avatar
Chao Liu committed
333
334
335
336
337
338
339
    if(argc != 3)
    {
        printf("arg1: do_verification, arg2: nrepeat\n");
        exit(1);
    }

    bool do_verification = atoi(argv[1]);
Chao Liu's avatar
Chao Liu committed
340
    index_t nrepeat      = atoi(argv[2]);
341
342
343

    if(do_verification)
    {
Chao Liu's avatar
Chao Liu committed
344
#if 0
345
        in_nchw.GenerateTensorValue(GeneratorTensor_1{}, num_thread);
Chao Liu's avatar
Chao Liu committed
346
        wei_kcyx.GenerateTensorValue(GeneratorTensor_1{}, num_thread);
Chao Liu's avatar
Chao Liu committed
347
348
349
#elif 0
        in_nchw.GenerateTensorValue(GeneratorTensor_1{}, num_thread);
        wei_kcyx.GenerateTensorValue(GeneratorTensor_2{-5, 5}, num_thread);
350
351
352
#elif 0
        in_nchw.GenerateTensorValue(GeneratorTensor_3{}, num_thread);
        wei_kcyx.GenerateTensorValue(GeneratorTensor_1{}, num_thread);
Chao Liu's avatar
Chao Liu committed
353
#elif 1
354
        in_nchw.GenerateTensorValue(GeneratorTensor_2{-5, 5}, num_thread);
Chao Liu's avatar
Chao Liu committed
355
        wei_kcyx.GenerateTensorValue(GeneratorTensor_2{-5, 5}, num_thread);
Chao Liu's avatar
Chao Liu committed
356
#elif 0
357
358
359
360
361
362
        in_nchw.GenerateTensorValue(GeneratorTensor_2{1, 5}, num_thread);

        auto gen_wei = [](auto... is) {
            return GeneratorTensor_2{1, 5}(is...) * GeneratorTensor_Checkboard{}(is...);
        };
        wei_kcyx.GenerateTensorValue(gen_wei, num_thread);
Chao Liu's avatar
Chao Liu committed
363
#endif
364
    }
Chao Liu's avatar
Chao Liu committed
365

Chao Liu's avatar
Chao Liu committed
366
#if 0
Chao Liu's avatar
Chao Liu committed
367
    device_convolution_direct_v2_nchw_kcyx_nkhw
Chao Liu's avatar
Chao Liu committed
368
        (in_nchw_desc, in_nchw, wei_kcyx_desc, wei_kcyx, out_nkhw_desc, out_nkhw_device, nrepeat);
Chao Liu's avatar
Chao Liu committed
369
#elif 0
Chao Liu's avatar
Chao Liu committed
370
    device_convolution_implicit_gemm_v1_chwn_cyxk_khwn(
Chao Liu's avatar
Chao Liu committed
371
        in_nchw_desc, in_nchw, wei_kcyx_desc, wei_kcyx, out_nkhw_desc, out_nkhw_device, nrepeat);
Chao Liu's avatar
Chao Liu committed
372
#elif 0
373
374
375
376
377
378
    device_convolution_implicit_gemm_v1_chwn_cyxk_khwn_padded(in_nchw_desc,
                                                              in_nchw,
                                                              wei_kcyx_desc,
                                                              wei_kcyx,
                                                              out_nkhw_desc,
                                                              out_nkhw_device,
Chao Liu's avatar
Chao Liu committed
379
380
                                                              LeftPads{},
                                                              RightPads{},
381
                                                              nrepeat);
Chao Liu's avatar
Chao Liu committed
382
#elif 0
Chao Liu's avatar
Chao Liu committed
383
    device_convolution_implicit_gemm_v1_nchw_cyxk_nkhw(
Chao Liu's avatar
Chao Liu committed
384
        in_nchw_desc, in_nchw, wei_kcyx_desc, wei_kcyx, out_nkhw_desc, out_nkhw_device, nrepeat);
385
#elif 0
Chao Liu's avatar
Chao Liu committed
386
    device_convolution_implicit_gemm_v2_chwn_cyxk_khwn(
Chao Liu's avatar
Chao Liu committed
387
        in_nchw_desc, in_nchw, wei_kcyx_desc, wei_kcyx, out_nkhw_desc, out_nkhw_device, nrepeat);
Chao Liu's avatar
Chao Liu committed
388
#elif 0
Chao Liu's avatar
Chao Liu committed
389
    device_convolution_implicit_gemm_v3_nchw_cyxk_nkhw(
Chao Liu's avatar
Chao Liu committed
390
        (in_nchw_desc, in_nchw, wei_kcyx_desc, wei_kcyx, out_nkhw_desc, out_nkhw_device, nrepeat);
Chao Liu's avatar
Chao Liu committed
391
#elif 0
Chao Liu's avatar
Chao Liu committed
392
393
394
395
396
397
398
399
400
    device_convolution_implicit_gemm_v4r1_nchw_kcyx_nkhw(in_nchw_desc,
                                                         in_nchw,
                                                         wei_kcyx_desc,
                                                         wei_kcyx,
                                                         out_nkhw_desc,
                                                         out_nkhw_device,
                                                         ConvStrides{},
                                                         ConvDilations{},
                                                         nrepeat);
Chao Liu's avatar
Chao Liu committed
401
#elif 0
Chao Liu's avatar
Chao Liu committed
402
403
404
405
406
407
408
409
410
411
412
    device_convolution_implicit_gemm_v4r1_nchw_kcyx_nkhw_padded(in_nchw_desc,
                                                                in_nchw,
                                                                wei_kcyx_desc,
                                                                wei_kcyx,
                                                                out_nkhw_desc,
                                                                out_nkhw_device,
                                                                ConvStrides{},
                                                                ConvDilations{},
                                                                LeftPads{},
                                                                RightPads{},
                                                                nrepeat);
Chao Liu's avatar
Chao Liu committed
413
#elif 0
Chao Liu's avatar
Chao Liu committed
414
415
416
417
418
419
    device_convolution_implicit_gemm_v4r2_nchw_kcyx_nkhw(in_nchw_desc,
                                                         in_nchw,
                                                         wei_kcyx_desc,
                                                         wei_kcyx,
                                                         out_nkhw_desc,
                                                         out_nkhw_device,
Chao Liu's avatar
Chao Liu committed
420
421
422
                                                         ConvStrides{},
                                                         ConvDilations{},
                                                         nrepeat);
Chao Liu's avatar
Chao Liu committed
423
#elif 0
Chao Liu's avatar
Chao Liu committed
424
425
426
427
428
429
    device_convolution_implicit_gemm_v4r3_nchw_kcyx_nkhw(in_nchw_desc,
                                                         in_nchw,
                                                         wei_kcyx_desc,
                                                         wei_kcyx,
                                                         out_nkhw_desc,
                                                         out_nkhw_device,
Chao Liu's avatar
Chao Liu committed
430
431
432
                                                         ConvStrides{},
                                                         ConvDilations{},
                                                         nrepeat);
Chao Liu's avatar
Chao Liu committed
433
#elif 0
Chao Liu's avatar
Chao Liu committed
434
435
436
437
438
439
    device_convolution_implicit_gemm_v4r4_nchw_kcyx_nkhw(in_nchw_desc,
                                                         in_nchw,
                                                         wei_kcyx_desc,
                                                         wei_kcyx,
                                                         out_nkhw_desc,
                                                         out_nkhw_device,
Chao Liu's avatar
Chao Liu committed
440
441
442
                                                         ConvStrides{},
                                                         ConvDilations{},
                                                         nrepeat);
Chao Liu's avatar
Chao Liu committed
443
444
445
446
447
448
449
450
451
452
453
454
#elif 1
    device_convolution_implicit_gemm_v4r4_nchw_kcyx_nkhw_padded(in_nchw_desc,
                                                                in_nchw,
                                                                wei_kcyx_desc,
                                                                wei_kcyx,
                                                                out_nkhw_desc,
                                                                out_nkhw_device,
                                                                ConvStrides{},
                                                                ConvDilations{},
                                                                LeftPads{},
                                                                RightPads{},
                                                                nrepeat);
455
#endif
Chao Liu's avatar
Chao Liu committed
456

457
    if(do_verification)
458
    {
Chao Liu's avatar
Chao Liu committed
459
#if 1
460
461
        if(Y == 3 && X == 3 && ConvStrides{}[0] == 1 && ConvStrides{}[1] == 1 &&
           ConvDilations{}[0] == 1 && ConvDilations{}[1] == 1)
462
        {
Chao Liu's avatar
Chao Liu committed
463
464
            host_winograd_3x3_convolution(
                in_nchw, wei_kcyx, out_nkhw_host, LeftPads{}, RightPads{});
465
466
        }
        else
Chao Liu's avatar
Chao Liu committed
467
#endif
468
        {
469
470
471
472
473
            host_direct_convolution(in_nchw,
                                    wei_kcyx,
                                    out_nkhw_host,
                                    ConvStrides{},
                                    ConvDilations{},
Chao Liu's avatar
Chao Liu committed
474
475
                                    LeftPads{},
                                    RightPads{});
476
477
        }
        check_error(out_nkhw_host, out_nkhw_device);
Chao Liu's avatar
Chao Liu committed
478

Chao Liu's avatar
Chao Liu committed
479
#if 0
480
        LogRange(std::cout << "in_nchw : ", in_nchw.mData, ",") << std::endl;
Chao Liu's avatar
Chao Liu committed
481
        LogRange(std::cout << "wei_kcyx: ", wei_kcyx.mData, ",") << std::endl;
482
483
        LogRange(std::cout << "out_nkhw_host  : ", out_nkhw_host.mData, ",") << std::endl;
        LogRange(std::cout << "out_nkhw_device: ", out_nkhw_device.mData, ",") << std::endl;
Chao Liu's avatar
Chao Liu committed
484
#endif
485
    }
486
}