Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit a5e1dc5

Browse files
committed
Apply code review comments
1 parent b68ac93 commit a5e1dc5

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

SYCL/GroupAlgorithm/SYCL2020/sort.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,9 +349,6 @@ int main(int argc, char *argv[]) {
349349
return 0;
350350
}
351351

352-
bool doubleIsSupported = q.get_device().has(sycl::aspect::fp64);
353-
bool halfIsSupported = q.get_device().has(sycl::aspect::fp16);
354-
355352
std::vector<int> sizes{1, 12, 32};
356353

357354
for (int i = 0; i < sizes.size(); ++i) {
@@ -360,9 +357,9 @@ int main(int argc, char *argv[]) {
360357
test_sort_by_type<std::int32_t>(q, sizes[i]);
361358
test_sort_by_type<std::uint32_t>(q, sizes[i]);
362359
test_sort_by_type<float>(q, sizes[i]);
363-
if (halfIsSupported)
360+
if (q.get_device().has(sycl::aspect::fp16))
364361
test_sort_by_type<sycl::half>(q, sizes[i]);
365-
if (doubleIsSupported)
362+
if (q.get_device().has(sycl::aspect::fp64))
366363
test_sort_by_type<double>(q, sizes[i]);
367364
test_sort_by_type<std::size_t>(q, sizes[i]);
368365

SYCL/KernelParams/union_kernel_param.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ union TestUnion {
1212
public:
1313
int myint;
1414
char mychar;
15-
float myfloat;
15+
double mydouble;
1616

17-
TestUnion() { myfloat = 0.0; };
17+
TestUnion() { mydouble = 0.0; };
1818
};
1919

2020
int main(int argc, char **argv) {
2121
TestUnion x;
22-
x.myfloat = 5.0;
23-
float myfloat = 0.0;
22+
x.mydouble = 5.0;
23+
double mydouble = 0.0;
2424

2525
sycl::queue queue;
2626
{
27-
sycl::buffer<float, 1> buf(&myfloat, 1);
27+
sycl::buffer<double, 1> buf(&mydouble, 1);
2828
queue.submit([&](sycl::handler &cgh) {
2929
auto acc = buf.get_access<sycl::access::mode::read_write>(cgh);
30-
cgh.single_task<class test>([=]() { acc[0] = x.myfloat; });
30+
cgh.single_task<class test>([=]() { acc[0] = x.mydouble; });
3131
});
3232
}
3333

34-
if (myfloat != 5.0) {
35-
printf("FAILED\nmyfloat = %d\n", myfloat);
34+
if (mydouble != 5.0) {
35+
printf("FAILED\nmydouble = %d\n", mydouble);
3636
return 1;
3737
}
3838
return 0;

0 commit comments

Comments
 (0)