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

Commit be4717c

Browse files
authored
[SYCL] Modify test for changing namespace for intel device info extensions (#1178)
1 parent 51c9fe5 commit be4717c

File tree

69 files changed

+302
-85
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+302
-85
lines changed

SYCL/Basic/intel-ext-device.cpp

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
// UNSUPPORTED: cuda
77
// UNSUPPORTED: hip
88
// Temporarily disable on L0 due to fails in CI
9-
// UNSUPPORTED: level_zero
109

1110
//==--------- intel-ext-device.cpp - SYCL device test ------------==//
1211
//
@@ -21,6 +20,7 @@
2120

2221
#include <sycl/sycl.hpp>
2322

23+
#include <cassert>
2424
#include <iostream>
2525

2626
using namespace sycl;
@@ -66,43 +66,45 @@ int main(int argc, char **argv) {
6666

6767
if (dev.has(aspect::ext_intel_pci_address)) {
6868
std::cout << "PCI address = "
69-
<< dev.get_info<info::device::ext_intel_pci_address>()
69+
<< dev.get_info<ext::intel::info::device::pci_address>()
7070
<< std::endl;
7171
}
7272
if (dev.has(aspect::ext_intel_gpu_eu_count)) {
73-
totalEUs = dev.get_info<info::device::ext_intel_gpu_eu_count>();
73+
totalEUs = dev.get_info<ext::intel::info::device::gpu_eu_count>();
7474
std::cout << "Number of EUs = " << totalEUs << std::endl;
7575
}
7676
if (dev.has(aspect::ext_intel_gpu_eu_simd_width)) {
77-
int w = dev.get_info<info::device::ext_intel_gpu_eu_simd_width>();
77+
int w =
78+
dev.get_info<ext::intel::info::device::gpu_eu_simd_width>();
7879
std::cout << "EU SIMD width = " << w << std::endl;
7980
}
8081
if (dev.has(aspect::ext_intel_gpu_slices)) {
81-
numSlices = dev.get_info<info::device::ext_intel_gpu_slices>();
82+
numSlices = dev.get_info<ext::intel::info::device::gpu_slices>();
8283
std::cout << "Number of slices = " << numSlices << std::endl;
8384
}
8485
if (dev.has(aspect::ext_intel_gpu_subslices_per_slice)) {
8586
numSubslices = dev.get_info<
86-
info::device::ext_intel_gpu_subslices_per_slice>();
87+
ext::intel::info::device::gpu_subslices_per_slice>();
8788
std::cout << "Number of subslices per slice = " << numSubslices
8889
<< std::endl;
8990
}
9091
if (dev.has(aspect::ext_intel_gpu_eu_count_per_subslice)) {
9192
numEUsPerSubslice = dev.get_info<
92-
info::device::ext_intel_gpu_eu_count_per_subslice>();
93+
ext::intel::info::device::gpu_eu_count_per_subslice>();
9394
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
9495
<< std::endl;
9596
}
96-
if (dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
97-
numHWThreadsPerEU =
98-
dev.get_info<info::device::ext_intel_gpu_hw_threads_per_eu>();
97+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 3 &&
98+
dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
99+
numHWThreadsPerEU = dev.get_info<
100+
ext::intel::info::device::gpu_hw_threads_per_eu>();
99101
std::cout << "Number of HW threads per EU = " << numHWThreadsPerEU
100102
<< std::endl;
101103
}
102104
if (dev.has(aspect::ext_intel_max_mem_bandwidth)) {
103105
// not supported yet
104106
long m =
105-
dev.get_info<info::device::ext_intel_max_mem_bandwidth>();
107+
dev.get_info<ext::intel::info::device::max_mem_bandwidth>();
106108
std::cout << "Maximum memory bandwidth = " << m << std::endl;
107109
}
108110
// This is the only data we can verify.
@@ -111,8 +113,51 @@ int main(int argc, char **argv) {
111113
std::cout << "Failed!" << std::endl;
112114
return 1;
113115
}
116+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 2 &&
117+
dev.has(aspect::ext_intel_device_info_uuid)) {
118+
auto UUID = dev.get_info<ext::intel::info::device::uuid>();
119+
std::cout << "Device UUID = ";
120+
for (int i = 0; i < 16; i++) {
121+
std::cout << std::to_string(UUID[i]);
122+
}
123+
std::cout << "\n";
124+
}
114125
} // SYCL_EXT_INTEL_DEVICE_INFO
115126
}
127+
128+
// Check if this experimental feature is supported
129+
#ifdef SYCL_EXT_ONEAPI_MAX_WORK_GROUP_QUERY
130+
sycl::id<1> groupD =
131+
dev.get_info<sycl::ext::oneapi::experimental::info::device::
132+
max_work_groups<1>>();
133+
std::cout << "Max work group size in 1D \n";
134+
std::cout << "Dimension 1:" << groupD[0] << std::endl;
135+
136+
sycl::id<2> group2D =
137+
dev.get_info<sycl::ext::oneapi::experimental::info::device::
138+
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 =
144+
dev.get_info<sycl::ext::oneapi::experimental::info::device::
145+
max_work_groups<3>>();
146+
std::cout << "Max work group size in 3D \n";
147+
std::cout << "Dimension 1:" << group3D[0] << "\n"
148+
<< "Dimension 2:" << group3D[1] << "\n"
149+
<< "Dimension 3:" << group3D[2] << std::endl;
150+
151+
size_t group_max = dev.get_info<sycl::ext::oneapi::experimental::info::
152+
device::max_global_work_groups>();
153+
std::cout << "Max global work group size:" << group_max << "\n";
154+
155+
assert((group3D[0] <= group_max && group3D[1] <= group_max &&
156+
group3D[2] <= group_max) &&
157+
"Max work-group size of each dimension must be smaller than "
158+
"global work-group size");
159+
#endif
160+
116161
std::cout << std::endl;
117162
}
118163
}
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out
2+
// RUN: env SYCL_DEVICE_FILTER=level_zero:gpu %t.out
3+
// RUN: env SYCL_DEVICE_FILTER=opencl:gpu %t.out
4+
//
5+
// REQUIRES: gpu
6+
// UNSUPPORTED: cuda
7+
// UNSUPPORTED: hip
8+
// Temporarily disable on L0 due to fails in CI
9+
// UNSUPPORTED: level_zero
10+
11+
//==--------- intel-ext-device.cpp - SYCL device test ------------==//
12+
//
13+
// Returns the low-level device details. These are Intel-specific extensions
14+
// that are only supported on Level Zero.
15+
//
16+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
17+
// See https://llvm.org/LICENSE.txt for license information.
18+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
19+
//
20+
//===----------------------------------------------------------------------===//
21+
22+
#include <sycl/sycl.hpp>
23+
24+
#include <cassert>
25+
#include <iostream>
26+
27+
using namespace sycl;
28+
29+
#ifdef _WIN32
30+
#define setenv(name, value, overwrite) _putenv_s(name, value)
31+
#endif
32+
33+
int main(int argc, char **argv) {
34+
// Must be enabled at the beginning of the application
35+
// to obtain the PCI address
36+
setenv("SYCL_ENABLE_PCI", "1", 0);
37+
38+
int pltCount = 1;
39+
for (const auto &plt : platform::get_platforms()) {
40+
if (!plt.has(aspect::host)) {
41+
int devCount = 1;
42+
int totalEUs = 0;
43+
int numSlices = 0;
44+
int numSubslices = 0;
45+
int numEUsPerSubslice = 0;
46+
int numHWThreadsPerEU = 0;
47+
for (const auto &dev : plt.get_devices()) {
48+
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
49+
if (dev.has(aspect::gpu)) {
50+
auto name = dev.get_info<info::device::name>();
51+
std::cout << "Device #" << devCount++ << ": "
52+
<< dev.get_info<info::device::name>() << ":" << std::endl;
53+
54+
std::cout << "Backend: ";
55+
if (plt.get_backend() == backend::ext_oneapi_level_zero) {
56+
std::cout << "Level Zero" << std::endl;
57+
} else if (plt.get_backend() == backend::opencl) {
58+
std::cout << "OpenCL" << std::endl;
59+
} else if (plt.get_backend() == backend::ext_oneapi_cuda) {
60+
std::cout << "CUDA" << std::endl;
61+
} else {
62+
std::cout << "Unknown" << std::endl;
63+
}
64+
65+
// Use Feature Test macro to see if extensions are supported.
66+
if (SYCL_EXT_INTEL_DEVICE_INFO >= 1) {
67+
68+
if (dev.has(aspect::ext_intel_pci_address)) {
69+
std::cout << "PCI address = "
70+
<< dev.get_info<info::device::ext_intel_pci_address>()
71+
<< std::endl;
72+
}
73+
if (dev.has(aspect::ext_intel_gpu_eu_count)) {
74+
totalEUs = dev.get_info<info::device::ext_intel_gpu_eu_count>();
75+
std::cout << "Number of EUs = " << totalEUs << std::endl;
76+
}
77+
if (dev.has(aspect::ext_intel_gpu_eu_simd_width)) {
78+
int w = dev.get_info<info::device::ext_intel_gpu_eu_simd_width>();
79+
std::cout << "EU SIMD width = " << w << std::endl;
80+
}
81+
if (dev.has(aspect::ext_intel_gpu_slices)) {
82+
numSlices = dev.get_info<info::device::ext_intel_gpu_slices>();
83+
std::cout << "Number of slices = " << numSlices << std::endl;
84+
}
85+
if (dev.has(aspect::ext_intel_gpu_subslices_per_slice)) {
86+
numSubslices = dev.get_info<
87+
info::device::ext_intel_gpu_subslices_per_slice>();
88+
std::cout << "Number of subslices per slice = " << numSubslices
89+
<< std::endl;
90+
}
91+
if (dev.has(aspect::ext_intel_gpu_eu_count_per_subslice)) {
92+
numEUsPerSubslice = dev.get_info<
93+
info::device::ext_intel_gpu_eu_count_per_subslice>();
94+
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
95+
<< std::endl;
96+
}
97+
if (dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
98+
numHWThreadsPerEU =
99+
dev.get_info<info::device::ext_intel_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<info::device::ext_intel_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+
} // SYCL_EXT_INTEL_DEVICE_INFO
116+
}
117+
std::cout << std::endl;
118+
}
119+
}
120+
}
121+
std::cout << "Passed!" << std::endl;
122+
return 0;
123+
}

SYCL/ESIMD/PrefixSum.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ int main(int argc, char *argv[]) {
395395
property::queue::in_order());
396396

397397
auto dev = q.get_device();
398-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
398+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
399+
<< "\n";
399400
auto ctxt = q.get_context();
400401

401402
// allocate and initialized input

SYCL/ESIMD/Prefix_Local_sum1.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ int main(int argc, char *argv[]) {
129129
property::queue::enable_profiling{});
130130

131131
auto dev = q.get_device();
132-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
132+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
133+
<< "\n";
133134

134135
// allocate and initialized input
135136
unsigned int *pInputs = static_cast<unsigned int *>(

SYCL/ESIMD/Prefix_Local_sum2.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ int main(int argc, char *argv[]) {
124124
property::queue::enable_profiling{});
125125

126126
auto dev = q.get_device();
127-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
127+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
128+
<< "\n";
128129

129130
// allocate and initialized input
130131
unsigned int *pInputs = static_cast<unsigned int *>(

SYCL/ESIMD/Prefix_Local_sum3.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,8 @@ int main(int argc, char *argv[]) {
328328
property::queue::enable_profiling{});
329329

330330
auto dev = q.get_device();
331-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
331+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
332+
<< "\n";
332333

333334
// allocate and initialized input data
334335
unsigned int *pInputs = static_cast<unsigned int *>(

SYCL/ESIMD/acc_gather_scatter_rgba.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@ int main(void) {
164164
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
165165

166166
auto dev = q.get_device();
167-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
167+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
168+
<< "\n";
168169

169170
bool passed = true;
170171
passed &= test<int, 16, 1>(q);

SYCL/ESIMD/api/ballot.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ template <class T> bool test(queue &Q) {
9090
int main(void) {
9191
queue Q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
9292
auto Dev = Q.get_device();
93-
std::cout << "Running on " << Dev.get_info<info::device::name>() << "\n";
93+
std::cout << "Running on " << Dev.get_info<sycl::info::device::name>()
94+
<< "\n";
9495

9596
bool Pass = true;
9697
Pass &= test<ushort>(Q);

SYCL/ESIMD/api/bin_and_cmp_ops_heavy.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ int main(void) {
258258
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
259259

260260
auto dev = q.get_device();
261-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
261+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
262+
<< "\n";
262263
bool passed = true;
263264
using BinOp = esimd_test::BinaryOp;
264265

SYCL/ESIMD/api/esimd_bit_ops.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ template <typename T, int N, int Op> bool test(queue q) {
122122
int main(int argc, char **argv) {
123123
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
124124
auto dev = q.get_device();
125-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
125+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
126+
<< "\n";
126127

127128
bool passed = true;
128129
passed &= test<char, 32, bit_op::cbit>(q);

SYCL/ESIMD/api/esimd_merge.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ int main(void) {
4141
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
4242

4343
auto dev = q.get_device();
44-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
44+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
45+
<< "\n";
4546

4647
int *A = malloc_shared<int>(Size, q);
4748
int *B = malloc_shared<int>(Size, q);

SYCL/ESIMD/api/esimd_pack_unpack_mask.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ template <int N> bool test(queue q) {
113113
int main(int argc, char **argv) {
114114
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
115115
auto dev = q.get_device();
116-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
116+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
117+
<< "\n";
117118

118119
bool passed = true;
119120
passed &= test<1>(q);

SYCL/ESIMD/api/esimd_rgba_smoke.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ int main(void) {
203203
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
204204

205205
auto dev = q.get_device();
206-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
206+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>() << "\n";
207207
bool passed = true;
208208
// Only these four masks are supported for rgba write operations:
209209
passed &= test<rgba_channel_mask::ABGR>(q);

SYCL/ESIMD/api/replicate_smoke.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ template <class T> bool test(queue q) {
175175
int main(int argc, char **argv) {
176176
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
177177
auto dev = q.get_device();
178-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
178+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
179+
<< "\n";
179180
bool passed = true;
180181

181182
passed &= test<half>(q);

SYCL/ESIMD/api/saturation_smoke.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ template <class From, class To> struct FpToFp : public DataMgr<From, To, 5> {
182182
int main(int argc, char **argv) {
183183
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
184184
auto dev = q.get_device();
185-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
185+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
186+
<< "\n";
186187

187188
bool passed = true;
188189
passed &= test<half, int, FpToInt>(q);

SYCL/ESIMD/api/simd_any_all.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ template <class T1, class T2> bool test(queue q) {
141141
int main(int argc, char **argv) {
142142
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
143143
auto dev = q.get_device();
144-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
144+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
145+
<< "\n";
145146

146147
bool passed = true;
147148
passed &= test<int8_t, uint8_t>(q);

SYCL/ESIMD/api/simd_binop_integer_promotion.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ int main(int argc, char **argv) {
105105
queue q(esimd_test::ESIMDSelector{}, esimd_test::createExceptionHandler());
106106

107107
auto dev = q.get_device();
108-
std::cout << "Running on " << dev.get_info<info::device::name>() << "\n";
108+
std::cout << "Running on " << dev.get_info<sycl::info::device::name>()
109+
<< "\n";
109110

110111
bool passed = true;
111112
passed &= test<unsigned short>(q);

0 commit comments

Comments
 (0)