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

Commit 9b7519b

Browse files
author
Alexander Batashev
committed
Merge remote-tracking branch 'upstream/intel' into xpti_tests
2 parents ab58469 + cdec1a2 commit 9b7519b

25 files changed

+221
-114
lines changed

SYCL/Basic/barrier_order.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// UNSUPPORTED: hip
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %HOST_RUN_PLACEHOLDER %t.out
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,13 @@
1313
using namespace cl::sycl;
1414

1515
int test() {
16-
try {
17-
queue q = queue();
18-
auto device = q.get_device();
19-
auto deviceName = device.get_info<cl::sycl::info::device::name>();
20-
std::cout << " Device Name: " << deviceName << std::endl;
16+
queue q = queue();
17+
auto device = q.get_device();
18+
auto deviceName = device.get_info<cl::sycl::info::device::name>();
19+
std::cout << " Device Name: " << deviceName << std::endl;
2120

21+
int res = 1;
22+
try {
2223
const int N = 1;
2324
q.submit([&](handler &cgh) {
2425
cl::sycl::stream kernelout(108 * 64 + 128, 64, cgh);
@@ -29,23 +30,23 @@ int test() {
2930
<< cl::sycl::endl;
3031
});
3132
});
32-
33+
std::cout << "Test failed: no exception thrown." << std::endl;
3334
} catch (sycl::runtime_error &E) {
3435
if (std::string(E.what()).find(
3536
"Non-uniform work-groups are not supported by the target device") !=
3637
std::string::npos) {
3738
std::cout << E.what() << std::endl;
3839
std::cout << "Test passed: caught the expected error." << std::endl;
39-
return 0;
40+
res = 0;
4041
} else {
4142
std::cout << E.what() << std::endl;
4243
std::cout << "Test failed: received error is incorrect." << std::endl;
43-
return 1;
4444
}
4545
}
46+
q.wait();
4647

4748
std::cout << "Test passed: results are correct." << std::endl;
48-
return 0;
49+
return res;
4950
}
5051

