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

Commit 4bd587d

Browse files
committed
Merge remote-tracking branch 'intel_llvm/intel' into simd_view_from_simd
2 parents ece58a0 + 2b21583 commit 4bd587d

File tree

547 files changed

+10745
-3412
lines changed

Some content is hidden

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

547 files changed

+10745
-3412
lines changed

.github/CODEOWNERS

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ SYCL/AOT @AGindinson @dm-vodopyanov @AlexeySachkov @romanovvlad
77
SYCL/AtomicRef @AGindinson
88

99
# SYCL RT specific tests
10+
SYCL/Assert @intel/llvm-reviewers-runtime
1011
SYCL/Basic @intel/llvm-reviewers-runtime
1112
SYCL/Config @intel/llvm-reviewers-runtime
1213
SYCL/FilterSelector @intel/llvm-reviewers-runtime
@@ -22,22 +23,21 @@ SYCL/DeviceCodeSplit @AlexeySachkov @Fznamznon
2223

2324
# Device library
2425
SYCL/DeviceLib @vzakhari
26+
SYCL/DeviceLib/ITTAnnotations @vzakhari @MrSidims @AGindinson
2527

2628
# dot_product API
2729
SYCL/DotProduct @rdeodhar
2830

2931
# Explicit SIMD
30-
SYCL/ESIMD @kbobrovs @DenisBakhvalov
31-
32-
# Function pointers
33-
SYCL/FunctionPointers @AlexeySachkov
32+
SYCL/ESIMD @kbobrovs @v-klochkov
3433

3534
# Functor
3635
SYCL/Functor @AlexeySachkov
3736

3837
# Group algorithms
3938
SYCL/GroupAlgorithm @Pennycook @AlexeySachkov
4039
SYCL/SubGroup @Pennycook @AlexeySachkov
40+
SYCL/SubGroupMask @Pennycook @vladimilaz
4141

4242
# Group local memory
4343
SYCL/GroupLocalMemory @sergey-semenov @Pennycook
@@ -66,8 +66,14 @@ SYCL/SeparateCompile @AlexeySachkov @Fznamznon
6666
# Specialization constant
6767
SYCL/SpecConstants @kbobrovs
6868

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

7272
# Stream
7373
SYCL/Basic/stream @againull
74+
75+
#BFloat16 conversion
76+
SYCL/BFloat16 @AlexeySotkin @MrSidims
77+
78+
# Deprecated features
79+
SYCL/DeprecatedFeatures @intel/llvm-reviewers-runtime

SYCL/AOT/accelerator.cpp

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

99
// REQUIRES: aoc, accelerator
1010

11-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga-unknown-unknown-sycldevice %S/Inputs/aot.cpp -o %t.out
11+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_fpga %S/Inputs/aot.cpp -o %t.out
1212
// RUN: %ACC_RUN_PLACEHOLDER %t.out

SYCL/AOT/cpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
// REQUIRES: opencl-aot, cpu
1010

11-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/Inputs/aot.cpp -o %t.out
11+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/aot.cpp -o %t.out
1212
// RUN: %CPU_RUN_PLACEHOLDER %t.out
1313

1414
// Test that opencl-aot can handle multiple build options.
15-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice %S/Inputs/aot.cpp -Xsycl-target-backend "--bo=-g" -Xsycl-target-backend "--bo=-cl-opt-disable" -o %t2.out
15+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64 %S/Inputs/aot.cpp -Xsycl-target-backend "--bo=-g" -Xsycl-target-backend "--bo=-cl-opt-disable" -o %t2.out

SYCL/AOT/gpu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
// UNSUPPORTED: cuda
1111
// CUDA is not compatible with SPIR.
1212
//
13-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_gen-unknown-unknown-sycldevice "-device *" %S/Inputs/aot.cpp -o %t.out
13+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/aot.cpp -o %t.out
1414
// RUN: %GPU_RUN_PLACEHOLDER %t.out

