Skip to content

Commit 9fe49e2

Browse files
[NFCI][SYCL][Test E2E] Fix warnings in HierPar tests (#9517)
1 parent 492f902 commit 9fe49e2

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

sycl/test-e2e/HierPar/Inputs/hier_par_wgscope_impl.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static bool testWgScope(queue &Q) {
4646
cgh.parallel_for_work_group<class hpar_hw>(
4747
range<1>(N_WG), range<1>(PHYS_WG_SIZE), [=](group<1> G) {
4848
// offset of group'S chunk in the 'DevPtr' array:
49-
int GroupOff = PHYS_WG_SIZE * G.get_id(0);
49+
int GroupOff = PHYS_WG_SIZE * G.get_group_id(0);
5050

5151
for (int CntOuter = 0; CntOuter < N_OUTER_ITER; CntOuter++) {
5252
// local group-shared array; declared inside a loop
@@ -64,7 +64,7 @@ static bool testWgScope(queue &Q) {
6464
});
6565

6666
// only for groups with IDs 0, 1:
67-
if (G.get_id(0) < GROUP_ID_SPLIT) {
67+
if (G.get_group_id(0) < GROUP_ID_SPLIT) {
6868
// invoke PFWI in the loop
6969
// Step 2a (1) - additionally increment 1 element per group as a
7070
// "side effect" of the increment part
@@ -230,7 +230,8 @@ bool testPrivateMemory(queue &Q) {
230230
}
231231
});
232232
});
233-
auto Ptr1 = Buf.get_access<access::mode::read>().get_pointer();
233+
host_accessor HostAcc(Buf, read_only);
234+
auto Ptr1 = HostAcc.get_pointer();
234235
bool Res = verify(0, RangeLength, Ptr1, [&](int I) -> int {
235236
return N_ITER * (1 + C1 + C2 + 2 * I);
236237
});
@@ -243,12 +244,12 @@ int run() {
243244
for (auto ep : L) {
244245
try {
245246
std::rethrow_exception(ep);
246-
} catch (std::exception &E) {
247-
std::cout << "*** std exception caught:\n";
248-
std::cout << E.what();
249247
} catch (sycl::exception const &E1) {
250248
std::cout << "*** SYCL exception caught:\n";
251249
std::cout << E1.what();
250+
} catch (std::exception &E) {
251+
std::cout << "*** std exception caught:\n";
252+
std::cout << E.what();
252253
}
253254
}
254255
});

sycl/test-e2e/HierPar/hier_par_basic.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ struct PFWGFunctor {
8181

8282
void operator()(group<1> g) const {
8383
int v = addend; // to check constant initializer works too
84-
size_t wg_offset = wg_chunk * g.get_id(0);
84+
size_t wg_offset = wg_chunk * g.get_group_id(0);
8585
size_t wg_size = g.get_local_range(0);
8686

8787
PFWIFunctor PFWI(wg_chunk, wg_size, wg_offset, range_length, v, dev_ptr);
@@ -139,7 +139,8 @@ int main() {
139139
PFWGFunctor PFWG(wg_chunk, range_length, addend, N_ITER, dev_ptr);
140140
cgh.parallel_for_work_group(range<1>(N_WG), PFWG);
141141
});
142-
auto ptr1 = buf.get_access<access::mode::read>().get_pointer();
142+
host_accessor hostacc(buf, read_only);
143+
auto ptr1 = hostacc.get_pointer();
143144
passed &= verify(1, range_length, ptr1,
144145
[&](int i) -> int { return N_ITER * addend; });
145146
}
@@ -166,7 +167,8 @@ int main() {
166167
}
167168
});
168169
});
169-
auto ptr1 = buf.get_access<access::mode::read>().get_pointer();
170+
host_accessor hostacc(buf, read_only);
171+
auto ptr1 = hostacc.get_pointer();
170172
passed &= verify(2, range_length, ptr1, [&](int i) -> int {
171173
// consider increments by the first PFWI:
172174
int gold = (WG_SIZE_GREATER_THAN_PHYSICAL - 1) / WG_SIZE_PHYSICAL;
@@ -207,7 +209,8 @@ int main() {
207209
}
208210
});
209211
});
210-
auto ptr1 = buf.get_access<access::mode::read>().get_pointer();
212+
host_accessor hostacc(buf, read_only);
213+
auto ptr1 = hostacc.get_pointer();
211214
passed &= verify(3, range_length, ptr1, [&](int i) -> int {
212215
int gold = 0;
213216
if (i % WG_SIZE_PHYSICAL <
@@ -256,7 +259,8 @@ int main() {
256259
}
257260
});
258261
});
259-
auto ptr1 = buf.get_access<access::mode::read>().get_pointer();
262+
host_accessor hostacc(buf, read_only);
263+
auto ptr1 = hostacc.get_pointer();
260264
passed &= verify(3, range_length, ptr1,
261265
[&](int i) -> int { return N_ITER * (1 + i + 5); });
262266
}
@@ -281,7 +285,7 @@ int main() {
281285
g.parallel_for_work_item(
282286
range<1>(WG_SIZE_GREATER_THAN_PHYSICAL), [&](h_item<1> i) {
283287
size_t wg_offset = WG_SIZE_GREATER_THAN_PHYSICAL *
284-
wi_chunk * g.get_id(0);
288+
wi_chunk * g.get_group_id(0);
285289
size_t wi_offset =
286290
wg_offset +
287291
i.get_logical_local_id().get(0) * wi_chunk;
@@ -291,7 +295,8 @@ int main() {
291295
}
292296
});
293297
});
294-
auto ptr1 = buf.get_access<access::mode::read>().get_pointer();
298+
host_accessor hostacc(buf, read_only);
299+
auto ptr1 = hostacc.get_pointer();
295300
passed &= verify(5, range_length, ptr1, [&](int i) -> int {
296301
int gold =
297302
i % 2 == 0 ? WG_SIZE_GREATER_THAN_PHYSICAL : WG_SIZE_PHYSICAL;

0 commit comments

Comments
 (0)