Skip to content

Commit 7b7775e

Browse files
authored
[SYCL] Remove tests added to intel/llvm-test-suite (#2753)
The tests were added in scope of intel/llvm-test-suite#50
1 parent 6e3f244 commit 7b7775e

File tree

139 files changed

+316
-14494
lines changed

Some content is hidden

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

139 files changed

+316
-14494
lines changed

sycl/test/basic_tests/built-ins.cpp

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
2+
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
3+
4+
// CUDA does not support printf.
5+
// UNSUPPORTED: cuda
6+
#include <CL/sycl.hpp>
7+
8+
#include <cassert>
9+
10+
namespace s = cl::sycl;
11+
12+
// According to OpenCL C spec, the format string must be in constant address
13+
// space
14+
#ifdef __SYCL_DEVICE_ONLY__
15+
#define CONSTANT __attribute__((opencl_constant))
16+
#else
17+
#define CONSTANT
18+
#endif
19+
20+
static const CONSTANT char format[] = "Hello, World! %d %f\n";
21+
22+
int main() {
23+
s::queue q{};
24+
25+
// Test printf
26+
q.submit([&](s::handler &CGH) {
27+
CGH.single_task<class printf>([=]() {
28+
s::ONEAPI::experimental::printf(format, 123, 1.23);
29+
// CHECK: {{(Hello, World! 123 1.23)?}}
30+
});
31+
}).wait();
32+
33+
s::ONEAPI::experimental::printf(format, 321, 3.21);
34+
// CHECK: {{(Hello, World! 123 1.23)?}}
35+
36+
// Test common
37+
{
38+
s::buffer<s::cl_float, 1> BufMin(s::range<1>(1));
39+
s::buffer<s::cl_float2, 1> BufMax(s::range<1>(1));
40+
q.submit([&](s::handler &cgh) {
41+
auto AccMin = BufMin.get_access<s::access::mode::write>(cgh);
42+
auto AccMax = BufMax.get_access<s::access::mode::write>(cgh);
43+
cgh.single_task<class common>([=]() {
44+
AccMax[0] = s::max(s::cl_float2{0.5f, 2.5}, s::cl_float2{2.3f, 2.3});
45+
AccMin[0] = s::min(s::cl_float{0.5f}, s::cl_float{2.3f});
46+
});
47+
});
48+
49+
auto AccMin = BufMin.template get_access<s::access::mode::read>();
50+
auto AccMax = BufMax.template get_access<s::access::mode::read>();
51+
52+
assert(AccMin[0] == 0.5);
53+
assert(AccMax[0].x() == 2.3f && AccMax[0].y() == 2.5f);
54+
assert(s::min(0.5f, 2.3f) == 0.5);
55+
auto Res = s::max(s::int4{5, 2, 1, 5}, s::int4{3, 3, 4, 2});
56+
assert(Res.x() == 5 && Res.y() == 3 && Res.z() == 4 && Res.w() == 5);
57+
}
58+
59+
return 0;
60+
}

sycl/test/extensions/fpga.cpp

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// RUN: %clangxx -fsycl %s -o %t.out
2+
3+
#include <CL/sycl.hpp>
4+
#include <CL/sycl/INTEL/fpga_extensions.hpp>
5+
namespace intelfpga {
6+
template <unsigned ID> struct ethernet_pipe_id {
7+
static constexpr unsigned id = ID;
8+
};
9+
10+
using ethernet_read_pipe =
11+
sycl::INTEL::kernel_readable_io_pipe<ethernet_pipe_id<0>, int, 0>;
12+
using ethernet_write_pipe =
13+
sycl::INTEL::kernel_writeable_io_pipe<ethernet_pipe_id<1>, int, 0>;
14+
} // namespace intelfpga
15+
16+
int main() {
17+
sycl::queue Queue;
18+
/* Check buffer_location property */
19+
sycl::buffer<int, 1> Buf{sycl::range{1}};
20+
Queue.submit([&](sycl::handler &CGH) {
21+
sycl::ONEAPI::accessor_property_list PL{sycl::INTEL::buffer_location<1>};
22+
sycl::accessor Acc(Buf, CGH, sycl::write_only, PL);
23+
CGH.single_task<class Test>([=]() { Acc[0] = 42; });
24+
});
25+
Queue.wait();
26+
27+
auto Acc = Buf.template get_access<sycl::access::mode::read_write>();
28+
assert(Acc[0] == 42 && "Value mismatch");
29+
30+
/*Check FPGA-related device parameters*/
31+
if (!Queue.get_device()
32+
.get_info<cl::sycl::info::device::kernel_kernel_pipe_support>()) {
33+
std::cout << "SYCL_INTEL_data_flow_pipes not supported, skipping"
34+
<< std::endl;
35+
return 0;
36+
}
37+
38+
/*Check pipes interfaces*/
39+
Queue.submit([&](cl::sycl::handler &cgh) {
40+
auto write_acc = Buf.get_access<cl::sycl::access::mode::write>(cgh);
41+
42+
cgh.single_task<class bl_io_transfer>([=]() {
43+
write_acc[0] = intelfpga::ethernet_read_pipe::read();
44+
intelfpga::ethernet_write_pipe::write(write_acc[0]);
45+
});
46+
});
47+
48+
using Pipe = cl::sycl::INTEL::pipe<class PipeName, int>;
49+
cl::sycl::buffer<int, 1> readBuf(1);
50+
Queue.submit([&](cl::sycl::handler &cgh) {
51+
cgh.single_task<class writer>([=]() {
52+
bool SuccessCode = false;
53+
do {
54+
Pipe::write(42, SuccessCode);
55+
} while (!SuccessCode);
56+
});
57+
});
58+
59+
/*Check LSU interface*/
60+
{
61+
cl::sycl::buffer<int, 1> output_buffer(1);
62+
cl::sycl::buffer<int, 1> input_buffer(1);
63+
64+
Queue.submit([&](cl::sycl::handler &cgh) {
65+
auto output_accessor =
66+
output_buffer.get_access<cl::sycl::access::mode::write>(cgh);
67+
auto input_accessor =
68+
input_buffer.get_access<cl::sycl::access::mode::read>(cgh);
69+
70+
cgh.single_task<class kernel>([=] {
71+
auto input_ptr = input_accessor.get_pointer();
72+
auto output_ptr = output_accessor.get_pointer();
73+
74+
using PrefetchingLSU =
75+
cl::sycl::INTEL::lsu<cl::sycl::INTEL::prefetch<true>,
76+
cl::sycl::INTEL::statically_coalesce<false>>;
77+
78+
using BurstCoalescedLSU =
79+
cl::sycl::INTEL::lsu<cl::sycl::INTEL::burst_coalesce<true>,
80+
cl::sycl::INTEL::statically_coalesce<false>>;
81+
82+
using CachingLSU =
83+
cl::sycl::INTEL::lsu<cl::sycl::INTEL::burst_coalesce<true>,
84+
cl::sycl::INTEL::cache<1024>,
85+
cl::sycl::INTEL::statically_coalesce<false>>;
86+
87+
using PipelinedLSU = cl::sycl::INTEL::lsu<>;
88+
89+
int X = PrefetchingLSU::load(input_ptr); // int X = input_ptr[0]
90+
int Y = CachingLSU::load(input_ptr + 1); // int Y = input_ptr[1]
91+
92+
BurstCoalescedLSU::store(output_ptr, X); // output_ptr[0] = X
93+
PipelinedLSU::store(output_ptr + 1, Y); // output_ptr[1] = Y
94+
});
95+
});
96+
}
97+
98+
return 0;
99+
}

sycl/test/on-device/group-algorithm/reduce.cpp renamed to sycl/test/extensions/group-algorithm.cpp

Lines changed: 29 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -I . -o %t.out
2-
// RUN: env SYCL_DEVICE_TYPE=HOST %t.out
3-
// RUN: %CPU_RUN_PLACEHOLDER %t.out
4-
// RUN: %GPU_RUN_PLACEHOLDER %t.out
5-
// RUN: %ACC_RUN_PLACEHOLDER %t.out
2+
// Group operations are not supported on host device. The test checks that
3+
// compilation succeeded.
64

75
// TODO: enable compile+runtime checks for operations defined in SPIR-V 1.3.
86
// That requires either adding a switch to clang (-spirv-max-version=1.3) or
@@ -13,7 +11,6 @@
1311
// RUNx: %clangxx -fsycl -fsycl-targets=%sycl_triple -DSPIRV_1_3 %s -I . -o \
1412
%t13.out
1513

16-
#include "support.h"
1714
#include <CL/sycl.hpp>
1815
#include <algorithm>
1916
#include <cassert>
@@ -22,11 +19,23 @@
2219
using namespace sycl;
2320
using namespace sycl::ONEAPI;
2421

22+
template <class Predicate> class none_of_kernel;
23+
24+
struct GeZero {
25+
bool operator()(int i) const { return i >= 0; }
26+
};
27+
struct IsEven {
28+
bool operator()(int i) const { return (i % 2) == 0; }
29+
};
30+
struct LtZero {
31+
bool operator()(int i) const { return i < 0; }
32+
};
33+
2534
template <typename SpecializationKernelName, typename InputContainer,
26-
typename OutputContainer, class BinaryOperation>
35+
typename OutputContainer, class BinaryOperation, class Predicate>
2736
void test(queue q, InputContainer input, OutputContainer output,
2837
BinaryOperation binary_op,
29-
typename OutputContainer::value_type identity) {
38+
typename OutputContainer::value_type identity, Predicate pred) {
3039
typedef typename InputContainer::value_type InputT;
3140
typedef typename OutputContainer::value_type OutputT;
3241
OutputT init = 42;
@@ -44,56 +53,36 @@ void test(queue q, InputContainer input, OutputContainer output,
4453
group<1> g = it.get_group();
4554
int lid = it.get_local_id(0);
4655
out[0] = reduce(g, in[lid], binary_op);
47-
out[1] = reduce(g, in[lid], init, binary_op);
48-
out[2] =
49-
reduce(g, in.get_pointer(), in.get_pointer() + N, binary_op);
50-
out[3] = reduce(g, in.get_pointer(), in.get_pointer() + N, init,
51-
binary_op);
56+
out[1] = none_of(g, in[lid], pred);
57+
out[2] = inclusive_scan(g, in[lid], binary_op);
58+
out[3] = exclusive_scan(g, in[lid], binary_op);
59+
out[4] = broadcast(g, in[lid]);
60+
out[5] = any_of(g, in.get_pointer(), in.get_pointer() + N, pred);
61+
out[6] = all_of(g, pred(in[lid]));
62+
if (leader(g)) {
63+
out[7]++;
64+
}
5265
});
5366
});
5467
}
55-
// std::reduce is not implemented yet, so use std::accumulate instead
56-
assert(output[0] == std::accumulate(input.begin(), input.begin() + G,
57-
identity, binary_op));
58-
assert(output[1] ==
59-
std::accumulate(input.begin(), input.begin() + G, init, binary_op));
60-
assert(output[2] ==
61-
std::accumulate(input.begin(), input.end(), identity, binary_op));
62-
assert(output[3] ==
63-
std::accumulate(input.begin(), input.end(), init, binary_op));
6468
}
6569

