Skip to content

Commit f18ad74

Browse files
author
Pavel Samolysov
committed
[SYCL] Fix property_traits and context tests
1 parent 7030286 commit f18ad74

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

sycl/include/CL/sycl/properties/context_properties.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,13 @@ template <>
4949
struct is_property_of<property::context::cuda::use_primary_context, context>
5050
: std::true_type {};
5151

52+
template <>
53+
struct is_property<ext::oneapi::cuda::property::context::use_primary_context>
54+
: std::true_type {};
55+
56+
template <>
57+
struct is_property_of<ext::oneapi::cuda::property::context::use_primary_context,
58+
context> : std::true_type {};
59+
5260
} // namespace sycl
5361
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/include/CL/sycl/properties/queue_properties.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ struct is_property<property::queue::enable_profiling> : std::true_type {};
5454
template <>
5555
struct is_property<property::queue::cuda::use_default_stream> : std::true_type {
5656
};
57+
template <>
58+
struct is_property<ext::oneapi::cuda::property::queue::use_default_stream>
59+
: std::true_type {};
5760

5861
template <>
5962
struct is_property_of<property::queue::in_order, queue> : std::true_type {};
@@ -63,6 +66,9 @@ struct is_property_of<property::queue::enable_profiling, queue>
6366
template <>
6467
struct is_property_of<property::queue::cuda::use_default_stream, queue>
6568
: std::true_type {};
69+
template <>
70+
struct is_property_of<ext::oneapi::cuda::property::queue::use_default_stream,
71+
queue> : std::true_type {};
6672

6773
} // namespace sycl
6874
} // __SYCL_INLINE_NAMESPACE(cl)

sycl/test/basic_tests/property_traits.cpp

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
1+
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning
22
// expected-no-diagnostics
33