5152
int main() {

SYCL/Basic/enqueue_barrier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// The test is failing sporadically on Windows OpenCL RTs
77
// Disabling on windows until fixed
8-
// UNSUPPORTED: windows
8+
// UNSUPPORTED: hip_amd, windows
99

1010
#include <CL/sycl.hpp>
1111
#include <sycl/ext/intel/fpga_device_selector.hpp>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// REQUIRES: aoc, accelerator
2+
// RUN: %clangxx -fsycl -fintelfpga %s -o %t.out
3+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
4+
//==- fpga_latency_control_lsu.cpp - SYCL FPGA latency control on LSU test -==//
5+
//
6+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7+
// See https://llvm.org/LICENSE.txt for license information.
8+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9+
//
10+
//===----------------------------------------------------------------------===//
11+
#include <CL/sycl.hpp>
12+
#include <sycl/ext/intel/fpga_extensions.hpp>
13+
14+
using namespace sycl;
15+
16+
using PrefetchingLSU = ext::intel::experimental::lsu<
17+
ext::intel::experimental::prefetch<true>,
18+
ext::intel::experimental::statically_coalesce<false>>;
19+
20+
using BurstCoalescedLSU = ext::intel::experimental::lsu<
21+
ext::intel::experimental::burst_coalesce<true>,
22+
ext::intel::experimental::statically_coalesce<false>>;
23+
24+
int test_latency_control(queue Queue) {
25+
std::vector<float> input_data = {1.23f};
26+
std::vector<float> output_data = {.0f};
27+
28+
{
29+
buffer input_buffer(input_data);
30+
buffer output_buffer(output_data);
31+
32+
Queue.submit([&](handler &cgh) {
33+
auto input_accessor = input_buffer.get_access<access::mode::read>(cgh);
34+
35+
auto output_accessor = output_buffer.get_access<access::mode::write>(cgh);
36+
37+
cgh.single_task<class kernel>([=] {
38+
auto in_ptr = input_accessor.get_pointer();
39+
auto out_ptr = output_accessor.get_pointer();
40+
41+
float value = PrefetchingLSU::load<
42+
ext::intel::experimental::latency_anchor_id<0>>(in_ptr);
43+
44+
BurstCoalescedLSU::store<ext::intel::experimental::latency_constraint<
45+
0, ext::intel::experimental::type::exact, 5>>(out_ptr, value);
46+
});
47+
});
48+
}
49+
50+
if (output_data[0] != input_data[0]) {
51+
std::cout << "Unexpected read from output_data: " << output_data[0]
52+
<< ", v.s. expected " << input_data[0] << std::endl;
53+
54+
return -1;
55+
}
56+
return 0;
57+
}
58+
59+
int main() {
60+
queue Queue{ext::intel::fpga_emulator_selector{}};
61+
62+
return test_latency_control(Queue);
63+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// REQUIRES: aoc, accelerator
2+
// RUN: %clangxx -fsycl -fintelfpga %s -o %t.out
3+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
4+
//== fpga_latency_control_pipe.cpp - SYCL FPGA latency control on pipe test ==//
5+
//
6+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7+
// See https://llvm.org/LICENSE.txt for license information.
8+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9+
//
10+
//===----------------------------------------------------------------------===//
11+
#include <CL/sycl.hpp>
12+
#include <sycl/ext/intel/fpga_extensions.hpp>
13+
14+
using namespace sycl;
15+
16+
using Pipe1 = ext::intel::experimental::pipe<class PipeClass1, int, 8>;
17+
using Pipe2 = ext::intel::experimental::pipe<class PipeClass2, int, 8>;
18+
19+
int test_latency_control(queue Queue) {
20+
std::vector<int> input_data = {1};
21+
std::vector<int> output_data = {0};
22+
23+
{
24+
buffer input_buffer(input_data);
25+
buffer output_buffer(output_data);
26+
27+
Queue.submit([&](handler &cgh) {
28+
auto input_accessor = input_buffer.get_access<access::mode::read>(cgh);
29+
30+
auto output_accessor = output_buffer.get_access<access::mode::write>(cgh);
31+
32+
cgh.single_task<class kernel>([=] {
33+
Pipe1::write(input_accessor[0]);
34+
35+
int value =
36+
Pipe1::read<ext::intel::experimental::latency_anchor_id<0>>();
37+
38+
Pipe2::write<ext::intel::experimental::latency_anchor_id<1>,
39+
ext::intel::experimental::latency_constraint<
40+
0, ext::intel::experimental::type::exact, 2>>(value);
41+
42+
output_accessor[0] = Pipe2::read();
43+
});
44+
});
45+
}
46+
47+
if (output_data[0] != input_data[0]) {
48+
std::cout << "Unexpected read from output_data: " << output_data[0]
49+
<< ", v.s. expected " << input_data[0] << std::endl;
50+
51+
return -1;
52+
}
53+
return 0;
54+
}
55+
56+
int main() {
57+
queue Queue{ext::intel::fpga_emulator_selector{}};
58+
59+
return test_latency_control(Queue);
60+
}

SYCL/Basic/intel-ext-device.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ int main(int argc, char **argv) {
4040
int numSlices = 0;
4141
int numSubslices = 0;
4242
int numEUsPerSubslice = 0;
43+
int numHWThreadsPerEU = 0;
4344
for (const auto &dev : plt.get_devices()) {
4445
std::cout << "Platform #" << pltCount++ << ":" << std::endl;
4546
if (dev.has(aspect::gpu)) {
@@ -90,6 +91,12 @@ int main(int argc, char **argv) {
9091
std::cout << "Number of EUs per subslice = " << numEUsPerSubslice
9192
<< std::endl;
9293
}
94+
if (dev.has(aspect::ext_intel_gpu_hw_threads_per_eu)) {
95+
numHWThreadsPerEU =
96+
dev.get_info<info::device::ext_intel_gpu_hw_threads_per_eu>();
97+
std::cout << "Number of HW threads per EU = " << numHWThreadsPerEU
98+
<< std::endl;
99+
}
93100
if (dev.has(aspect::ext_intel_max_mem_bandwidth)) {
94101
// not supported yet
95102
long m =

SYCL/Basic/stream/stream.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
55
// RUN: %GPU_RUN_ON_LINUX_PLACEHOLDER %t.out %GPU_CHECK_ON_LINUX_PLACEHOLDER
66
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
7-
//
8-
// Missing built-ins on AMD
9-
// XFAIL: hip_amd
107

118
//==------------------ stream.cpp - SYCL stream basic test -----------------==//
129
//

SYCL/Basic/submit_barrier.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// UNSUPPORTED: hip_amd
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %HOST_RUN_PLACEHOLDER %t.out
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out

SYCL/DeviceLib/built-ins/scalar_math.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
// RUN: %CPU_RUN_PLACEHOLDER %t.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out
55
// RUN: %ACC_RUN_PLACEHOLDER %t.out
6-
//
7-
// Incorrect results with hip on AMD
8-
// XFAIL: hip_amd
96

107
#include <CL/sycl.hpp>
118

SYCL/ESIMD/api/functional/ctors/ctor_copy.cpp

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct initializer {
4343

4444
// Descriptor class for the case of calling constructor in variable declaration
4545
// context.
46-
struct var_declaration {
46+
struct var_decl {
4747
static std::string get_description() { return "variable declaration"; }
4848

4949
template <typename DataT, int NumElems>
@@ -57,7 +57,7 @@ struct var_declaration {
5757

5858
// Descriptor class for the case of calling constructor in rvalue in an
5959
// expression context.
60-
struct rval_in_expression {
60+
struct rval_in_expr {
6161
static std::string get_description() { return "rvalue in an expression"; }
6262

6363
template <typename DataT, int NumElems>
@@ -92,42 +92,19 @@ class const_ref {
9292
}
9393
};
9494

95-
template <typename DataT, typename TestT>
96-
using run_test_with_one_elem = test<DataT, 1, TestT>;
97-
98-
template <typename DataT, typename TestT>
99-
using run_test_with_eight_elems = test<DataT, 8, TestT>;
100-
101-
template <typename DataT, typename TestT>
102-
using run_test_with_sixteen_elems = test<DataT, 16, TestT>;
103-
104-
template <typename DataT, typename TestT>
105-
using run_test_with_thirty_two_elems = test<DataT, 32, TestT>;
106-
107-
template <typename TestT, typename... T>
108-
bool run_verification_for_type(sycl::queue &queue,
109-
const named_type_pack<T...> &types) {
110-
bool passed{true};
111-
112-
passed &= for_all_types<run_test_with_one_elem, TestT>(types, queue);
113-
passed &= for_all_types<run_test_with_eight_elems, TestT>(types, queue);
114-
passed &= for_all_types<run_test_with_sixteen_elems, TestT>(types, queue);
115-
passed &= for_all_types<run_test_with_thirty_two_elems, TestT>(types, queue);
116-
return passed;
117-
}
118-
11995
int main(int argc, char **argv) {
12096
sycl::queue queue{esimd_test::ESIMDSelector{},
12197
esimd_test::createExceptionHandler()};
12298

12399
bool passed{true};
124100

125-
auto types{get_tested_types<tested_types::all>()};
101+
const auto types{get_tested_types<tested_types::all>()};
102+
const auto dims{get_all_dimensions()};
126103

127-
passed &= run_verification_for_type<initializer>(queue, types);
128-
passed &= run_verification_for_type<var_declaration>(queue, types);
129-
passed &= run_verification_for_type<rval_in_expression>(queue, types);
130-
passed &= run_verification_for_type<const_ref>(queue, types);
104+
passed &= for_all_types_and_dims<test, initializer>(types, dims, queue);
105+
passed &= for_all_types_and_dims<test, var_decl>(types, dims, queue);
106+
passed &= for_all_types_and_dims<test, rval_in_expr>(types, dims, queue);
107+
passed &= for_all_types_and_dims<test, const_ref>(types, dims, queue);
131108

132109
std::cout << (passed ? "=== Test passed\n" : "=== Test FAILED\n");
133110
return passed ? 0 : 1;

SYCL/ESIMD/api/functional/ctors/ctor_default.cpp

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct initializer {
4242

4343
// Descriptor class for the case of calling constructor in variable declaration
4444
// context
45-
struct var_declaration {
45+
struct var_decl {
4646
static std::string get_description() { return "variable declaration"; }
4747

4848
template <typename DataT, int NumElems>
@@ -54,7 +54,7 @@ struct var_declaration {
5454

5555
// Descriptor class for the case of calling constructor in rvalue in an
5656
// expression context
57-
struct rval_in_expression {
57+
struct rval_in_expr {
5858
static std::string get_description() { return "rvalue in an expression"; }
5959

6060
template <typename DataT, int NumElems>
@@ -116,44 +116,19 @@ template <typename DataT, int NumElems, typename TestCaseT> struct test {
116116
}
117117
};
118118

119-
template <typename DataT, typename TestT>
120-
using run_test_with_one_elem = test<DataT, 1, TestT>;
121-
122-
template <typename DataT, typename TestT>
123-
using run_test_with_eight_elems = test<DataT, 8, TestT>;
124-
125-
template <typename DataT, typename TestT>
126-
using run_test_with_sixteen_elems = test<DataT, 16, TestT>;
127-
128-
template <typename DataT, typename TestT>
129-
using run_test_with_thirty_two_elems = test<DataT, 32, TestT>;
130-
131-
template <typename TestT, typename... T>
132-
bool run_verification_with_chosen_test_type(
133-
sycl::queue &queue, const named_type_pack<T...> &types) {
134-
bool passed{true};
135-
136-
passed &= for_all_types<run_test_with_one_elem, TestT>(types, queue);
137-
passed &= for_all_types<run_test_with_eight_elems, TestT>(types, queue);
138-
passed &= for_all_types<run_test_with_sixteen_elems, TestT>(types, queue);
139-
passed &= for_all_types<run_test_with_thirty_two_elems, TestT>(types, queue);
140-
return passed;
141-
}
142-
143119
int main(int argc, char **argv) {
144120
sycl::queue queue{esimd_test::ESIMDSelector{},
145121
esimd_test::createExceptionHandler()};
146122

147123
bool passed{true};
148124

149125
const auto types{get_tested_types<tested_types::all>()};
126+
const auto dims{get_all_dimensions()};
150127

151-
passed &= run_verification_with_chosen_test_type<initializer>(queue, types);
152-
passed &=
153-
run_verification_with_chosen_test_type<var_declaration>(queue, types);
154-
passed &=
155-
run_verification_with_chosen_test_type<rval_in_expression>(queue, types);
156-
passed &= run_verification_with_chosen_test_type<const_ref>(queue, types);
128+
passed &= for_all_types_and_dims<test, initializer>(types, dims, queue);
129+
passed &= for_all_types_and_dims<test, var_decl>(types, dims, queue);
130+
passed &= for_all_types_and_dims<test, rval_in_expr>(types, dims, queue);
131+
passed &= for_all_types_and_dims<test, const_ref>(types, dims, queue);
157132

158133
std::cout << (passed ? "=== Test passed\n" : "=== Test FAILED\n");
159134
return passed ? 0 : 1;

0 commit comments

Comments
 (0)