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

Commit 2021475

Browse files
author
Andrew Lamzed-Short
authored
[SYCL] Updated tests to comply with SYCL 2020 aspect list (#1685)
This patch updates the E2E tests to account for the changes made to aspects in [Section 4.6.4.3](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:device-aspects) of the specification: - The concept of a "host" device no longer exists in SYCL 2020 - any `host` should now be a `cpu`, so the aspect has been deprecated accordingly. - `usm_restricted_shared_allocations` has been removed. - `usm_system_allocator` has been renamed `usm_system_allocations`. - `int64_*` aspects were replaced with `atomic64`, so no longer should be tested.
1 parent 8e02984 commit 2021475

File tree

5 files changed

+192
-221
lines changed

5 files changed

+192
-221
lines changed

SYCL/Basic/aspects.cpp

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@ int main() {
2626
int pltIdx = 0;
2727
for (const auto &plt : platform::get_platforms()) {
2828
pltIdx++;
29-
if (plt.has(aspect::host)) {
30-
std::cout << "Platform #" << pltIdx
31-
<< " type: Host supports:" << std::endl;
32-
} else if (plt.has(aspect::cpu)) {
29+
if (plt.has(aspect::cpu)) {
3330
std::cout << "Platform #" << pltIdx
3431
<< " type: CPU supports:" << std::endl;
3532
} else if (plt.has(aspect::gpu)) {
@@ -57,12 +54,6 @@ int main() {
5754
if (plt.has(aspect::ext_oneapi_bfloat16_math_functions)) {
5855
std::cout << " ext_oneapi_bfloat16_math_functions" << std::endl;
5956
}
60-
if (plt.has(aspect::int64_base_atomics)) {
61-
std::cout << " base atomic operations" << std::endl;
62-
}
63-
if (plt.has(aspect::int64_extended_atomics)) {
64-
std::cout << " extended atomic operations" << std::endl;
65-
}
6657
if (plt.has(aspect::atomic64)) {
6758
std::cout << " atomic64" << std::endl;
6859
}
@@ -93,12 +84,6 @@ int main() {
9384
if (plt.has(aspect::usm_atomic_shared_allocations)) {
9485
std::cout << " USM atomic shared allocations" << std::endl;
9586
}
96-
if (plt.has(aspect::usm_restricted_shared_allocations)) {
97-
std::cout << " USM restricted shared allocations" << std::endl;
98-
}
99-
if (plt.has(aspect::usm_system_allocator)) {
100-
std::cout << " USM system allocator" << std::endl;
101-
}
10287
if (plt.has(aspect::usm_system_allocations)) {
10388
std::cout << " USM system allocations" << std::endl;
10489
}

SYCL/Basic/diagnostics/non-uniform-wk-gp-test.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,10 @@ int test() {
5252
int main() {
5353
int pltCount = 0, ret = 0;
5454
for (const auto &plt : platform::get_platforms()) {
55-
if (!plt.has(aspect::host)) {
56-
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
57-
if (plt.get_backend() == backend::ext_oneapi_level_zero) {
58-
std::cout << "Backend: Level Zero" << std::endl;
59-
ret += test();
60-
}
55+
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
56+
if (plt.get_backend() == backend::ext_oneapi_level_zero) {
57+
std::cout << "Backend: Level Zero" << std::endl;
58+
ret += test();
6159
}
6260
std::cout << std::endl;
6361
}

SYCL/Basic/intel-ext-device.cpp

Lines changed: 115 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -35,136 +35,129 @@ int main(int argc, char **argv) {
3535

3636
int pltCount = 1;
3737
for (const auto &plt : platform::get_platforms()) {
38-
if (!plt.has(aspect::host)) {
39-
int devCount = 1;
40-
int totalEUs = 0;
41-
int numSlices = 0;
42-
int numSubslices = 0;
43-
int numEUsPerSubslice = 0;
44-
int numHWThreadsPerEU = 0;
45-
for (const auto &dev : plt.get_devices()) {
46-
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
47-
if (dev.has(aspect::gpu)) {
48-
auto name = dev.get_info<info::device::name>();
49-
std::cout << "Device #" << devCount++ << ": "
50-
<< dev.get_info<info::device::name>() << ":" << std::endl;
51-
52-
std::cout << "Backend: ";
53-
if (plt.get_backend() == backend::ext_oneapi_level_zero) {
54-
std::cout << "Level Zero" << std::endl;
55-
} else if (plt.get_backend() == backend::opencl) {
56-
std::cout << "OpenCL" << std::endl;
57-
} else if (plt.get_backend() == backend::ext_oneapi_cuda) {
58-
std::cout << "CUDA" << std::endl;
59-
} else {
60-
std::cout << "Unknown" << std::endl;
61-
}
38+
int devCount = 1;
39+
int totalEUs = 0;
40+
int numSlices = 0;
41+
int numSubslices = 0;
42+
int numEUsPerSubslice = 0;
43+
int numHWThreadsPerEU = 0;
44+
for (const auto &dev : plt.get_devices()) {
45+
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
46+
if (dev.has(aspect::gpu)) {
47+
auto name = dev.get_info<info::device::name>();
48+
std::cout << "Device #" << devCount++ << ": "
49+
<< dev.get_info<info::device::name>() << ":" << std::endl;
50+
51+
std::cout << "Backend: ";
52+
if (plt.get_backend() == backend::ext_oneapi_level_zero) {
53+
std::cout << "Level Zero" << std::endl;
54+
} else if (plt.get_backend() == backend::opencl) {
55+
std::cout << "OpenCL" << std::endl;
56+
} else if (plt.get_backend() == backend::ext_oneapi_cuda) {
57+
std::cout << "CUDA" << std::endl;
58+
} else {
59+
std::cout << "Unknown" << std::endl;
60+
}
6261

63-
// Use Feature Test macro to see if extensions are supported.
64-
if (SYCL_EXT_INTEL_DEVICE_INFO >= 1) {
62+
// Use Feature Test macro to see if extensions are supported.
63+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 1) {
6564

66-
if (dev.has(aspect::ext_intel_pci_address)) {
67-
std::cout << "PCI address = "
68-
<< dev.get_info<ext::intel::info::device::pci_address>()
69-
<< std::endl;
70-
}
71-
if (dev.has(aspect::ext_intel_gpu_eu_count)) {
72-
totalEUs = dev.get_info<ext::intel::info::device::gpu_eu_count>();
73-
std::cout << "Number of EUs = " << totalEUs << std::endl;
74-
}
75-
if (dev.has(aspect::ext_intel_gpu_eu_simd_width)) {
76-
int w =
77-
dev.get_info<ext::intel::info::device::gpu_eu_simd_width>();
78-
std::cout << "EU SIMD width = " << w << std::endl;
79-
}
80-
if (dev.has(aspect::ext_intel_gpu_slices)) {
81-
numSlices = dev.get_info<ext::intel::info::device::gpu_slices>();
82-
std::cout << "Number of slices = " << numSlices << std::endl;
83-
}
84-
if (dev.has(aspect::ext_intel_gpu_subslices_per_slice)) {
85-
numSubslices = dev.get_info<
86-
ext::intel::info::device::gpu_subslices_per_slice>();
87-
std::cout << "Number of subslices per slice = " << numSubslices
88-
<< std::endl;
89-
}
90-
if (dev.has(aspect::ext_intel_gpu_eu_count_per_subslice)) {
91-
numEUsPerSubslice = dev.get_info<
92-
ext::intel::info::device::gpu_eu_count_per_subslice>();
93-
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
94-
<< std::endl;
95-
}
96-
if (SYCL_EXT_INTEL_DEVICE_INFO >= 3 &&
97-
dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
98-
numHWThreadsPerEU = dev.get_info<
99-
ext::intel::info::device::gpu_hw_threads_per_eu>();
100-
std::cout << "Number of HW threads per EU = " << numHWThreadsPerEU
101-
<< std::endl;
102-
}
103-
if (dev.has(aspect::ext_intel_max_mem_bandwidth)) {
104-
// not supported yet
105-
long m =
106-
dev.get_info<ext::intel::info::device::max_mem_bandwidth>();
107-
std::cout << "Maximum memory bandwidth = " << m << std::endl;
108-
}
109-
// This is the only data we can verify.
110-
if (totalEUs != numSlices * numSubslices * numEUsPerSubslice) {
111-
std::cout << "Error: EU Count is incorrect!" << std::endl;
112-
std::cout << "Failed!" << std::endl;
113-
return 1;
114-
}
115-
if (SYCL_EXT_INTEL_DEVICE_INFO >= 2 &&
116-
dev.has(aspect::ext_intel_device_info_uuid)) {
117-
auto UUID = dev.get_info<ext::intel::info::device::uuid>();
118-
std::cout << "Device UUID = ";
119-
for (int i = 0; i < 16; i++) {
120-
std::cout << std::to_string(UUID[i]);
121-
}
122-
std::cout << "\n";
123-
}
124-
if (SYCL_EXT_INTEL_DEVICE_INFO >= 5 &&
125-
dev.has(aspect::ext_intel_device_id)) {
126-
int deviceID =
127-
dev.get_info<ext::intel::info::device::device_id>();
128-
std::cout << "Device ID = " << deviceID << std::endl;
65+
if (dev.has(aspect::ext_intel_pci_address)) {
66+
std::cout << "PCI address = "
67+
<< dev.get_info<ext::intel::info::device::pci_address>()
68+
<< std::endl;
69+
}
70+
if (dev.has(aspect::ext_intel_gpu_eu_count)) {
71+
totalEUs = dev.get_info<ext::intel::info::device::gpu_eu_count>();
72+
std::cout << "Number of EUs = " << totalEUs << std::endl;
73+
}
74+
if (dev.has(aspect::ext_intel_gpu_eu_simd_width)) {
75+
int w = dev.get_info<ext::intel::info::device::gpu_eu_simd_width>();
76+
std::cout << "EU SIMD width = " << w << std::endl;
77+
}
78+
if (dev.has(aspect::ext_intel_gpu_slices)) {
79+
numSlices = dev.get_info<ext::intel::info::device::gpu_slices>();
80+
std::cout << "Number of slices = " << numSlices << std::endl;
81+
}
82+
if (dev.has(aspect::ext_intel_gpu_subslices_per_slice)) {
83+
numSubslices = dev.get_info<
84+
ext::intel::info::device::gpu_subslices_per_slice>();
85+
std::cout << "Number of subslices per slice = " << numSubslices
86+
<< std::endl;
87+
}
88+
if (dev.has(aspect::ext_intel_gpu_eu_count_per_subslice)) {
89+
numEUsPerSubslice = dev.get_info<
90+
ext::intel::info::device::gpu_eu_count_per_subslice>();
91+
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
92+
<< std::endl;
93+
}
94+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 3 &&
95+
dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
96+
numHWThreadsPerEU =
97+
dev.get_info<ext::intel::info::device::gpu_hw_threads_per_eu>();
98+
std::cout << "Number of HW threads per EU = " << numHWThreadsPerEU
99+
<< std::endl;
100+
}
101+
if (dev.has(aspect::ext_intel_max_mem_bandwidth)) {
102+
// not supported yet
103+
long m =
104+
dev.get_info<ext::intel::info::device::max_mem_bandwidth>();
105+
std::cout << "Maximum memory bandwidth = " << m << std::endl;
106+
}
107+
// This is the only data we can verify.
108+
if (totalEUs != numSlices * numSubslices * numEUsPerSubslice) {
109+
std::cout << "Error: EU Count is incorrect!" << std::endl;
110+
std::cout << "Failed!" << std::endl;
111+
return 1;
112+
}
113+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 2 &&
114+
dev.has(aspect::ext_intel_device_info_uuid)) {
115+
auto UUID = dev.get_info<ext::intel::info::device::uuid>();
116+
std::cout << "Device UUID = ";
117+
for (int i = 0; i < 16; i++) {
118+
std::cout << std::to_string(UUID[i]);
129119
}
130-
} // SYCL_EXT_INTEL_DEVICE_INFO
131-
}
120+
std::cout << "\n";
121+
}
122+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 5 &&
123+
dev.has(aspect::ext_intel_device_id)) {
124+
int deviceID = dev.get_info<ext::intel::info::device::device_id>();
125+
std::cout << "Device ID = " << deviceID << std::endl;
126+
}
127+
} // SYCL_EXT_INTEL_DEVICE_INFO
128+
}
132129

133130
// Check if this experimental feature is supported
134131
#ifdef SYCL_EXT_ONEAPI_MAX_WORK_GROUP_QUERY
135-
sycl::id<1> groupD =
136-
dev.get_info<sycl::ext::oneapi::experimental::info::device::
137-
max_work_groups<1>>();
138-
std::cout << "Max work group size in 1D \n";
139-
std::cout << "Dimension 1:" << groupD[0] << std::endl;
140-
141-
sycl::id<2> group2D =
142-
dev.get_info<sycl::ext::oneapi::experimental::info::device::
143-
max_work_groups<2>>();
144-
std::cout << "Max work group size in 2D \n";
145-
std::cout << "Dimension 1:" << group2D[0] << "\n"
146-
<< "Dimension 2:" << group2D[1] << std::endl;
147-
148-
sycl::id<3> group3D =
149-
dev.get_info<sycl::ext::oneapi::experimental::info::device::
150-
max_work_groups<3>>();
151-
std::cout << "Max work group size in 3D \n";
152-
std::cout << "Dimension 1:" << group3D[0] << "\n"
153-
<< "Dimension 2:" << group3D[1] << "\n"
154-
<< "Dimension 3:" << group3D[2] << std::endl;
155-
156-
size_t group_max = dev.get_info<sycl::ext::oneapi::experimental::info::
157-
device::max_global_work_groups>();
158-
std::cout << "Max global work group size:" << group_max << "\n";
159-
160-
assert((group3D[0] <= group_max && group3D[1] <= group_max &&
161-
group3D[2] <= group_max) &&
162-
"Max work-group size of each dimension must be smaller than "
163-
"global work-group size");
132+
sycl::id<1> groupD = dev.get_info<
133+
sycl::ext::oneapi::experimental::info::device::max_work_groups<1>>();
134+
std::cout << "Max work group size in 1D \n";
135+
std::cout << "Dimension 1:" << groupD[0] << std::endl;
136+
137+
sycl::id<2> group2D = dev.get_info<
138+
sycl::ext::oneapi::experimental::info::device::max_work_groups<2>>();
139+
std::cout << "Max work group size in 2D \n";
140+
std::cout << "Dimension 1:" << group2D[0] << "\n"
141+
<< "Dimension 2:" << group2D[1] << std::endl;
142+
143+
sycl::id<3> group3D = dev.get_info<
144+
sycl::ext::oneapi::experimental::info::device::max_work_groups<3>>();
145+
std::cout << "Max work group size in 3D \n";
146+
std::cout << "Dimension 1:" << group3D[0] << "\n"
147+
<< "Dimension 2:" << group3D[1] << "\n"
148+
<< "Dimension 3:" << group3D[2] << std::endl;
149+
150+
size_t group_max = dev.get_info<sycl::ext::oneapi::experimental::info::
151+
device::max_global_work_groups>();
152+
std::cout << "Max global work group size:" << group_max << "\n";
153+
154+
assert((group3D[0] <= group_max && group3D[1] <= group_max &&
155+
group3D[2] <= group_max) &&
156+
"Max work-group size of each dimension must be smaller than "
157+
"global work-group size");
164158
#endif
165159

166-
std::cout << std::endl;
167-
}
160+
std::cout << std::endl;
168161
}
169162
}
170163
std::cout << "Passed!" << std::endl;

0 commit comments

Comments
 (0)