Skip to content

Commit c76f90d

Browse files
authored
[SYCL][ESIMD] Host-compile simd.cpp test, fix errors & warnings. (#3846)
Also removed deprecation message checking in the block_load_store.cpp, as it leads to frequent test failures when new warnings appear in other parts of the code base. This is unnecessary maintenance overhead. Change-Id: I68437a46a4c17a6af6bef16ff45c804151bb956d Signed-off-by: Konstantin S Bobrovsky <konstantin.s.bobrovsky@intel.com>
1 parent 4714544 commit c76f90d

File tree

5 files changed

+35
-37
lines changed

5 files changed

+35
-37
lines changed

sycl/include/sycl/ext/intel/experimental/esimd/math.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//==-------------- math.hpp - DPC++ Explicit SIMD API --------------------==//
1+
//==-------------- math.hpp - DPC++ Explicit SIMD API --------------------==//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -11,6 +11,7 @@
1111
#pragma once
1212

1313
#include <sycl/ext/intel/experimental/esimd/common.hpp>
14+
#include <sycl/ext/intel/experimental/esimd/detail/host_util.hpp>
1415
#include <sycl/ext/intel/experimental/esimd/detail/math_intrin.hpp>
1516
#include <sycl/ext/intel/experimental/esimd/detail/types.hpp>
1617
#include <sycl/ext/intel/experimental/esimd/detail/util.hpp>

sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
#pragma once
1212

13+
#include <sycl/ext/intel/experimental/esimd/simd_view.hpp>
14+
1315
#include <sycl/ext/intel/experimental/esimd/detail/intrin.hpp>
1416
#include <sycl/ext/intel/experimental/esimd/detail/memory_intrin.hpp>
1517
#include <sycl/ext/intel/experimental/esimd/detail/sycl_util.hpp>

sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#pragma once
1212

13+
#include <sycl/ext/intel/experimental/esimd/detail/intrin.hpp>
1314
#include <sycl/ext/intel/experimental/esimd/detail/types.hpp>
1415

1516
__SYCL_INLINE_NAMESPACE(cl) {

sycl/test/esimd/block_load_store.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
1+
// RUN: %clangxx -fsycl -fsyntax-only %s
2+
3+
// This test checks that block_load/store API gets successfully compiled.
24

35
#include <CL/sycl.hpp>
46
#include <sycl/ext/intel/experimental/esimd.hpp>
@@ -12,22 +14,14 @@ SYCL_EXTERNAL void kernel1(
1214
accessor<int, 1, access::mode::read_write, access::target::global_buffer>
1315
&buf) SYCL_ESIMD_FUNCTION {
1416
simd<int, 32> v1(0, 1);
15-
// expected-warning@+2 {{deprecated}}
16-
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{}}
1717
auto v0 = block_load<int, 32>(buf, 0);
1818
v0 = v0 + v1;
19-
// expected-warning@+2 {{deprecated}}
20-
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{}}
2119
block_store<int, 32>(buf, 0, v0);
2220
}
2321

2422
SYCL_EXTERNAL void kernel2(int *ptr) SYCL_ESIMD_FUNCTION {
2523
simd<int, 32> v1(0, 1);
26-
// expected-warning@+2 {{deprecated}}
27-
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{}}
2824
auto v0 = block_load<int, 32>(ptr);
2925
v0 = v0 + v1;
30-
// expected-warning@+2 {{deprecated}}
31-
// expected-note@sycl/ext/intel/experimental/esimd/memory.hpp:* {{}}
3226
block_store<int, 32>(ptr, v0);
3327
}

sycl/test/esimd/simd.cpp

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsycl-device-only -fsyntax-only -Xclang -verify %s
1+
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
22
// expected-no-diagnostics
33

44
#include <sycl/ext/intel/experimental/esimd.hpp>
@@ -7,23 +7,23 @@
77

88
using namespace sycl::ext::intel::experimental::esimd;
99

