6
6
// Nvidia should not allow sub_devices but does not throw corresponding error.
7
7
// XFAIL: hip_nvidia
8
8
/* Check that:
9
- 1) [info::device::partition_properties]: returns the partition properties
10
- supported by this SYCL device; a vector of info::partition_property. If this
11
- SYCL device cannot be partitioned into at least two sub devices then the
12
- returned vector **must be empty**.
9
+ 1) if partition_equally is supported, then we check that the correct
10
+ invalid errc is returned if more than max_compute_units are requested
13
11
14
- 2) [create_sub_devices()]: If the SYCL device
15
- does not support info::partition_property::partition_by_affinity_domain or the
16
- SYCL device does not support the info::partition_affinity_domain provided, an
17
- exception with the **feature_not_supported error code must be thrown**.
12
+ 2) If the SYCL device does not support
13
+ info::partition_property::partition_by_affinity_domain or the SYCL device does
14
+ not support the info::partition_affinity_domain provided, an exception with the
15
+ **feature_not_supported error code must be thrown**.
18
16
*/
19
17
20
18
#include < CL/sycl.hpp>
@@ -57,24 +55,10 @@ int main() {
57
55
58
56
auto dev = cl::sycl::device (cl::sycl::default_selector ());
59
57
60
- cl::sycl::info::partition_property partitionProperty =
61
- cl::sycl::info::partition_property::partition_by_affinity_domain;
62
- cl::sycl::info::partition_affinity_domain affinityDomain =
63
- cl::sycl::info::partition_affinity_domain::next_partitionable;
64
-
65
- if (supports_partition_property (dev, partitionProperty)) {
66
- if (supports_affinity_domain (dev, partitionProperty, affinityDomain)) {
67
- auto subDevices = dev.create_sub_devices <
68
- cl::sycl::info::partition_property::partition_by_affinity_domain>(
69
- affinityDomain);
70
-
71
- if (subDevices.size () < 2 ) {
72
- std::cerr << " device::create_sub_device(info::partition_affinity_"
73
- " domain) should have returned at least 2 devices"
74
- << std::endl;
75
- return -1 ;
76
- }
77
- }
58
+ // 1 - check exceed max_compute_units
59
+ cl::sycl::info::partition_property partitionEqually =
60
+ cl::sycl::info::partition_property::partition_equally;
61
+ if (supports_partition_property (dev, partitionEqually)) {
78
62
auto maxUnits = dev.get_info <sycl::info::device::max_compute_units>();
79
63
try {
80
64
std::vector<sycl::device> v = dev.create_sub_devices <
@@ -93,6 +77,26 @@ int main() {
93
77
return -1 ;
94
78
}
95
79
}
80
+ }
81
+
82
+ // 2 - check affinity
83
+ cl::sycl::info::partition_property partitionProperty =
84
+ cl::sycl::info::partition_property::partition_by_affinity_domain;
85
+ cl::sycl::info::partition_affinity_domain affinityDomain =
86
+ cl::sycl::info::partition_affinity_domain::next_partitionable;
87
+ if (supports_partition_property (dev, partitionProperty)) {
88
+ if (supports_affinity_domain (dev, partitionProperty, affinityDomain)) {
89
+ auto subDevices = dev.create_sub_devices <
90
+ cl::sycl::info::partition_property::partition_by_affinity_domain>(
91
+ affinityDomain);
92
+
93
+ if (subDevices.size () < 2 ) {
94
+ std::cerr << " device::create_sub_device(info::partition_affinity_"
95
+ " domain) should have returned at least 2 devices"
96
+ << std::endl;
97
+ return -1 ;
98
+ }
99
+ }
96
100
} else {
97
101
try {
98
102
auto subDevices = dev.create_sub_devices <
0 commit comments