SYCL/AOT/multiple-devices.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
// 1-command compilation case
1414
// Targeting CPU, GPU, FPGA
15-
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64-unknown-unknown-sycldevice,spir64_gen-unknown-unknown-sycldevice,spir64_fpga-unknown-unknown-sycldevice -Xsycl-target-backend=spir64_gen-unknown-unknown-sycldevice "-device *" %S/Inputs/aot.cpp -o %t_all.out
15+
// RUN: %clangxx -fsycl -fsycl-targets=spir64_x86_64,spir64_gen,spir64_fpga -Xsycl-target-backend=spir64_gen "-device *" %S/Inputs/aot.cpp -o %t_all.out
1616
// RUN: %HOST_RUN_PLACEHOLDER %t_all.out
1717
// RUN: %CPU_RUN_PLACEHOLDER %t_all.out
1818
// RUN: %GPU_RUN_PLACEHOLDER %t_all.out
@@ -26,7 +26,7 @@
2626
// Produce object file, spirv, device images to combine these differently
2727
// at link-time, thus testing various AOT-compiled images configurations
2828
// RUN: %clangxx -fsycl %S/Inputs/aot.cpp -c -o %t.o
29-
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64-unknown-unknown-sycldevice %t.o -o %t.spv
29+
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64 %t.o -o %t.spv
3030
// AOT-compile device binary images
3131
// Neither of AOT tools can compile several files, hence, here is this
3232
// workaround

SYCL/AOT/with-llvm-bc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
// REQUIRES: cpu, dump_ir
1010

