Skip to content

Commit 0cbc9a0

Browse files
authored
[SYCL][E2E] Remove warnings in Basic e2e tests (#13994)
1 parent 0f796bc commit 0cbc9a0

File tree

5 files changed

+19
-24
lines changed

5 files changed

+19
-24
lines changed

sycl/test-e2e/Basic/built-ins/host_math.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ void testRemquo() {
4444
int quo = 0;
4545
float rem = sycl::remquo(
4646
86.0f, 10.0f,
47-
sycl::multi_ptr<int, sycl::access::address_space::global_space>{&quo});
47+
sycl::address_space_cast<sycl::access::address_space::global_space,
48+
sycl::access::decorated::no, int>(&quo));
4849
assert(quo == 9);
4950
assert(rem == -4);
5051
}
@@ -53,7 +54,8 @@ void testRemquo() {
5354
int quo = 0;
5455
float rem = sycl::remquo(
5556
-10.0, 3.0,
56-
sycl::multi_ptr<int, sycl::access::address_space::global_space>{&quo});
57+
sycl::address_space_cast<sycl::access::address_space::global_space,
58+
sycl::access::decorated::no, int>(&quo));
5759
assert(quo == -3);
5860
assert(rem == -1);
5961
}
@@ -62,7 +64,8 @@ void testRemquo() {
6264
int quo = 0;
6365
float rem = sycl::remquo(
6466
0.552879f, 0.219282f,
65-
sycl::multi_ptr<int, sycl::access::address_space::global_space>{&quo});
67+
sycl::address_space_cast<sycl::access::address_space::global_space,
68+
sycl::access::decorated::no, int>(&quo));
6669
assert(quo == 3);
6770
assert(rem == -0.10496702790260315f);
6871
}

sycl/test-e2e/Basic/device_event.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ int test_strideN(size_t stride) {
5757
nElemsToCopy++;
5858

5959
try {
60-
default_selector selector;
61-
queue myQueue(selector, [](exception_list l) {
60+
queue myQueue(default_selector_v, [](exception_list l) {
6261
for (auto ep : l) {
6362
try {
6463
std::rethrow_exception(ep);
@@ -88,7 +87,7 @@ int test_strideN(size_t stride) {
8887
local_acc.get_multi_ptr<access::decorated::yes>();
8988
decorated_global_ptr<int> gptr =
9089
out_ptr.get_multi_ptr<access::decorated::yes>() +
91-
grp.get_id()[0] * 16;
90+
grp.get_group_id()[0] * 16;
9291

9392
// Write the values 700, 701, ..., 763 to global memory.
9493
// Why? Well, a) to ensure that something is written into that memory

sycl/test-e2e/Basic/event.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,13 @@ int main() {
5252
}
5353

5454
{
55-
struct exception : public sycl::exception {};
56-
5755
std::cout << "wait_and_throw() check" << std::endl;
5856
bool failed = true;
5957
auto handler = [&](sycl::exception_list l) { failed = false; };
6058

6159
sycl::queue queue(handler);
6260
sycl::event e = queue.submit([&](sycl::handler &cgh) {
63-
cgh.host_task([=]() { throw exception{}; });
61+
cgh.host_task([=]() { throw sycl::exception{sycl::errc::runtime}; });
6462
});
6563
e.wait_and_throw();
6664
assert(failed == false);

sycl/test-e2e/Basic/host-task-dependency.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ struct Context {
3232

3333
S::event HostTask_CopyBuf1ToBuf2(Context *Ctx) {
3434
S::event Event = Ctx->Queue.submit([&](S::handler &CGH) {
35-
S::accessor<int, 1, S::access::mode::read, S::access::target::host_buffer>
36-
CopierSrcAcc(Ctx->Buf1, CGH);
37-
S::accessor<int, 1, S::access::mode::write, S::access::target::host_buffer>
38-
CopierDstAcc(Ctx->Buf2, CGH);
35+
S::host_accessor<int, 1, S::access::mode::read> CopierSrcAcc(Ctx->Buf1,
36+
CGH);
37+
S::host_accessor<int, 1, S::access::mode::write> CopierDstAcc(Ctx->Buf2,
38+
CGH);
3939

4040
auto CopierHostTask = [=] {
4141
for (size_t Idx = 0; Idx < CopierDstAcc.size(); ++Idx)
@@ -59,24 +59,21 @@ S::event HostTask_CopyBuf1ToBuf2(Context *Ctx) {
5959
void Thread1Fn(Context *Ctx) {
6060
// 0. initialize resulting buffer with apriori wrong result
6161
{
62-
S::accessor<int, 1, S::access::mode::write, S::access::target::host_buffer>
63-
Acc(Ctx->Buf1);
62+
S::host_accessor<int, 1, S::access::mode::write> Acc(Ctx->Buf1);
6463

6564
for (size_t Idx = 0; Idx < Acc.size(); ++Idx)
6665
Acc[Idx] = -1;
6766
}
6867

6968
{
70-
S::accessor<int, 1, S::access::mode::write, S::access::target::host_buffer>
71-
Acc(Ctx->Buf2);
69+
S::host_accessor<int, 1, S::access::mode::write> Acc(Ctx->Buf2);
7270

7371
for (size_t Idx = 0; Idx < Acc.size(); ++Idx)
7472
Acc[Idx] = -2;
7573
}
7674

7775
{
78-
S::accessor<int, 1, S::access::mode::write, S::access::target::host_buffer>
79-
Acc(Ctx->Buf3);
76+
S::host_accessor<int, 1, S::access::mode::write> Acc(Ctx->Buf3);
8077

8178
for (size_t Idx = 0; Idx < Acc.size(); ++Idx)
8279
Acc[Idx] = -3;
@@ -117,8 +114,7 @@ void Thread1Fn(Context *Ctx) {
117114

118115
// 4. check data in buffer #3
119116
{
120-
S::accessor<int, 1, S::access::mode::read, S::access::target::host_buffer>
121-
Acc(Ctx->Buf3);
117+
S::host_accessor<int, 1, S::access::mode::read> Acc(Ctx->Buf3);
122118

123119
bool Failure = false;
124120

@@ -163,8 +159,7 @@ void test() {
163159

164160
// 3. check via host accessor that buf 2 contains valid data
165161
{
166-
S::accessor<int, 1, S::access::mode::read, S::access::target::host_buffer>
167-
ResultAcc(Ctx.Buf2);
162+
S::host_accessor<int, 1, S::access::mode::read> ResultAcc(Ctx.Buf2);
168163

169164
bool Failure = false;
170165
for (size_t Idx = 0; Idx < ResultAcc.size(); ++Idx) {

sycl/test-e2e/Basic/sycl_2020_images/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ template <typename T, int Dims> bool AllTrue(const vec<T, Dims> &Vec) {
269269

270270
template <typename T, int Dims>
271271
bool ApproxEq(const vec<T, Dims> &LHS, const vec<T, Dims> &RHS,
272-
T Precision = 0.1) {
272+
T Precision = (T)0.1) {
273273
if constexpr (std::is_integral_v<T>)
274274
return AllTrue(sycl::abs(LHS - RHS) <= Precision);
275275
else

0 commit comments

Comments
 (0)