blob: dd9c17e0772d1169b49eafde40af54a956e58075 [file] [log] [blame]
XNNPACK Teamb455b122019-09-27 18:10:33 -07001// Copyright 2019 Google LLC
2//
3// This source code is licensed under the BSD-style license found in the
4// LICENSE file in the root directory of this source tree.
5
6#include <gtest/gtest.h>
7
Marat Dukhan1dadbf72019-10-01 10:46:20 -07008#include <xnnpack/common.h>
XNNPACK Teamb455b122019-09-27 18:10:33 -07009#include <xnnpack/isa-checks.h>
XNNPACK Teamb455b122019-09-27 18:10:33 -070010
Marat Dukhan1dadbf72019-10-01 10:46:20 -070011#include <xnnpack/unpool.h>
XNNPACK Teamb455b122019-09-27 18:10:33 -070012#include "unpool-microkernel-tester.h"
13
14
Marat Dukhan1dadbf72019-10-01 10:46:20 -070015#if !XNN_ARCH_WASM && !XNN_ARCH_ASMJS
XNNPACK Teamb455b122019-09-27 18:10:33 -070016 TEST(X32_UNPOOL__PSIMD, c_eq_4) {
17 TEST_REQUIRES_PSIMD;
18 UnpoolMicrokernelTester()
19 .p(10)
20 .c(4)
21 .Test(xnn_x32_unpool_ukernel__psimd);
22 }
23
24 TEST(X32_UNPOOL__PSIMD, c_div_4) {
25 TEST_REQUIRES_PSIMD;
26 for (size_t c = 8; c < 32; c += 4) {
27 UnpoolMicrokernelTester()
28 .p(10)
29 .c(c)
30 .Test(xnn_x32_unpool_ukernel__psimd);
31 }
32 }
33
34 TEST(X32_UNPOOL__PSIMD, c_lt_4) {
35 TEST_REQUIRES_PSIMD;
36 for (size_t c = 1; c < 4; c++) {
37 UnpoolMicrokernelTester()
38 .p(10)
39 .c(c)
40 .Test(xnn_x32_unpool_ukernel__psimd);
41 }
42 }
43
44 TEST(X32_UNPOOL__PSIMD, c_gt_4) {
45 TEST_REQUIRES_PSIMD;
46 for (size_t c = 5; c < 8; c++) {
47 UnpoolMicrokernelTester()
48 .p(10)
49 .c(4)
50 .Test(xnn_x32_unpool_ukernel__psimd);
51 }
52 }
53
54 TEST(X32_UNPOOL__PSIMD, varying_p) {
55 TEST_REQUIRES_PSIMD;
56 for (size_t p = 1; p < 20; p += 3) {
57 for (size_t c = 1; c < 32; c += 5) {
58 UnpoolMicrokernelTester()
59 .p(p)
60 .c(c)
61 .Test(xnn_x32_unpool_ukernel__psimd);
62 }
63 }
64 }
65
66 TEST(X32_UNPOOL__PSIMD, varying_f) {
67 TEST_REQUIRES_PSIMD;
68 for (size_t c = 1; c < 32; c += 5) {
69 UnpoolMicrokernelTester()
70 .p(10)
71 .c(c)
72 .f(0xDEADBEAF)
73 .Test(xnn_x32_unpool_ukernel__psimd);
74 }
75 }
76
77 TEST(X32_UNPOOL__PSIMD, y_stride) {
78 TEST_REQUIRES_PSIMD;
79 for (size_t c = 1; c < 32; c += 5) {
80 UnpoolMicrokernelTester()
81 .p(10)
82 .c(c)
83 .y_stride(c * 2 + 7)
84 .Test(xnn_x32_unpool_ukernel__psimd);
85 }
86 }
Marat Dukhan1dadbf72019-10-01 10:46:20 -070087#endif // !XNN_ARCH_WASM && !XNN_ARCH_ASMJS
XNNPACK Teamb455b122019-09-27 18:10:33 -070088
89
90TEST(X32_UNPOOL__SCALAR, c_eq_1) {
91 UnpoolMicrokernelTester()
92 .p(10)
93 .c(1)
94 .Test(xnn_x32_unpool_ukernel__scalar);
95}
96
97TEST(X32_UNPOOL__SCALAR, c_gt_1) {
98 for (size_t c = 2; c < 16; c++) {
99 UnpoolMicrokernelTester()
100 .p(10)
101 .c(c)
102 .Test(xnn_x32_unpool_ukernel__scalar);
103 }
104}
105
106TEST(X32_UNPOOL__SCALAR, varying_p) {
107 for (size_t p = 1; p < 20; p += 3) {
108 for (size_t c = 1; c < 16; c += 3) {
109 UnpoolMicrokernelTester()
110 .p(p)
111 .c(c)
112 .Test(xnn_x32_unpool_ukernel__scalar);
113 }
114 }
115}
116
117TEST(X32_UNPOOL__SCALAR, varying_f) {
118 for (size_t c = 1; c < 16; c += 3) {
119 UnpoolMicrokernelTester()
120 .p(10)
121 .c(c)
122 .f(0xDEADBEAF)
123 .Test(xnn_x32_unpool_ukernel__scalar);
124 }
125}
126
127TEST(X32_UNPOOL__SCALAR, y_stride) {
128 for (size_t c = 1; c < 16; c += 3) {
129 UnpoolMicrokernelTester()
130 .p(10)
131 .c(c)
132 .y_stride(c * 2 + 7)
133 .Test(xnn_x32_unpool_ukernel__scalar);
134 }
135}