44
#include <CL/sycl.hpp>
@@ -65,6 +65,7 @@ int main() {
6565

6666
// Context is_property
6767
CHECK_IS_PROPERTY(property::context::cuda::use_primary_context);
68+
CHECK_IS_PROPERTY(ext::oneapi::cuda::property::context::use_primary_context);
6869

6970
// Image is_property
7071
CHECK_IS_PROPERTY(property::image::use_host_ptr);
@@ -75,6 +76,7 @@ int main() {
7576
CHECK_IS_PROPERTY(property::queue::in_order);
7677
CHECK_IS_PROPERTY(property::queue::enable_profiling);
7778
CHECK_IS_PROPERTY(property::queue::cuda::use_default_stream);
79+
CHECK_IS_PROPERTY(ext::oneapi::cuda::property::queue::use_default_stream);
7880

7981
// Reduction is_property
8082
CHECK_IS_PROPERTY(property::reduction::initialize_to_identity);
@@ -125,6 +127,8 @@ int main() {
125127

126128
// Context is_property_of
127129
CHECK_IS_PROPERTY_OF(property::context::cuda::use_primary_context, context);
130+
CHECK_IS_PROPERTY_OF(
131+
ext::oneapi::cuda::property::context::use_primary_context, context);
128132

129133
// Image is_property_of
130134
CHECK_IS_PROPERTY_OF(property::image::use_host_ptr, image<1>);
@@ -135,6 +139,8 @@ int main() {
135139
CHECK_IS_PROPERTY_OF(property::queue::in_order, queue);
136140
CHECK_IS_PROPERTY_OF(property::queue::enable_profiling, queue);
137141
CHECK_IS_PROPERTY_OF(property::queue::cuda::use_default_stream, queue);
142+
CHECK_IS_PROPERTY_OF(ext::oneapi::cuda::property::queue::use_default_stream,
143+
queue);
138144

139145
//----------------------------------------------------------------------------
140146
// is_property_of positive tests
@@ -156,13 +162,18 @@ int main() {
156162
ext::oneapi::property::buffer::use_pinned_host_memory, NotASYCLObject);
157163
CHECK_IS_NOT_PROPERTY_OF(property::context::cuda::use_primary_context,
158164
NotASYCLObject);
165+
CHECK_IS_NOT_PROPERTY_OF(
166+
ext::oneapi::cuda::property::context::use_primary_context,
167+
NotASYCLObject);
159168
CHECK_IS_NOT_PROPERTY_OF(property::image::use_host_ptr, NotASYCLObject);
160169
CHECK_IS_NOT_PROPERTY_OF(property::image::use_mutex, NotASYCLObject);
161170
CHECK_IS_NOT_PROPERTY_OF(property::image::context_bound, NotASYCLObject);
162171
CHECK_IS_NOT_PROPERTY_OF(property::queue::in_order, NotASYCLObject);
163172
CHECK_IS_NOT_PROPERTY_OF(property::queue::enable_profiling, NotASYCLObject);
164173
CHECK_IS_NOT_PROPERTY_OF(property::queue::cuda::use_default_stream,
165174
NotASYCLObject);
175+
CHECK_IS_NOT_PROPERTY_OF(
176+
ext::oneapi::cuda::property::queue::use_default_stream, NotASYCLObject);
166177

167178
// Invalid properties with valid object type
168179
CHECK_IS_NOT_PROPERTY_OF(NotAProperty, accessor<int, 1>);
@@ -198,6 +209,8 @@ int main() {
198209

199210
// Context is_property_v
200211
CHECK_IS_PROPERTY_V(property::context::cuda::use_primary_context);
212+
CHECK_IS_PROPERTY_V(
213+
ext::oneapi::cuda::property::context::use_primary_context);
201214

202215
// Image is_property_v
203216
CHECK_IS_PROPERTY_V(property::image::use_host_ptr);
@@ -208,6 +221,7 @@ int main() {
208221
CHECK_IS_PROPERTY_V(property::queue::in_order);
209222
CHECK_IS_PROPERTY_V(property::queue::enable_profiling);
210223
CHECK_IS_PROPERTY_V(property::queue::cuda::use_default_stream);
224+
CHECK_IS_PROPERTY_V(ext::oneapi::cuda::property::queue::use_default_stream);
211225

212226
//----------------------------------------------------------------------------
213227
// is_property_v negative tests
@@ -255,6 +269,8 @@ int main() {
255269

256270
// Context is_property_of_v
257271
CHECK_IS_PROPERTY_OF_V(property::context::cuda::use_primary_context, context);
272+
CHECK_IS_PROPERTY_OF_V(
273+
ext::oneapi::cuda::property::context::use_primary_context, context);
258274

259275
// Image is_property_of_v
260276
CHECK_IS_PROPERTY_OF_V(property::image::use_host_ptr, image<1>);
@@ -265,6 +281,8 @@ int main() {
265281
CHECK_IS_PROPERTY_OF_V(property::queue::in_order, queue);
266282
CHECK_IS_PROPERTY_OF_V(property::queue::enable_profiling, queue);
267283
CHECK_IS_PROPERTY_OF_V(property::queue::cuda::use_default_stream, queue);
284+
CHECK_IS_PROPERTY_OF_V(ext::oneapi::cuda::property::queue::use_default_stream,
285+
queue);
268286

269287
// Reduction is_property_v
270288
CHECK_IS_PROPERTY_V(property::reduction::initialize_to_identity);
@@ -289,13 +307,18 @@ int main() {
289307
ext::oneapi::property::buffer::use_pinned_host_memory, NotASYCLObject);
290308
CHECK_IS_NOT_PROPERTY_OF_V(property::context::cuda::use_primary_context,
291309
NotASYCLObject);
310+
CHECK_IS_NOT_PROPERTY_OF_V(
311+
ext::oneapi::cuda::property::context::use_primary_context,
312+
NotASYCLObject);
292313
CHECK_IS_NOT_PROPERTY_OF_V(property::image::use_host_ptr, NotASYCLObject);
293314
CHECK_IS_NOT_PROPERTY_OF_V(property::image::use_mutex, NotASYCLObject);
294315
CHECK_IS_NOT_PROPERTY_OF_V(property::image::context_bound, NotASYCLObject);
295316
CHECK_IS_NOT_PROPERTY_OF_V(property::queue::in_order, NotASYCLObject);
296317
CHECK_IS_NOT_PROPERTY_OF_V(property::queue::enable_profiling, NotASYCLObject);
297318
CHECK_IS_NOT_PROPERTY_OF_V(property::queue::cuda::use_default_stream,
298319
NotASYCLObject);
320+
CHECK_IS_NOT_PROPERTY_OF_V(
321+
ext::oneapi::cuda::property::queue::use_default_stream, NotASYCLObject);
299322

300323
// Invalid properties with valid object type
301324
CHECK_IS_NOT_PROPERTY_OF_V(NotAProperty, accessor<int, 1>);

0 commit comments

Comments
 (0)