6670
int main() {
6771
queue q;
68-
if (!isSupportedDevice(q.get_device())) {
69-
std::cout << "Skipping test\n";
70-
return 0;
71-
}
7272

7373
constexpr int N = 128;
7474
std::array<int, N> input;
75-
std::array<int, 4> output;
75+
std::array<int, 8> output;
7676
std::iota(input.begin(), input.end(), 0);
7777
std::fill(output.begin(), output.end(), 0);
7878

79-
test<class KernelNamePlusV>(q, input, output, plus<>(), 0);
79+
test<class KernelNamePlusV>(q, input, output, plus<>(), 0, GeZero());
8080
test<class KernelNameMinimumV>(q, input, output, minimum<>(),
81-
std::numeric_limits<int>::max());
82-
test<class KernelNameMaximumV>(q, input, output, maximum<>(),
83-
std::numeric_limits<int>::lowest());
84-
85-
test<class KernelNamePlusI>(q, input, output, plus<int>(), 0);
86-
test<class KernelNameMinimumI>(q, input, output, minimum<int>(),
87-
std::numeric_limits<int>::max());
88-
test<class KernelNameMaximumI>(q, input, output, maximum<int>(),
89-
std::numeric_limits<int>::lowest());
81+
std::numeric_limits<int>::max(), IsEven());
9082

9183
#ifdef SPIRV_1_3
9284
test<class KernelName_WonwuUVPUPOTKRKIBtT>(q, input, output,
93-
multiplies<int>(), 1);
94-
test<class KernelName_qYBaJDZTMGkdIwD>(q, input, output, bit_or<int>(), 0);
95-
test<class KernelName_eLSFt>(q, input, output, bit_xor<int>(), 0);
96-
test<class KernelName_uFhJnxSVhNAiFPTG>(q, input, output, bit_and<int>(), ~0);
85+
multiplies<int>(), 1, LtZero());
9786
#endif // SPIRV_1_3
9887

9988
std::cout << "Test passed." << std::endl;

0 commit comments

Comments
 (0)