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

Commit b68ac93

Browse files
committed
Update copy.cpp
1 parent 4514445 commit b68ac93

File tree

1 file changed

+17
-27
lines changed

1 file changed

+17
-27
lines changed

SYCL/USM/copy.cpp

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,11 @@ struct test_struct {
2727
long long d;
2828
half e;
2929
float f;
30-
double g;
3130
};
3231

3332
bool operator==(const test_struct &lhs, const test_struct &rhs) {
3433
return lhs.a == rhs.a && lhs.b == rhs.b && lhs.c == rhs.c && lhs.d == rhs.d &&
35-
lhs.e == rhs.e && lhs.f == rhs.f && lhs.g == rhs.g;
34+
lhs.e == rhs.e && lhs.f == rhs.f;
3635
}
3736

3837
template <typename T> T *regular(queue q, alloc kind) {
@@ -44,6 +43,9 @@ template <typename T> T *aligned(queue q, alloc kind) {
4443
}
4544

4645
template <typename T> void test(queue q, T val, T *src, T *dst, bool dev_dst) {
46+
if (std::is_same_v<T, double> && !q.get_device().has(aspect::fp64))
47+
return;
48+
4749
q.fill(src, val, N).wait();
4850

4951
// Use queue::copy for the first half and handler::copy for the second
@@ -87,7 +89,7 @@ int main() {
8789
queue q;
8890
auto dev = q.get_device();
8991

90-
test_struct test_obj{4, 42, 424, 4242, 4.2f, 4.242f, 4.24242};
92+
test_struct test_obj{4, 42, 424, 4242, 4.2f, 4.242f};
9193

9294
if (dev.has(aspect::usm_host_allocations)) {
9395
runTests<short>(q, 4, alloc::host, alloc::host);
@@ -96,10 +98,8 @@ int main() {
9698
runTests<long long>(q, 4242, alloc::host, alloc::host);
9799
runTests<half>(q, half(4.2f), alloc::host, alloc::host);
98100
runTests<float>(q, 4.242f, alloc::host, alloc::host);
99-
if (dev.has(aspect::fp64)) {
100-
runTests<double>(q, 4.24242, alloc::host, alloc::host);
101-
runTests<test_struct>(q, test_obj, alloc::host, alloc::host);
102-
}
101+
runTests<double>(q, 4.24242, alloc::host, alloc::host);
102+
runTests<test_struct>(q, test_obj, alloc::host, alloc::host);
103103
}
104104

105105
if (dev.has(aspect::usm_shared_allocations)) {
@@ -109,10 +109,8 @@ int main() {
109109
runTests<long long>(q, 4242, alloc::shared, alloc::shared);
110110
runTests<half>(q, half(4.2f), alloc::shared, alloc::shared);
111111
runTests<float>(q, 4.242f, alloc::shared, alloc::shared);
112-
if (dev.has(aspect::fp64)) {
113-
runTests<double>(q, 4.24242, alloc::shared, alloc::shared);
114-
runTests<test_struct>(q, test_obj, alloc::shared, alloc::shared);
115-
}
112+
runTests<double>(q, 4.24242, alloc::shared, alloc::shared);
113+
runTests<test_struct>(q, test_obj, alloc::shared, alloc::shared);
116114
}
117115

118116
if (dev.has(aspect::usm_device_allocations)) {
@@ -122,10 +120,8 @@ int main() {
122120
runTests<long long>(q, 4242, alloc::device, alloc::device);
123121
runTests<half>(q, half(4.2f), alloc::device, alloc::device);
124122
runTests<float>(q, 4.242f, alloc::device, alloc::device);
125-
if (dev.has(aspect::fp64)) {
126-
runTests<double>(q, 4.24242, alloc::device, alloc::device);
127-
runTests<test_struct>(q, test_obj, alloc::device, alloc::device);
128-
}
123+
runTests<double>(q, 4.24242, alloc::device, alloc::device);
124+
runTests<test_struct>(q, test_obj, alloc::device, alloc::device);
129125
}
130126

131127
if (dev.has(aspect::usm_host_allocations) &&
@@ -136,10 +132,8 @@ int main() {
136132
runTests<long long>(q, 4242, alloc::host, alloc::shared);
137133
runTests<half>(q, half(4.2f), alloc::host, alloc::shared);
138134
runTests<float>(q, 4.242f, alloc::host, alloc::shared);
139-
if (dev.has(aspect::fp64)) {
140-
runTests<double>(q, 4.24242, alloc::host, alloc::shared);
141-
runTests<test_struct>(q, test_obj, alloc::host, alloc::shared);
142-
}
135+
runTests<double>(q, 4.24242, alloc::host, alloc::shared);
136+
runTests<test_struct>(q, test_obj, alloc::host, alloc::shared);
143137
}
144138

145139
if (dev.has(aspect::usm_host_allocations) &&
@@ -150,10 +144,8 @@ int main() {
150144
runTests<long long>(q, 4242, alloc::host, alloc::device);
151145
runTests<half>(q, half(4.2f), alloc::host, alloc::device);
152146
runTests<float>(q, 4.242f, alloc::host, alloc::device);
153-
if (dev.has(aspect::fp64)) {
154-
runTests<double>(q, 4.24242, alloc::host, alloc::device);
155-
runTests<test_struct>(q, test_obj, alloc::host, alloc::device);
156-
}
147+
runTests<double>(q, 4.24242, alloc::host, alloc::device);
148+
runTests<test_struct>(q, test_obj, alloc::host, alloc::device);
157149
}
158150

159151
if (dev.has(aspect::usm_shared_allocations) &&
@@ -164,10 +156,8 @@ int main() {
164156
runTests<long long>(q, 4242, alloc::shared, alloc::device);
165157
runTests<half>(q, half(4.2f), alloc::shared, alloc::device);
166158
runTests<float>(q, 4.242f, alloc::shared, alloc::device);
167-
if (dev.has(aspect::fp64)) {
168-
runTests<double>(q, 4.24242, alloc::shared, alloc::device);
169-
runTests<test_struct>(q, test_obj, alloc::shared, alloc::device);
170-
}
159+
runTests<double>(q, 4.24242, alloc::shared, alloc::device);
160+
runTests<test_struct>(q, test_obj, alloc::shared, alloc::device);
171161
}
172162

173163
return 0;

0 commit comments

Comments
 (0)