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

Commit 4514445

Browse files
committed
Merge remote-tracking branch 'origin/intel' into private/asachkov/update-tests-for-optional-double
2 parents 4424a47 + 1f44112 commit 4514445

File tree

88 files changed

+644
-235
lines changed

Some content is hidden

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

88 files changed

+644
-235
lines changed

SYCL/Assert/assert_in_simultaneous_kernels.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: linux
2-
// FIXME: Flaky on HIP
3-
// UNSUPPORTED: hip
2+
// FIXME: Flaky on HIP and cuda
3+
// UNSUPPORTED: hip || cuda
44
// RUN: %clangxx -DSYCL_FALLBACK_ASSERT=1 -fsycl -fsycl-targets=%sycl_triple %s -o %t.out %threads_lib
55
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
66
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt

SYCL/AtomicRef/assignment_atomic64.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
1+
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=%sycl_triple %s -o %t.out
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out
@@ -10,13 +10,18 @@ using namespace sycl;
1010
int main() {
1111
queue q;
1212

13-
if (!q.get_device().has(aspect::atomic64)) {
13+
device dev = q.get_device();
14+
15+
if (!dev.has(aspect::atomic64)) {
1416
std::cout << "Skipping test\n";
1517
return 0;
1618
}
1719

20+
const bool DoublesSupported = dev.has(sycl::aspect::fp64);
21+
1822
constexpr int N = 32;
19-
assignment_test<double>(q, N);
23+
if (DoublesSupported)
24+
assignment_test<double>(q, N);
2025

2126
// Include long tests if they are 64 bits wide
2227
if constexpr (sizeof(long) == 8) {

SYCL/AtomicRef/assignment_atomic64_generic.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
1+
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=%sycl_triple %s -o %t.out
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// RUN: %ACC_RUN_PLACEHOLDER %t.out
@@ -13,13 +13,18 @@ using namespace sycl;
1313
int main() {
1414
queue q;
1515

16-
if (!q.get_device().has(aspect::atomic64)) {
16+
device dev = q.get_device();
17+
18+
if (!dev.has(aspect::atomic64)) {
1719
std::cout << "Skipping test\n";
1820
return 0;
1921
}
2022

23+
const bool DoublesSupported = dev.has(sycl::aspect::fp64);
24+
2125
constexpr int N = 32;
22-
assignment_generic_test<double>(q, N);
26+
if (DoublesSupported)
27+
assignment_generic_test<double>(q, N);
2328

2429
// Include long tests if they are 64 bits wide
2530
if constexpr (sizeof(long) == 8) {

SYCL/Basic/buffer/buffer.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,15 @@ int main() {
510510
[](bool *data) { delete[] data; });
511511
std::shared_ptr<int> int_shrd(new int[size],
512512
[](int *data) { delete[] data; });
513-
std::shared_ptr<double> double_shrd(new double[size],
514-
[](double *data) { delete[] data; });
513+
std::shared_ptr<float> float_shrd(new float[size],
514+
[](float *data) { delete[] data; });
515515

516516
std::vector<bool> bool_vector;
517517
std::vector<int> int_vector;
518-
std::vector<double> double_vector;
518+
std::vector<float> float_vector;
519519
bool_vector.reserve(size);
520520
int_vector.reserve(size);
521-
double_vector.reserve(size);
521+
float_vector.reserve(size);
522522

523523
sycl::queue Queue;
524524
std::mutex m;
@@ -529,40 +529,40 @@ int main() {
529529
sycl::buffer<int, dims> buf_int_shrd(
530530
int_shrd, r,
531531
sycl::property_list{sycl::property::buffer::use_mutex(m)});
532-
sycl::buffer<double, dims> buf_double_shrd(
533-
double_shrd, r,
532+
sycl::buffer<float, dims> buf_float_shrd(
533+
float_shrd, r,
534534
sycl::property_list{sycl::property::buffer::use_mutex(m)});
535535
m.lock();
536536
std::fill(bool_shrd.get(), (bool_shrd.get() + size), bool());
537537
std::fill(int_shrd.get(), (int_shrd.get() + size), int());
538-
std::fill(double_shrd.get(), (double_shrd.get() + size), double());
538+
std::fill(float_shrd.get(), (float_shrd.get() + size), float());
539539
m.unlock();
540540

541541
buf_bool_shrd.set_final_data(bool_vector.begin());
542542
buf_int_shrd.set_final_data(int_vector.begin());
543-
buf_double_shrd.set_final_data(double_vector.begin());
543+
buf_float_shrd.set_final_data(float_vector.begin());
544544
buf_bool_shrd.set_write_back(true);
545545
buf_int_shrd.set_write_back(true);
546-
buf_double_shrd.set_write_back(true);
546+
buf_float_shrd.set_write_back(true);
547547

548548
Queue.submit([&](sycl::handler &cgh) {
549549
auto Accessor_bool =
550550
buf_bool_shrd.get_access<sycl::access::mode::write>(cgh);
551551
auto Accessor_int =
552552
buf_int_shrd.get_access<sycl::access::mode::write>(cgh);
553-
auto Accessor_double =
554-
buf_double_shrd.get_access<sycl::access::mode::write>(cgh);
553+
auto Accessor_float =
554+
buf_float_shrd.get_access<sycl::access::mode::write>(cgh);
555555
cgh.parallel_for<class FillBuffer>(r, [=](sycl::id<1> WIid) {
556556
Accessor_bool[WIid] = true;
557557
Accessor_int[WIid] = 3;
558-
Accessor_double[WIid] = 7.5;
558+
Accessor_float[WIid] = 7.5;
559559
});
560560
});
561561
} // Data is copied back
562562

563563
for (size_t i = 0; i < size; i++) {
564564
if (bool_vector[i] != true || int_vector[i] != 3 ||
565-
double_vector[i] != 7.5) {
565+
float_vector[i] != 7.5) {
566566
assert(false && "Data was not copied back");
567567
return 1;
568568
}

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
}

SYCL/Basic/subdevice.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: %HOST_RUN_PLACEHOLDER %t.out
32
// RUN: %CPU_RUN_PLACEHOLDER %t.out
43
// RUN: %GPU_RUN_PLACEHOLDER %t.out
54
// RUN: %ACC_RUN_PLACEHOLDER %t.out
@@ -25,10 +24,6 @@ int main() {
2524
try {
2625
auto devices = device::get_devices();
2726
for (const auto &dev : devices) {
28-
// TODO: implement subdevices creation for host device
29-
if (dev.is_host())
30-
continue;
31-
3227
assert(dev.get_info<info::device::partition_type_property>() ==
3328
info::partition_property::no_partition);
3429

SYCL/Basic/subsubdevice.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2-
// RUN: %HOST_RUN_PLACEHOLDER %t.out
32
// RUN: %CPU_RUN_PLACEHOLDER %t.out
43
// RUN: %GPU_RUN_PLACEHOLDER %t.out
54
// RUN: %ACC_RUN_PLACEHOLDER %t.out
@@ -25,10 +24,6 @@ int main() {
2524
try {
2625
auto devices = device::get_devices();
2726
for (const auto &dev : devices) {
28-
// TODO: implement subdevices creation for host device
29-
if (dev.is_host())
30-
continue;
31-
3227
assert(dev.get_info<info::device::partition_type_property>() ==
3328
info::partition_property::no_partition);
3429

0 commit comments

Comments
 (0)