10-
bool test_simd_ctors() __attribute__((sycl_device)) {
10+
bool test_simd_ctors() SYCL_ESIMD_FUNCTION {
1111
simd<int, 16> v0 = 1;
1212
simd<int, 16> v1(v0);
1313
simd<int, 16> v2(simd<int, 16>(0, 1));
1414
const simd<int, 16> v3{0, 2, 4, 6, 1, 3, 5, 7};
1515
return v0[0] + v1[1] + v2[2] + v3[3] == 1 + 1 + 2 + 6;
1616
}
1717

18-
void test_conversion() __attribute__((sycl_device)) {
18+
void test_conversion() SYCL_ESIMD_FUNCTION {
1919
simd<int, 32> v = 3;
2020
simd<float, 32> f = v;
2121
simd<char, 32> c = f;
2222
simd<char, 16> c1 = f.select<16, 1>(0);
2323
f = v + static_cast<simd<int, 32>>(c);
2424
}
2525

26-
bool test_1d_select() __attribute__((sycl_device)) {
26+
bool test_1d_select() SYCL_ESIMD_FUNCTION {
2727
simd<int, 32> v = 0;
2828
v.select<8, 1>(0) = 1;
2929
v.select<8, 1>(8) = 2;
@@ -32,7 +32,7 @@ bool test_1d_select() __attribute__((sycl_device)) {
3232
return v[0] + v[8] + v[16] + v[24] == (1 + 2 + 3 + 4);
3333
}
3434

35-
bool test_simd_format() __attribute__((sycl_device)) {
35+
bool test_simd_format() SYCL_ESIMD_FUNCTION {
3636
simd<int, 16> v{0, 1, 2, 3, 4, 5, 6, 7};
3737
auto ref1 = v.format<short>();
3838
auto ref2 = v.format<double>();
@@ -41,7 +41,7 @@ bool test_simd_format() __attribute__((sycl_device)) {
4141
(decltype(ref3)::getSizeX() == 4) && (decltype(ref3)::getSizeY() == 8);
4242
}
4343

44-
bool test_simd_select() __attribute__((sycl_device)) {
44+
bool test_simd_select() SYCL_ESIMD_FUNCTION {
4545
simd<int, 16> v(0, 1);
4646
auto ref0 = v.select<4, 2>(1); // r{1, 3, 5, 7}
4747
auto ref1 = v.format<int, 4, 4>(); // 0,1,2,3;
@@ -53,21 +53,21 @@ bool test_simd_select() __attribute__((sycl_device)) {
5353
decltype(ref2)::getStrideY() == 1;
5454
}
5555

56-
bool test_2d_offset() __attribute__((sycl_device)) {
56+
bool test_2d_offset() SYCL_ESIMD_FUNCTION {
5757
simd<int, 16> v = 0;
5858
auto ref = v.format<short, 8, 4>();
5959
return ref.select<2, 2, 2, 2>(2, 1).getOffsetX() == 1 &&
6060
ref.select<2, 2, 2, 2>(2, 1).getOffsetY() == 2;
6161
}
6262

63-
bool test_simd_bin_op_promotion() __attribute__((sycl_device)) {
63+
bool test_simd_bin_op_promotion() SYCL_ESIMD_FUNCTION {
6464
simd<short, 8> v0 = std::numeric_limits<short>::max();
6565
simd<short, 8> v1 = 1;
6666
simd<int, 8> v2 = v0 + v1;
6767
return v2[0] == 32768;
6868
}
6969

70-
bool test_simd_bin_ops() __attribute__((sycl_device)) {
70+
bool test_simd_bin_ops() SYCL_ESIMD_FUNCTION {
7171
simd<int, 8> v0 = 1;
7272
simd<int, 8> v1 = 2;
7373
v0 += v1;
@@ -82,7 +82,7 @@ bool test_simd_bin_ops() __attribute__((sycl_device)) {
8282
return v0[0] == 1;
8383
}
8484

85-
bool test_simd_unary_ops() __attribute__((sycl_device)) {
85+
bool test_simd_unary_ops() SYCL_ESIMD_FUNCTION {
8686
simd<int, 8> v0 = 1;
8787
simd<int, 8> v1 = 2;
8888
v0 <<= v1;
@@ -92,7 +92,7 @@ bool test_simd_unary_ops() __attribute__((sycl_device)) {
9292
return v1[0] == 1;
9393
}
9494

95-
bool test_nested_1d_select() __attribute__((sycl_device)) {
95+
bool test_nested_1d_select() SYCL_ESIMD_FUNCTION {
9696
simd<int, 8> r0(0, 1);
9797

9898
auto r1 = r0.select<4, 2>(0);
@@ -103,7 +103,7 @@ bool test_nested_1d_select() __attribute__((sycl_device)) {
103103
return r0[4] == 37;
104104
}
105105

106-
bool test_format_1d_read() __attribute__((sycl_device)) {
106+
bool test_format_1d_read() SYCL_ESIMD_FUNCTION {
107107
simd<int, 8> r = 0x0FF00F0F;
108108
auto rl = r.format<short>();
109109
auto rl2 = rl.select<8, 2>(0); // 0F0F
@@ -112,7 +112,7 @@ bool test_format_1d_read() __attribute__((sycl_device)) {
112112
return rl2[0] == 0x0F0F && rh2[0] == 0x0FF0;
113113
}
114114

115-
bool test_format_1d_write() __attribute__((sycl_device)) {
115+
bool test_format_1d_write() SYCL_ESIMD_FUNCTION {
116116
simd<int, 8> r;
117117
auto rl = r.format<short>();
118118
auto rl2 = rl.select<8, 2>(0);
@@ -122,7 +122,7 @@ bool test_format_1d_write() __attribute__((sycl_device)) {
122122
return r[0] == 0x0FF0;
123123
}
124124

125-
bool test_format_1d_read_write_nested() __attribute__((sycl_device)) {
125+
bool test_format_1d_read_write_nested() SYCL_ESIMD_FUNCTION {
126126
simd<int, 8> v = 0;
127127
auto r1 = v.format<short>();
128128
auto r11 = r1.select<8, 1>(0);
@@ -134,39 +134,39 @@ bool test_format_1d_read_write_nested() __attribute__((sycl_device)) {
134134
return v[0] == 1 && v[4] == 2;
135135
}
136136

137-
bool test_format_2d_read() __attribute__((sycl_device)) {
137+
bool test_format_2d_read() SYCL_ESIMD_FUNCTION {
138138
simd<int, 8> v0(0, 1);
139139
auto r1 = v0.format<int, 2, 4>();
140140
simd<int, 4> v1 = r1.select<1, 0, 4, 1>(1, 0).read(); // second row
141141
return v1[0] == 4;
142142
}
143143

144-
bool test_format_2d_write() __attribute__((sycl_device)) {
144+
bool test_format_2d_write() SYCL_ESIMD_FUNCTION {
145145
simd<int, 8> v0(0, 1);
146146
auto r1 = v0.format<int, 2, 4>();
147147
r1.select<1, 0, 4, 1>(1, 0) = 37;
148148
return v0[4] == 37;
149149
}
150150

151-
bool test_select_rvalue() __attribute__((sycl_device)) {
151+
bool test_select_rvalue() SYCL_ESIMD_FUNCTION {
152152
simd<int, 8> v0(0, 1);
153153
v0.select<4, 2>(1).select<2, 2>(0) = 37;
154154
return v0[5] == 37;
155155
}
156156

157-
auto test_format_1d_write_rvalue() __attribute__((sycl_device)) {
157+
auto test_format_1d_write_rvalue() SYCL_ESIMD_FUNCTION {
158158
simd<int, 8> v0 = 0x0F0F0F0F;
159159
v0.format<short>().select<8, 2>(0) = 0x0E0E;
160160
return v0[2] == 0x0E0E0E0E;
161161
}
162162

163-
bool test_format_2d_write_rvalue() __attribute__((sycl_device)) {
163+
bool test_format_2d_write_rvalue() SYCL_ESIMD_FUNCTION {
164164
simd<int, 8> v0(0, 1);
165165
v0.format<int, 2, 4>().select<1, 0, 4, 1>(0, 0) = 37;
166166
return v0[3] == 37;
167167
}
168168

169-
auto test_format_2d_read_rvalue() __attribute__((sycl_device)) {
169+
auto test_format_2d_read_rvalue() SYCL_ESIMD_FUNCTION {
170170
simd<int, 8> v0(0, 1);
171171
auto r1 = v0.format<int, 2, 4>()
172172
.select<1, 0, 4, 1>(1, 0)
@@ -175,7 +175,7 @@ auto test_format_2d_read_rvalue() __attribute__((sycl_device)) {
175175
return r1[0] == 5;
176176
}
177177

178-
bool test_row_read_write() __attribute__((sycl_device)) {
178+
bool test_row_read_write() SYCL_ESIMD_FUNCTION {
179179
simd<int, 16> v0(0, 1);
180180
auto m = v0.format<int, 4, 4>();
181181

@@ -190,7 +190,7 @@ bool test_row_read_write() __attribute__((sycl_device)) {
190190
return r0[0] == 8 && r1[0] == 16;
191191
}
192192

193-
bool test_column_read_write() __attribute__((sycl_device)) {
193+
bool test_column_read_write() SYCL_ESIMD_FUNCTION {
194194
simd<int, 4> v0(0, 1);
195195
auto m = v0.format<int, 2, 2>();
196196

@@ -203,35 +203,35 @@ bool test_column_read_write() __attribute__((sycl_device)) {
203203
return v0[0] == 1 && v0[3] == 4;
204204
}
205205

206-
bool test_replicate() __attribute__((sycl_device)) {
206+
bool test_replicate() SYCL_ESIMD_FUNCTION {
207207
simd<int, 8> v0(0, 1);
208208
auto v0_rep = v0.replicate<1>();
209209

210210
return v0[0] == v0_rep[0] && v0[7] == v0_rep[7];
211211
}
212212

213-
bool test_replicate1() __attribute__((sycl_device)) {
213+
bool test_replicate1() SYCL_ESIMD_FUNCTION {
214214
simd<int, 8> v0(0, 1);
215215
auto v0_rep = v0.replicate<4, 2>(2);
216216

217217
return v0[2] == v0_rep[2] && v0[3] == v0_rep[5];
218218
}
219219

220-
bool test_replicate2() __attribute__((sycl_device)) {
220+
bool test_replicate2() SYCL_ESIMD_FUNCTION {
221221
simd<int, 8> v0(0, 1);
222222
auto v0_rep = v0.replicate<2, 4, 2>(1);
223223

224224
return v0_rep[0] == v0[1] && v0_rep[1] == v0[2] && v0_rep[2] == v0[5];
225225
}
226226

227-
bool test_replicate3() __attribute__((sycl_device)) {
227+
bool test_replicate3() SYCL_ESIMD_FUNCTION {
228228
simd<int, 8> v0(0, 1);
229229
auto v0_rep = v0.replicate<2, 4, 2, 2>(1);
230230

231231
return v0_rep[0] == v0[1] && v0_rep[1] == v0[3] && v0_rep[2] == v0[5];
232232
}
233233

234-
bool test_simd_iselect() __attribute__((sycl_device)) {
234+
bool test_simd_iselect() SYCL_ESIMD_FUNCTION {
235235
simd<int, 16> v(0, 1);
236236
simd<ushort, 8> a(0, 2);
237237
auto data = v.iselect(a);

0 commit comments

Comments
 (0)