@@ -24,6 +24,7 @@ struct coeff_struct_t {
24
24
std::array<std::array<float , 3 >, 3 > c;
25
25
};
26
26
27
+ <<<<<<< HEAD
27
28
struct alignas (64 ) coeff_struct_aligned_t {
28
29
std::array<std::array<float , 3 >, 3 > c;
29
30
};
@@ -39,12 +40,21 @@ template <typename T> constexpr T get_coefficients() {
39
40
40
41
template <> constexpr coeff_t get_coefficients<coeff_t >() {
41
42
return {{{1.0 , 2.0 , 3.0 }, {1.1 , 2.1 , 3.1 }, {1.2 , 2.2 , 3.2 }}};
43
+ =======
44
+ coeff_t get_coefficients () {
45
+ return {{{1.0 , 2.0 , 3.0 }, {1.1 , 2.1 , 3.1 }, {1.2 , 2.2 , 3.2 }}};
46
+ }
47
+
48
+ coeff_struct_t get_coefficient_struct () {
49
+ return {{{{1.0 , 2.0 , 3.0 }, {1.1 , 2.1 , 3.1 }, {1.2 , 2.2 , 3.2 }}}};
50
+ >>>>>>> 6c7a8e6f7 ([SYCL] Add a vector convolution demo of using specialization constants (#747 ))
42
51
}
43
52
44
53
constexpr specialization_id<coeff_t > coeff_id;
45
54
46
55
constexpr specialization_id<coeff_struct_t > coeff_struct_id;
47
56
57
+ <<<<<<< HEAD
48
58
// Represented in the IR as
49
59
// clang-format off
50
60
// { %struct.coeff_struct_aligned_t { %"class.std::array.0" zeroinitializer, [28 x i8] undef } }
@@ -62,6 +72,8 @@ constexpr specialization_id<coeff_struct_aligned_t> coeff_struct_aligned_id;
62
72
// clang-format on
63
73
constexpr specialization_id<coeff_struct_aligned2_t > coeff_struct_aligned_id2;
64
74
75
+ =======
76
+ >>>>>>> 6c7a8e6f7 ([SYCL] Add a vector convolution demo of using specialization constants (#747 ))
65
77
template <typename IN>
66
78
float calc_conv (const coeff_t &coeff, const IN &in, item<2 > item_id) {
67
79
float acc = 0 ;
@@ -90,13 +102,18 @@ void do_conv(buffer<float, 2> in, buffer<float, 2> out, CP coeff_provider) {
90
102
91
103
// Set the coefficient of the convolution as constant.
92
104
// This will build a specific kernel the coefficient available as literals.
105
+ <<<<<<< HEAD
93
106
cgh.set_specialization_constant <coeff_id>(get_coefficients<coeff_t >());
94
107
cgh.set_specialization_constant <coeff_struct_id>(
95
108
get_coefficients<coeff_struct_t >());
96
109
cgh.set_specialization_constant <coeff_struct_aligned_id>(
97
110
get_coefficients<coeff_struct_aligned_t >());
98
111
cgh.set_specialization_constant <coeff_struct_aligned_id2>(
99
112
get_coefficients<coeff_struct_aligned2_t >());
113
+ =======
114
+ cgh.set_specialization_constant <coeff_id>(get_coefficients ());
115
+ cgh.set_specialization_constant <coeff_struct_id>(get_coefficient_struct ());
116
+ >>>>>>> 6c7a8e6f7 ([SYCL] Add a vector convolution demo of using specialization constants (#747 ))
100
117
cgh.parallel_for <KernelName>(
101
118
in.get_range (), [=](item<2 > item_id, kernel_handler h) {
102
119
auto coeff = coeff_provider (h);
@@ -157,6 +174,7 @@ int main() {
157
174
158
175
compare_result (host_accessor{output, read_only}, expected);
159
176
177
+ <<<<<<< HEAD
160
178
do_conv<class Convolution3 >(input, output, [](kernel_handler &h) {
161
179
return h.get_specialization_constant <coeff_struct_aligned_id>().c ;
162
180
});
@@ -169,6 +187,8 @@ int main() {
169
187
170
188
compare_result (host_accessor{output, read_only}, expected);
171
189
190
+ =======
191
+ >>>>>>> 6c7a8e6f7 ([SYCL] Add a vector convolution demo of using specialization constants (#747 ))
172
192
std::cout << " Good computation!" << std::endl;
173
193
return 0 ;
174
194
}
0 commit comments