|
5 | 5 |
|
6 | 6 | using namespace sycl::ext::oneapi::experimental;
|
7 | 7 |
|
8 |
| -static device_global<int> DeviceGlobal1; |
| 8 | +// TODO: device_global currently requires device_image_scope. When this |
| 9 | +// requirement is lifted the tests should include a case without any properties |
| 10 | +// and DeviceGlobal2, DeviceGlobal3, and DeviceGlobal4 should have |
| 11 | +// device_image_scope removed. |
9 | 12 | static device_global<int, decltype(properties(device_image_scope))>
|
| 13 | + DeviceGlobal1; |
| 14 | +static device_global<int, |
| 15 | + decltype(properties(device_image_scope, host_access_none))> |
10 | 16 | DeviceGlobal2;
|
11 |
| -static device_global<int, decltype(properties(host_access_none))> DeviceGlobal3; |
12 |
| -static device_global<int, decltype(properties(init_mode_reset))> DeviceGlobal4; |
13 |
| -static device_global<int, decltype(properties(implement_in_csr_on))> |
14 |
| - DeviceGlobal5; |
| 17 | +static device_global<int, |
| 18 | + decltype(properties(device_image_scope, init_mode_reset))> |
| 19 | + DeviceGlobal3; |
| 20 | +static device_global<int, decltype(properties(device_image_scope, |
| 21 | + implement_in_csr_on))> |
| 22 | + DeviceGlobal4; |
15 | 23 | static device_global<int, decltype(properties(
|
16 | 24 | implement_in_csr_off, host_access_write,
|
17 | 25 | device_image_scope, init_mode_reprogram))>
|
18 |
| - DeviceGlobal6; |
| 26 | + DeviceGlobal5; |
19 | 27 |
|
20 | 28 | // Checks is_property_key_of and is_property_value_of for T.
|
21 | 29 | template <typename T> void checkIsPropertyOf() {
|
@@ -53,54 +61,54 @@ int main() {
|
53 | 61 | static_assert(is_property_value<decltype(implement_in_csr_off)>::value);
|
54 | 62 |
|
55 | 63 | checkIsPropertyOf<decltype(DeviceGlobal1)>();
|
56 |
| - static_assert(!DeviceGlobal1.has_property<device_image_scope_key>()); |
| 64 | + static_assert(DeviceGlobal1.has_property<device_image_scope_key>()); |
57 | 65 | static_assert(!DeviceGlobal1.has_property<host_access_key>());
|
58 | 66 | static_assert(!DeviceGlobal1.has_property<init_mode_key>());
|
59 | 67 | static_assert(!DeviceGlobal1.has_property<implement_in_csr_key>());
|
| 68 | + static_assert(DeviceGlobal1.get_property<device_image_scope_key>() == |
| 69 | + device_image_scope); |
60 | 70 |
|
61 | 71 | checkIsPropertyOf<decltype(DeviceGlobal2)>();
|
62 | 72 | static_assert(DeviceGlobal2.has_property<device_image_scope_key>());
|
63 |
| - static_assert(!DeviceGlobal2.has_property<host_access_key>()); |
| 73 | + static_assert(DeviceGlobal2.has_property<host_access_key>()); |
64 | 74 | static_assert(!DeviceGlobal2.has_property<init_mode_key>());
|
65 | 75 | static_assert(!DeviceGlobal2.has_property<implement_in_csr_key>());
|
66 | 76 | static_assert(DeviceGlobal2.get_property<device_image_scope_key>() ==
|
67 | 77 | device_image_scope);
|
| 78 | + static_assert(DeviceGlobal2.get_property<host_access_key>().value == |
| 79 | + host_access_enum::none); |
68 | 80 |
|
69 | 81 | checkIsPropertyOf<decltype(DeviceGlobal3)>();
|
70 |
| - static_assert(!DeviceGlobal3.has_property<device_image_scope_key>()); |
71 |
| - static_assert(DeviceGlobal3.has_property<host_access_key>()); |
72 |
| - static_assert(!DeviceGlobal3.has_property<init_mode_key>()); |
| 82 | + static_assert(DeviceGlobal3.has_property<device_image_scope_key>()); |
| 83 | + static_assert(!DeviceGlobal3.has_property<host_access_key>()); |
| 84 | + static_assert(DeviceGlobal3.has_property<init_mode_key>()); |
73 | 85 | static_assert(!DeviceGlobal3.has_property<implement_in_csr_key>());
|
74 |
| - static_assert(DeviceGlobal3.get_property<host_access_key>().value == |
75 |
| - host_access_enum::none); |
| 86 | + static_assert(DeviceGlobal3.get_property<device_image_scope_key>() == |
| 87 | + device_image_scope); |
| 88 | + static_assert(DeviceGlobal3.get_property<init_mode_key>().value == |
| 89 | + init_mode_enum::reset); |
76 | 90 |
|
77 | 91 | checkIsPropertyOf<decltype(DeviceGlobal4)>();
|
78 |
| - static_assert(!DeviceGlobal4.has_property<device_image_scope_key>()); |
| 92 | + static_assert(DeviceGlobal4.has_property<device_image_scope_key>()); |
79 | 93 | static_assert(!DeviceGlobal4.has_property<host_access_key>());
|
80 |
| - static_assert(DeviceGlobal4.has_property<init_mode_key>()); |
81 |
| - static_assert(!DeviceGlobal4.has_property<implement_in_csr_key>()); |
82 |
| - static_assert(DeviceGlobal4.get_property<init_mode_key>().value == |
83 |
| - init_mode_enum::reset); |
| 94 | + static_assert(!DeviceGlobal4.has_property<init_mode_key>()); |
| 95 | + static_assert(DeviceGlobal4.has_property<implement_in_csr_key>()); |
| 96 | + static_assert(DeviceGlobal4.get_property<device_image_scope_key>() == |
| 97 | + device_image_scope); |
| 98 | + static_assert(DeviceGlobal4.get_property<implement_in_csr_key>().value); |
84 | 99 |
|
85 | 100 | checkIsPropertyOf<decltype(DeviceGlobal5)>();
|
86 |
| - static_assert(!DeviceGlobal5.has_property<device_image_scope_key>()); |
87 |
| - static_assert(!DeviceGlobal5.has_property<host_access_key>()); |
88 |
| - static_assert(!DeviceGlobal5.has_property<init_mode_key>()); |
| 101 | + static_assert(DeviceGlobal5.has_property<device_image_scope_key>()); |
| 102 | + static_assert(DeviceGlobal5.has_property<host_access_key>()); |
| 103 | + static_assert(DeviceGlobal5.has_property<init_mode_key>()); |
89 | 104 | static_assert(DeviceGlobal5.has_property<implement_in_csr_key>());
|
90 |
| - static_assert(DeviceGlobal5.get_property<implement_in_csr_key>().value); |
91 |
| - |
92 |
| - checkIsPropertyOf<decltype(DeviceGlobal6)>(); |
93 |
| - static_assert(DeviceGlobal6.has_property<device_image_scope_key>()); |
94 |
| - static_assert(DeviceGlobal6.has_property<host_access_key>()); |
95 |
| - static_assert(DeviceGlobal6.has_property<init_mode_key>()); |
96 |
| - static_assert(DeviceGlobal6.has_property<implement_in_csr_key>()); |
97 |
| - static_assert(DeviceGlobal6.get_property<device_image_scope_key>() == |
| 105 | + static_assert(DeviceGlobal5.get_property<device_image_scope_key>() == |
98 | 106 | device_image_scope);
|
99 |
| - static_assert(DeviceGlobal6.get_property<host_access_key>().value == |
| 107 | + static_assert(DeviceGlobal5.get_property<host_access_key>().value == |
100 | 108 | host_access_enum::write);
|
101 |
| - static_assert(DeviceGlobal6.get_property<init_mode_key>().value == |
| 109 | + static_assert(DeviceGlobal5.get_property<init_mode_key>().value == |
102 | 110 | init_mode_enum::reprogram);
|
103 |
| - static_assert(!DeviceGlobal6.get_property<implement_in_csr_key>().value); |
| 111 | + static_assert(!DeviceGlobal5.get_property<implement_in_csr_key>().value); |
104 | 112 |
|
105 | 113 | return 0;
|
106 | 114 | }
|
0 commit comments