11-
// RUN: %clangxx -fsycl -fsycl-targets=spir64-unknown-unknown-sycldevice -c %S/Inputs/aot.cpp -o %t.o
12-
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64-unknown-unknown-sycldevice %t.o -o %t.spv
11+
// RUN: %clangxx -fsycl -fsycl-targets=spir64 -c %S/Inputs/aot.cpp -o %t.o
12+
// RUN: %clangxx -fsycl -fsycl-link-targets=spir64 %t.o -o %t.spv
1313
// RUN: llvm-spirv -r %t.spv -o %t.bc
1414
// RUN: %clangxx -fsycl -fsycl-add-targets=spir64:%t.bc %t.o -o %t.out
1515
//
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#include "kernels_in_file2.hpp"
2+
3+
#ifdef DEFINE_NDEBUG_INFILE2
4+
#define NDEBUG
5+
#else
6+
#undef NDEBUG
7+
#endif
8+
9+
#include <cassert>
10+
11+
using namespace cl::sycl;
12+
using namespace cl::sycl::access;
13+
14+
int calculus(int X) {
15+
assert(X && "this message from calculus");
16+
return X * 2;
17+
}
18+
19+
void check_nil(int value) { assert(value && "this message from file2"); }
20+
21+
static constexpr size_t BUFFER_SIZE = 4;
22+
23+
void enqueueKernel_1_fromFile2(queue *Q) {
24+
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
25+
cl::sycl::buffer<int, 1> Buf(numOfItems);
26+
27+
Q->submit([&](handler &CGH) {
28+
auto Acc = Buf.template get_access<mode::read_write>(CGH);
29+
30+
CGH.parallel_for<class kernel1_from_separate_file>(
31+
numOfItems, [=](cl::sycl::id<1> wiID) { check_nil(Acc[wiID]); });
32+
});
33+
}
34+
35+
void enqueueKernel_2_fromFile2(queue *Q) {
36+
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
37+
cl::sycl::buffer<int, 1> Buf(numOfItems);
38+
39+
Q->submit([&](handler &CGH) {
40+
auto Acc = Buf.template get_access<mode::read_write>(CGH);
41+
42+
CGH.parallel_for<class kernel2_from_separate_file>(
43+
numOfItems, [=](cl::sycl::id<1> wiID) { check_nil(Acc[wiID]); });
44+
});
45+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <CL/sycl.hpp>
2+
3+
SYCL_EXTERNAL int calculus(int X);
4+
5+
void enqueueKernel_1_fromFile2(sycl::queue *Q);
6+
7+
void enqueueKernel_2_fromFile2(sycl::queue *Q);

SYCL/Assert/assert_in_kernels.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// REQUIRES: linux
2+
// FIXME unsupported on CUDA and HIP until fallback libdevice becomes available
3+
// UNSUPPORTED: cuda || hip
4+
// RUN: %clangxx -DSYCL_ENABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
5+
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
6+
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
7+
// RUN: %GPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
8+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
9+
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.txt || true
10+
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
11+
//
12+
// CHECK-NOT: One shouldn't see this message
13+
// CHECK: {{.*}}assert_in_kernels.hpp:26: void kernelFunc2(int *, int): global id: [{{[0,2]}},0,0], local id: [0,0,0]
14+
// CHECK-SAME: Assertion `Buf[wiID] == 0 && "from assert statement"` failed.
15+
// CHECK-NOT: test aborts earlier, one shouldn't see this message
16+
// CHECK-NOT: The test ended.
17+
18+
#include "assert_in_kernels.hpp"

SYCL/Assert/assert_in_kernels.hpp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#include <CL/sycl.hpp>
2+
#include <cassert>
3+
#include <iostream>
4+
5+
using namespace cl::sycl;
6+
using namespace cl::sycl::access;
7+
8+
void kernelFunc1(int *Buf, int wiID) {
9+
Buf[wiID] = 9;
10+
assert(Buf[wiID] != 0 && "One shouldn't see this message");
11+
}
12+
13+
void assertTest1(queue &Q, buffer<int, 1> &Buf) {
14+
Q.submit([&](handler &CGH) {
15+
auto Acc = Buf.template get_access<mode::read_write>(CGH);
16+
17+
CGH.parallel_for<class Kernel_1>(
18+
Buf.get_range(),
19+
[=](cl::sycl::id<1> wiID) { kernelFunc1(&Acc[0], wiID); });
20+
});
21+
}
22+
23+
void kernelFunc2(int *Buf, int wiID) {
24+
if (wiID % 2 != 0)
25+
Buf[wiID] = 0;
26+
assert(Buf[wiID] == 0 && "from assert statement");
27+
}
28+
29+
void assertTest2(queue &Q, buffer<int, 1> &Buf) {
30+
Q.submit([&](handler &CGH) {
31+
auto Acc = Buf.template get_access<mode::read_write>(CGH);
32+
33+
CGH.parallel_for<class Kernel_2>(
34+
Buf.get_range(),
35+
[=](cl::sycl::id<1> wiID) { kernelFunc2(&Acc[0], wiID); });
36+
});
37+
}
38+
39+
void kernelFunc3(int *Buf, int wiID) {
40+
if (wiID == 0)
41+
assert(false && "test aborts earlier, one shouldn't see this message");
42+
Buf[wiID] = 9;
43+
}
44+
45+
void assertTest3(queue &Q, buffer<int, 1> &Buf) {
46+
Q.submit([&](handler &CGH) {
47+
auto Acc = Buf.template get_access<mode::read_write>(CGH);
48+
49+
CGH.parallel_for<class Kernel_3>(
50+
Buf.get_range(),
51+
[=](cl::sycl::id<1> wiID) { kernelFunc3(&Acc[0], wiID); });
52+
});
53+
}
54+
55+
int main(int Argc, const char *Argv[]) {
56+
std::array<int, 4> Vec = {1, 2, 3, 4};
57+
cl::sycl::range<1> numOfItems{Vec.size()};
58+
cl::sycl::buffer<int, 1> Buf(Vec.data(), numOfItems);
59+
60+
queue Q;
61+
assertTest1(Q, Buf);
62+
Q.wait();
63+
64+
assertTest2(Q, Buf);
65+
Q.wait();
66+
67+
assertTest3(Q, Buf);
68+
Q.wait();
69+
70+
std::cout << "The test ended." << std::endl;
71+
return 0;
72+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// FIXME unsupported on CUDA and HIP until fallback libdevice becomes available
2+
// UNSUPPORTED: cuda || hip
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -DNDEBUG %S/assert_in_kernels.cpp -o %t.out
4+
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
5+
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
6+
// RUN: %ACC_RUN_PLACEHOLDER %t.out %ACC_CHECK_PLACEHOLDER
7+
//
8+
// CHECK-NOT: One shouldn't see this message
9+
// CHECK-NOT: from assert statement
10+
// CHECK-NOT: test aborts earlier, one shouldn't see this message
11+
// CHECK: The test ended.

SYCL/Assert/assert_in_kernels_win.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// REQUIRES: windows
2+
// RUN: %clangxx -DSYCL_ENABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
4+
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
5+
// RUN: %GPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
6+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
7+
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.txt || true
8+
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
9+
//
10+
// CHECK-NOT: One shouldn't see this message
11+
// FIXME Windows versionprints '(null)' instead of '<unknown func>' once in a
12+
// while for some insane reason.
13+
// CHECK: {{.*}}assert_in_kernels.hpp:26: {{<unknown func>|(null)}}: global id: [{{[0,2]}},0,0], local id: [0,0,0]
14+
// CHECK-SAME: Assertion `Buf[wiID] == 0 && "from assert statement"` failed.
15+
// CHECK-NOT: test aborts earlier, one shouldn't see this message
16+
// CHECK-NOT: The test ended.
17+
18+
#include "assert_in_kernels.hpp"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// REQUIRES: linux
2+
// FIXME unsupported on CUDA and HIP until fallback libdevice becomes available
3+
// UNSUPPORTED: cuda || hip
4+
// RUN: %clangxx -DSYCL_ENABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple -I %S/Inputs %s %S/Inputs/kernels_in_file2.cpp -o %t.out
5+
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
6+
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
7+
// RUN: %GPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
8+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
9+
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.txt || true
10+
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
11+
//
12+
// CHECK: {{.*}}kernels_in_file2.cpp:15: int calculus(int): global id: [5,0,0], local id: [1,0,0]
13+
// CHECK-SAME: Assertion `X && "this message from calculus"` failed.
14+
// CHECK-NOT: this message from file2
15+
// CHECK-NOT: The test ended.
16+
17+
#include "assert_in_multiple_tus.hpp"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#include "Inputs/kernels_in_file2.hpp"
2+
#include <CL/sycl.hpp>
3+
#include <iostream>
4+
5+
#ifdef DEFINE_NDEBUG_INFILE1
6+
#define NDEBUG
7+
#else
8+
#undef NDEBUG
9+
#endif
10+
11+
#include <cassert>
12+
13+
using namespace cl::sycl;
14+
using namespace cl::sycl::access;
15+
16+
static constexpr size_t BUFFER_SIZE = 16;
17+
18+
int checkFunction() {
19+
int X = calculus(0);
20+
assert(X && "Nil in result");
21+
return X;
22+
}
23+
24+
void enqueueKernel_1_fromFile1(queue *Q) {
25+
cl::sycl::range<1> numOfItems{BUFFER_SIZE};
26+
cl::sycl::buffer<int, 1> Buf(numOfItems);
27+
28+
Q->submit([&](handler &CGH) {
29+
auto Acc = Buf.template get_access<mode::read_write>(CGH);
30+
31+
CGH.parallel_for<class Kernel_1>(
32+
cl::sycl::nd_range(Buf.get_range(), cl::sycl::range<1>(4)),
33+
[=](cl::sycl::id<1> wiID) {
34+
int X = 0;
35+
if (wiID == 5)
36+
X = checkFunction();
37+
Acc[wiID] = X;
38+
});
39+
});
40+
}
41+
42+
int main(int Argc, const char *Argv[]) {
43+
44+
queue Q;
45+
enqueueKernel_1_fromFile1(&Q);
46+
enqueueKernel_2_fromFile2(&Q);
47+
Q.wait();
48+
49+
std::cout << "The test ended." << std::endl;
50+
return 0;
51+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// REQUIRES: linux
2+
// FIXME unsupported on CUDA and HIP until fallback libdevice becomes available
3+
// UNSUPPORTED: cuda || hip
4+
// RUN: %clangxx -DSYCL_ENABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out
5+
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
6+
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
7+
// RUN: %GPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
8+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
9+
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.txt || true
10+
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
11+
//
12+
// CHECK-NOT: this message from calculus
13+
// CHECK: {{.*}}assert_in_multiple_tus.hpp:20: int checkFunction(): global id: [5,0,0],
14+
// CHECK-SAME: local id: [1,0,0] Assertion `X && "Nil in result"` failed.
15+
// CHECK-NOT: this message from file2
16+
// CHECK-NOT: The test ended.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// REQUIRES: windows
2+
// RUN: %clangxx -DSYCL_ENABLE_FALLBACK_ASSERT -fsycl -fsycl-targets=%sycl_triple -DDEFINE_NDEBUG_INFILE2 -I %S/Inputs %S/assert_in_multiple_tus.cpp %S/Inputs/kernels_in_file2.cpp -o %t.out
3+
// RUN: %CPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
4+
// RUN: %CPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
5+
// RUN: %GPU_RUN_PLACEHOLDER %t.out &> %t.txt || true
6+
// RUN: %GPU_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
7+
// RUN: %ACC_RUN_PLACEHOLDER %t.out &> %t.txt || true
8+
// RUN: %ACC_RUN_PLACEHOLDER FileCheck %s --input-file %t.txt
9+
//
10+
// CHECK-NOT: this message from calculus
11+
// FIXME Windows versionprints '(null)' instead of '<unknown func>' once in a
12+
// while for some insane reason.
13+
// CHECK: {{.*}}assert_in_multiple_tus.hpp:20: {{<unknown func>|(null)}}: global id: [5,0,0],
14+
// CHECK-SAME: local id: [1,0,0] Assertion `X && "Nil in result"` failed.
15+
// CHECK-NOT: this message from file2
16+
// CHECK-NOT: The test ended.

0 commit comments

Comments
 (0)