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

Commit d86183d

Browse files
committed
Merge remote-tracking branch 'upstream/intel' into filter
2 parents 052691b + e4bfaa8 commit d86183d

File tree

187 files changed

+2982
-1264
lines changed

Some content is hidden

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

187 files changed

+2982
-1264
lines changed

.github/CODEOWNERS

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ SYCL/DotProduct @rdeodhar
2929
# Explicit SIMD
3030
SYCL/ESIMD @kbobrovs @DenisBakhvalov
3131

32-
# Function pointers
33-
SYCL/FunctionPointers @AlexeySachkov
34-
3532
# Functor
3633
SYCL/Functor @AlexeySachkov
3734

3835
# Group algorithms
3936
SYCL/GroupAlgorithm @Pennycook @AlexeySachkov
4037
SYCL/SubGroup @Pennycook @AlexeySachkov
38+
SYCL/GroupMask @Pennycook @vladimilaz
4139

4240
# Group local memory
4341
SYCL/GroupLocalMemory @sergey-semenov @Pennycook
@@ -66,11 +64,14 @@ SYCL/SeparateCompile @AlexeySachkov @Fznamznon
6664
# Specialization constant
6765
SYCL/SpecConstants @kbobrovs
6866

69-
# Specialization constant
70-
SYCL/USM @jbrodman
67+
# Unified Shared Memory (USM)
68+
SYCL/USM @jbrodman @sergey-semenov
7169

7270
# Stream
7371
SYCL/Basic/stream @againull
7472

7573
#BFloat16 conversion
7674
SYCL/BFloat16 @AlexeySotkin @MrSidims
75+
76+
# Deprecated features
77+
SYCL/DeprecatedFeatures @intel/llvm-reviewers-runtime

