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
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
11
+
12
+ 2) [info::device::partition_properties]: returns the partition properties
10
13
supported by this SYCL device; a vector of info::partition_property. If this
11
14
SYCL device cannot be partitioned into at least two sub devices then the
12
15
returned vector **must be empty**.
13
16
14
- 2 ) [create_sub_devices()]: If the SYCL device
17
+ 3 ) [create_sub_devices()]: If the SYCL device
15
18
does not support info::partition_property::partition_by_affinity_domain or the
16
19
SYCL device does not support the info::partition_affinity_domain provided, an
17
20
exception with the **feature_not_supported error code must be thrown**.
@@ -57,24 +60,10 @@ int main() {
57
60
58
61
auto dev = cl::sycl::device (cl::sycl::default_selector ());
59
62
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
- }
63
+ // check exceed max_compute_units
64
+ cl::sycl::info::partition_property partitionEqually =
65
+ cl::sycl::info::partition_property::partition_equally;
66
+ if (supports_partition_property (dev, partitionEqually)) {
78
67
auto maxUnits = dev.get_info <sycl::info::device::max_compute_units>();
79
68
try {
80
69
std::vector<sycl::device> v = dev.create_sub_devices <
@@ -93,6 +82,27 @@ int main() {
93
82
return -1 ;
94
83
}
95
84
}
85
+ }
86
+
87
+ cl::sycl::info::partition_property partitionProperty =
88
+ cl::sycl::info::partition_property::partition_by_affinity_domain;
89
+ cl::sycl::info::partition_affinity_domain affinityDomain =
90
+ cl::sycl::info::partition_affinity_domain::next_partitionable;
91
+
92
+ if (supports_partition_property (dev, partitionProperty)) {
93
+ if (supports_affinity_domain (dev, partitionProperty, affinityDomain)) {
94
+ auto subDevices = dev.create_sub_devices <
95
+ cl::sycl::info::partition_property::partition_by_affinity_domain>(
96
+ affinityDomain);
97
+
98
+ if (subDevices.size () < 2 ) {
99
+ std::cerr << " device::create_sub_device(info::partition_affinity_"
100
+ " domain) should have returned at least 2 devices"
101
+ << std::endl;
102
+ return -1 ;
103
+ }
104
+ }
105
+
96
106
} else {
97
107
try {
98
108
auto subDevices = dev.create_sub_devices <
0 commit comments