Skip to content

Commit 2e42661

Browse files
authored
Merge pull request intel#1653 from bb-sycl/xmain-cand
Auto pulldown and update tc files for xmain-cand branch on 20230317
2 parents a4444bb + 0e3107c commit 2e42661

File tree

108 files changed

+2104
-592
lines changed

Some content is hidden

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

108 files changed

+2104
-592
lines changed

SYCL/Basic/accessor/accessor.cpp

100755100644
Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ template <typename T> struct InheritedAccessor : public AccAlias<T> {
3939
using AccAlias<T>::AccAlias;
4040
};
4141

42-
template <typename Acc> struct AccWrapper { Acc accessor; };
42+
template <typename Acc> struct AccWrapper {
43+
Acc accessor;
44+
};
4345

4446
template <typename Acc1, typename Acc2> struct AccsWrapper {
4547
int a;
@@ -58,7 +60,9 @@ template <typename Acc> struct Wrapper2 {
5860
AccWrapper<Acc> wrapped;
5961
};
6062

61-
template <typename Acc> struct Wrapper3 { Wrapper2<Acc> w2; };
63+
template <typename Acc> struct Wrapper3 {
64+
Wrapper2<Acc> w2;
65+
};
6266

6367
template <typename T> void TestAccSizeFuncs(const std::vector<T> &vec) {
6468
auto test = [=](auto &Res, const auto &Acc) {
@@ -1051,5 +1055,46 @@ int main() {
10511055
assert(v[i] == ((i * 2 + 1) + i));
10521056
}
10531057

1058+
// Assignment operator test for 0-dim buffer accessor
1059+
{
1060+
sycl::queue Queue;
1061+
int Data = 32;
1062+
1063+
// Explicit block to prompt copy-back to Data
1064+
{
1065+
sycl::buffer<int, 1> DataBuffer(&Data, sycl::range<1>(1));
1066+
1067+
Queue.submit([&](sycl::handler &CGH) {
1068+
sycl::accessor<int, 0> Acc(DataBuffer, CGH);
1069+
CGH.single_task<class acc_0_dim_assignment>([=]() { Acc = 64; });
1070+
});
1071+
Queue.wait();
1072+
}
1073+
1074+
assert(Data == 64);
1075+
}
1076+
1077+
// Assignment operator test for 0-dim local accessor
1078+
{
1079+
sycl::queue Queue;
1080+
int Data = 0;
1081+
1082+
// Explicit block to prompt copy-back to Data
1083+
{
1084+
sycl::buffer<int, 1> DataBuffer(&Data, sycl::range<1>(1));
1085+
1086+
Queue.submit([&](sycl::handler &CGH) {
1087+
sycl::accessor<int, 0> Acc(DataBuffer, CGH);
1088+
sycl::local_accessor<int, 0> LocalAcc(CGH);
1089+
CGH.single_task<class local_acc_0_dim_assignment>([=]() {
1090+
LocalAcc = 64;
1091+
Acc = LocalAcc;
1092+
});
1093+
});
1094+
}
1095+
1096+
assert(Data == 64);
1097+
}
1098+
10541099
std::cout << "Test passed" << std::endl;
10551100
}

SYCL/Basic/gpu_max_wgs_error.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// UNSUPPORTED: cuda || hip
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out -fno-sycl-id-queries-fit-in-int
3+
// RUN: %GPU_RUN_PLACEHOLDER %t.out
4+
5+
#include <numeric>
6+
#include <sycl/sycl.hpp>
7+
8+
using namespace sycl;
9+
10+
const std::string expected_msg =
11+
"Total number of work-items in a work-group cannot exceed";
12+
13+
template <int N>
14+
void check(range<N> global, range<N> local, bool expect_fail = false) {
15+
queue q;
16+
try {
17+
q.submit([&](handler &cgh) {
18+
cgh.parallel_for(nd_range<N>(global, local), [=](nd_item<N> item) {});
19+
});
20+
assert(!expect_fail && "Exception expected");
21+
} catch (nd_range_error e) {
22+
if (expect_fail) {
23+
std::string msg = e.what();
24+
assert(msg.rfind(expected_msg, 0) == 0 && "Unexpected error message");
25+
} else {
26+
throw e;
27+
}
28+
}
29+
}
30+
31+
int main() {
32+
queue q;
33+
device d = q.get_device();
34+
id<2> max_2 = d.get_info<sycl::info::device::max_work_item_sizes<2>>();
35+
check(range<2>(max_2[0], max_2[1]), range<2>(max_2[0], max_2[1]), true);
36+
37+
id<3> max_3 = d.get_info<sycl::info::device::max_work_item_sizes<3>>();
38+
check(range<3>(max_3[0], max_3[1], max_3[2]),
39+
range<3>(max_3[0], max_3[1], max_3[2]), true);
40+
}

SYCL/Basic/stream/stream.cpp

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,37 @@ int main() {
2424
context Context = Queue.get_context();
2525

2626
// Check constructor and getters
27-
Queue.submit([&](handler &CGH) {
28-
stream Out(1024, 80, CGH,
29-
property_list{property::buffer::context_bound{Context}});
30-
assert(Out.size() == 1024);
31-
assert(Out.get_work_item_buffer_size() == 80);
32-
assert(Out.has_property<property::buffer::context_bound>());
33-
assert(!Out.has_property<property::queue::in_order>());
34-
assert(
35-
Out.get_property<property::buffer::context_bound>().get_context() ==
36-
Context);
37-
38-
CGH.single_task<class DummyTask1>([=]() {});
39-
});
27+
size_t sizeInKernel = 0;
28+
size_t workItemBufferSizeInKernel = 0;
29+
{
30+
sycl::buffer<size_t> bufSize(&sizeInKernel, 1);
31+
sycl::buffer<size_t> bufWorkItemBufferSize(&workItemBufferSizeInKernel,
32+
1);
33+
34+
// Check constructor and getters
35+
Queue.submit([&](handler &CGH) {
36+
stream Out(1024, 80, CGH,
37+
property_list{property::buffer::context_bound{Context}});
38+
assert(Out.size() == 1024);
39+
assert(Out.get_work_item_buffer_size() == 80);
40+
assert(Out.has_property<property::buffer::context_bound>());
41+
assert(!Out.has_property<property::queue::in_order>());
42+
assert(
43+
Out.get_property<property::buffer::context_bound>().get_context() ==
44+
Context);
45+
46+
sycl::accessor accSize(bufSize, CGH, sycl::write_only);
47+
sycl::accessor accWorkItemBufferSize(bufWorkItemBufferSize, CGH,
48+
sycl::write_only);
49+
50+
CGH.single_task<class DummyTask1>([=]() {
51+
accSize[0] = Out.size();
52+
accWorkItemBufferSize[0] = Out.get_work_item_buffer_size();
53+
});
54+
});
55+
}
56+
assert(sizeInKernel == 1024);
57+
assert(workItemBufferSizeInKernel == 80);
4058

4159
// Check common reference semantics
4260
std::hash<stream> Hasher;

SYCL/Complex/sycl_complex_helper.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ template <> const char *get_typename<float>() { return "float"; }
3434
template <> const char *get_typename<sycl::half>() { return "sycl::half"; }
3535

3636
// Helper to test each complex specilization
37+
// Overload for cplx_test_cases
3738
template <template <typename> typename action, typename... argsT>
3839
bool test_valid_types(sycl::queue &Q, argsT... args) {
3940
bool test_passes = true;
@@ -56,6 +57,27 @@ bool test_valid_types(sycl::queue &Q, argsT... args) {
5657
return test_passes;
5758
}
5859

60+
// Overload for deci_test_cases
61+
template <template <typename, typename> typename action, typename... argsT>
62+
bool test_valid_types(sycl::queue &Q, argsT... args) {
63+
bool test_passes = true;
64+
65+
if (Q.get_device().has(sycl::aspect::fp64)) {
66+
test_passes &= action<double, bool>{}(Q, args...);
67+
test_passes &= action<double, char>{}(Q, args...);
68+
test_passes &= action<double, int>{}(Q, args...);
69+
test_passes &= action<double, double>{}(Q, args...);
70+
}
71+
72+
{ test_passes &= action<float, float>{}(Q, args...); }
73+
74+
if (Q.get_device().has(sycl::aspect::fp16)) {
75+
test_passes &= action<sycl::half, sycl::half>{}(Q, args...);
76+
}
77+
78+
return test_passes;
79+
}
80+
5981
// Overload for host only tests
6082
template <template <typename> typename action, typename... argsT>
6183
bool test_valid_types(argsT... args) {

0 commit comments

Comments
 (0)