SYCL/AOT/spec_const_aot.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ int main(int argc, char **argv) {
3636
<< "\n";
3737
cl::sycl::program prog(q.get_context());
3838

39-
cl::sycl::ONEAPI::experimental::spec_constant<int32_t, MyInt32Const> i32 =
40-
prog.set_spec_constant<MyInt32Const>(10);
39+
cl::sycl::ext::oneapi::experimental::spec_constant<int32_t, MyInt32Const>
40+
i32 = prog.set_spec_constant<MyInt32Const>(10);
4141

4242
prog.build_with_kernel_type<Kernel>();
4343

SYCL/AtomicRef/accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <numeric>
1111
#include <vector>
1212
using namespace sycl;
13-
using namespace sycl::ONEAPI;
13+
using namespace sycl::ext::oneapi;
1414

1515
// Equivalent to add_test from add.cpp
1616
// Uses atomic_accessor instead of atomic_ref

SYCL/AtomicRef/add.cpp

Lines changed: 13 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -3,188 +3,36 @@
33
// RUN: %HOST_RUN_PLACEHOLDER %t.out
44
// RUN: %GPU_RUN_PLACEHOLDER %t.out
55
// RUN: %CPU_RUN_PLACEHOLDER %t.out
6+
// RUN: %ACC_RUN_PLACEHOLDER %t.out
67

7-
#include <CL/sycl.hpp>
8-
#include <algorithm>
9-
#include <cassert>
8+
#include "add.h"
109
#include <iostream>
11-
#include <numeric>
12-
#include <vector>
1310
using namespace sycl;
14-
using namespace sycl::ONEAPI;
15-
16-
template <typename T, typename Difference = T>
17-
void add_fetch_test(queue q, size_t N) {
18-
T sum = 0;
19-
std::vector<T> output(N);
20-
std::fill(output.begin(), output.end(), T(0));
21-
{
22-
buffer<T> sum_buf(&sum, 1);
23-
buffer<T> output_buf(output.data(), output.size());
24-
25-
q.submit([&](handler &cgh) {
26-
auto sum = sum_buf.template get_access<access::mode::read_write>(cgh);
27-
auto out =
28-
output_buf.template get_access<access::mode::discard_write>(cgh);
29-
cgh.parallel_for(range<1>(N), [=](item<1> it) {
30-
int gid = it.get_id(0);
31-
auto atm = atomic_ref<T, memory_order::relaxed, memory_scope::device,
32-
access::address_space::global_space>(sum[0]);
33-
out[gid] = atm.fetch_add(Difference(1));
34-
});
35-
});
36-
}
37-
38-
// All work-items increment by 1, so final value should be equal to N
39-
assert(sum == T(N));
40-
41-
// Fetch returns original value: will be in [0, N-1]
42-
auto min_e = std::min_element(output.begin(), output.end());
43-
auto max_e = std::max_element(output.begin(), output.end());
44-
assert(*min_e == T(0) && *max_e == T(N - 1));
45-
46-
// Intermediate values should be unique
47-
std::sort(output.begin(), output.end());
48-
assert(std::unique(output.begin(), output.end()) == output.end());
49-
}
50-
51-
template <typename T, typename Difference = T>
52-
void add_plus_equal_test(queue q, size_t N) {
53-
T sum = 0;
54-
std::vector<T> output(N);
55-
std::fill(output.begin(), output.end(), T(0));
56-
{
57-
buffer<T> sum_buf(&sum, 1);
58-
buffer<T> output_buf(output.data(), output.size());
59-
60-
q.submit([&](handler &cgh) {
61-
auto sum = sum_buf.template get_access<access::mode::read_write>(cgh);
62-
auto out =
63-
output_buf.template get_access<access::mode::discard_write>(cgh);
64-
cgh.parallel_for(range<1>(N), [=](item<1> it) {
65-
int gid = it.get_id(0);
66-
auto atm = atomic_ref<T, memory_order::relaxed, memory_scope::device,
67-
access::address_space::global_space>(sum[0]);
68-
out[gid] = atm += Difference(1);
69-
});
70-
});
71-
}
72-
73-
// All work-items increment by 1, so final value should be equal to N
74-
assert(sum == T(N));
75-
76-
// += returns updated value: will be in [1, N]
77-
auto min_e = std::min_element(output.begin(), output.end());
78-
auto max_e = std::max_element(output.begin(), output.end());
79-
assert(*min_e == T(1) && *max_e == T(N));
80-
81-
// Intermediate values should be unique
82-
std::sort(output.begin(), output.end());
83-
assert(std::unique(output.begin(), output.end()) == output.end());
84-
}
85-
86-
template <typename T, typename Difference = T>
87-
void add_pre_inc_test(queue q, size_t N) {
88-
T sum = 0;
89-
std::vector<T> output(N);
90-
std::fill(output.begin(), output.end(), T(0));
91-
{
92-
buffer<T> sum_buf(&sum, 1);
93-
buffer<T> output_buf(output.data(), output.size());
94-
95-
q.submit([&](handler &cgh) {
96-
auto sum = sum_buf.template get_access<access::mode::read_write>(cgh);
97-
auto out =
98-
output_buf.template get_access<access::mode::discard_write>(cgh);
99-
cgh.parallel_for(range<1>(N), [=](item<1> it) {
100-
int gid = it.get_id(0);
101-
auto atm = atomic_ref<T, memory_order::relaxed, memory_scope::device,
102-
access::address_space::global_space>(sum[0]);
103-
out[gid] = ++atm;
104-
});
105-
});
106-
}
107-
108-
// All work-items increment by 1, so final value should be equal to N
109-
assert(sum == T(N));
110-
111-
// Pre-increment returns updated value: will be in [1, N]
112-
auto min_e = std::min_element(output.begin(), output.end());
113-
auto max_e = std::max_element(output.begin(), output.end());
114-
assert(*min_e == T(1) && *max_e == T(N));
115-
116-
// Intermediate values should be unique
117-
std::sort(output.begin(), output.end());
118-
assert(std::unique(output.begin(), output.end()) == output.end());
119-
}
120-
121-
template <typename T, typename Difference = T>
122-
void add_post_inc_test(queue q, size_t N) {
123-
T sum = 0;
124-
std::vector<T> output(N);
125-
std::fill(output.begin(), output.end(), T(0));
126-
{
127-
buffer<T> sum_buf(&sum, 1);
128-
buffer<T> output_buf(output.data(), output.size());
129-
130-
q.submit([&](handler &cgh) {
131-
auto sum = sum_buf.template get_access<access::mode::read_write>(cgh);
132-
auto out =
133-
output_buf.template get_access<access::mode::discard_write>(cgh);
134-
cgh.parallel_for(range<1>(N), [=](item<1> it) {
135-
int gid = it.get_id(0);
136-
auto atm = atomic_ref<T, memory_order::relaxed, memory_scope::device,
137-
access::address_space::global_space>(sum[0]);
138-
out[gid] = atm++;
139-
});
140-
});
141-
}
142-
143-
// All work-items increment by 1, so final value should be equal to N
144-
assert(sum == T(N));
145-
146-
// Post-increment returns original value: will be in [0, N-1]
147-
auto min_e = std::min_element(output.begin(), output.end());
148-
auto max_e = std::max_element(output.begin(), output.end());
149-
assert(*min_e == T(0) && *max_e == T(N - 1));
150-
151-
// Intermediate values should be unique
152-
std::sort(output.begin(), output.end());
153-
assert(std::unique(output.begin(), output.end()) == output.end());
154-
}
155-
156-
template <typename T, typename Difference = T>
157-
void add_test(queue q, size_t N) {
158-
add_fetch_test<T, Difference>(q, N);
159-
add_plus_equal_test<T, Difference>(q, N);
160-
add_pre_inc_test<T, Difference>(q, N);
161-
add_post_inc_test<T, Difference>(q, N);
162-
}
16311

16412
// Floating-point types do not support pre- or post-increment
16513
template <> void add_test<float>(queue q, size_t N) {
16614
add_fetch_test<float>(q, N);
16715
add_plus_equal_test<float>(q, N);
16816
}
169-
template <> void add_test<double>(queue q, size_t N) {
170-
add_fetch_test<double>(q, N);
171-
add_plus_equal_test<double>(q, N);
172-
}
17317

17418
int main() {
17519
queue q;
176-
std::string version = q.get_device().get_info<info::device::version>();
17720

17821
constexpr int N = 32;
17922
add_test<int>(q, N);
18023
add_test<unsigned int>(q, N);
181-
add_test<long>(q, N);
182-
add_test<unsigned long>(q, N);
183-
add_test<long long>(q, N);
184-
add_test<unsigned long long>(q, N);
18524
add_test<float>(q, N);
186-
add_test<double>(q, N);
187-
add_test<char *, ptrdiff_t>(q, N);
25+
26+
// Include long tests if they are 32 bits wide
27+
if constexpr (sizeof(long) == 4) {
28+
add_test<long>(q, N);
29+
add_test<unsigned long>(q, N);
30+
}
31+
32+
// Include pointer tests if they are 32 bits wide
33+
if constexpr (sizeof(char *) == 4) {
34+
add_test<char *, ptrdiff_t>(q, N);
35+
}
18836

18937
std::cout << "Test passed." << std::endl;
19038
}

0 commit comments

Comments
 (0)