Skip to content

Commit b59a104

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (#2)
2 parents 4d6f76e + defe007 commit b59a104

File tree

18 files changed

+467
-150
lines changed

18 files changed

+467
-150
lines changed

CONTRIBUTING.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
## License
44
Intel Project for LLVM* technology is licensed under the terms of the
5-
Apache-2.0 with LLVM-exception license (
6-
[LICENSE.txt](https://github.com/intel/llvm/blob/intel/llvm/LICENSE.TXT))
5+
Apache-2.0 with LLVM-exception license ([LICENSE.txt](llvm/LICENSE.TXT))
76
to ensure our ability to contribute this project to the LLVM project
87
under the same license.
98

@@ -63,32 +62,36 @@ Then you just add a line to every git commit message:
6362

6463
Use your real name (sorry, no pseudonyms or anonymous contributions.)
6564

66-
If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with `git commit -s`.
65+
If you set your `user.name` and `user.email` git configs, you can sign your
66+
commit automatically with `git commit -s`.
6767

6868
## Contribution process
6969

7070
### Development
7171

72-
- Create a personal fork of the project on GitHub.
73-
- Use **sycl** branch as baseline for your changes.
74-
- Prepare your patch (follow [LLVM coding standards](https://llvm.org/docs/CodingStandards.html)).
75-
- Build the project and run all tests (see [GetStartedWithSYCLCompiler.md](https://github.com/intel/llvm/blob/sycl/sycl/doc/GetStartedWithSYCLCompiler.md))
72+
- Create a personal fork of the project on GitHub
73+
- Use **sycl** branch as baseline for your changes
74+
- Prepare your patch (follow
75+
[LLVM coding standards](https://llvm.org/docs/CodingStandards.html))
76+
- Build the project and run all tests (see
77+
[GetStartedWithSYCLCompiler.md](sycl/doc/GetStartedWithSYCLCompiler.md))
7678

7779
### Review and acceptance testing
7880

79-
- Create a pull request for your changes following [Creating a pull request instructions](https://help.github.com/articles/creating-a-pull-request/).
80-
- When the pull request is created signed-off check is done.
81-
- **check_pr** - verifies that the signed-off mark is added to each commit message.
82-
- Once the pull request is approved by an Intel representative, build and functional testing are started.
83-
- **sycl-ubu-x64-pr** - runs all LIT tests on machine with OpenCL runtimes for CPU and GPU.
84-
- Approval is lost once the PR branch is updated. New approval and checks rerun are required.
85-
- Once approval is received and all checks pass, the pull request is ready to be merged.
81+
- Create a pull request for your changes following [Creating a pull request
82+
instructions](https://help.github.com/articles/creating-a-pull-request/)
83+
- CI will run signed-off check as soon as PR is created, see **check_pr** CI
84+
check for results
85+
- CI will run build and functional testing check as soon as PR is approved by
86+
Intel representative
87+
- New approval is needed if PR was updated (e.g. during code review)
88+
- Once PR is approved and all checks pass, the pull request is ready for merge
8689

8790
### Merge
8891

89-
Merge of pull request is done only by project maintainers. There are three options:
90-
- [Rebase and merge] The preferable choice for PRs containing a single commit.
91-
- [Squash and merge] Used when there are multiple commits in the PR.
92-
Squashing is done to shorten history and make sure that the project is buildable on any commit.
93-
- [Create a merge commit] Used for pull down PRs to avoid duplication of
94-
LLVM commits.
92+
Project maintainers merge pull requests using one of the following options:
93+
- [Rebase and merge] The preferable choice for PRs containing a single commit
94+
- [Squash and merge] Used when there are multiple commits in the PR
95+
- Squashing is done to make sure that the project is buildable on any commit
96+
- [Create a merge commit] Used for LLVM pull-down PRs to preserve hashes of the
97+
commits pulled from the LLVM community repository

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,6 +1425,12 @@ Sema::DeviceDiagBuilder Sema::SYCLDiagIfDeviceCode(SourceLocation Loc,
14251425

14261426
void Sema::checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee) {
14271427
assert(Callee && "Callee may not be null.");
1428+
1429+
// Errors in unevaluated context don't need to be generated,
1430+
// so we can safely skip them.
1431+
if (isUnevaluatedContext())
1432+
return;
1433+
14281434
FunctionDecl *Caller = dyn_cast<FunctionDecl>(getCurLexicalContext());
14291435

14301436
// If the caller is known-emitted, mark the callee as known-emitted.

clang/test/Driver/clang-offload-wrapper.c

Lines changed: 69 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,64 @@
55
//
66

77
// RUN: clang-offload-wrapper --help | FileCheck %s --check-prefix CHECK-HELP
8-
// CHECK-HELP: {{.*}}OVERVIEW: A tool to create a wrapper bitcode for offload target binaries.
9-
// CHECK-HELP: {{.*}}Takes offload target binaries and optional manifest files as input
10-
// CHECK-HELP: {{.*}}and produces bitcode file containing target binaries packaged as data
11-
// CHECK-HELP: {{.*}}and initialization code which registers target binaries in the offload
12-
// CHECK-HELP: {{.*}}runtime. Manifest files format and contents are not restricted and are
13-
// CHECK-HELP: {{.*}}a subject of agreement between the device compiler and the native
14-
// CHECK-HELP: {{.*}}runtime for that device. When present, manifest file name should
15-
// CHECK-HELP: {{.*}}immediately follow the corresponding device image filename on the
16-
// CHECK-HELP: {{.*}}command line. Options annotating a device binary have effect on all
17-
// CHECK-HELP: {{.*}}subsequent input, until redefined. For example:
18-
// CHECK-HELP: {{.*}}$clang-offload-wrapper -host x86_64-pc-linux-gnu \
19-
// CHECK-HELP: {{.*}} -kind=sycl -target=spir64 -format=spirv -build-opts=-g \
20-
// CHECK-HELP: {{.*}} a.spv a_mf.txt \
21-
// CHECK-HELP: {{.*}} -target=xxx -format=native -build-opts="" \
22-
// CHECK-HELP: {{.*}} b.bin b_mf.txt \
23-
// CHECK-HELP: {{.*}} -kind=openmp \
24-
// CHECK-HELP: {{.*}} c.bin
25-
// CHECK-HELP: {{.*}}will generate an x86 wrapper object (.bc) enclosing the following
26-
// CHECK-HELP: {{.*}}tuples describing a single device binary each ('-' means 'none')
27-
// CHECK-HELP: {{.*}}offload kind | target | data format | data | manifest | build options:
28-
// CHECK-HELP: {{.*}}----------------------------------------------------------------------
29-
// CHECK-HELP: {{.*}} sycl | spir64 | spirv | a.spv| a_mf.txt | -g
30-
// CHECK-HELP: {{.*}} sycl | xxx | native | b.bin| b_mf.txt | -
31-
// CHECK-HELP: {{.*}} openmp | xxx | native | c.bin| - | -
32-
// CHECK-HELP: {{.*}}USAGE: clang-offload-wrapper [options] <input files>
33-
// CHECK-HELP: {{.*}}OPTIONS:
34-
// CHECK-HELP: {{.*}}clang-offload-wrapper options:
35-
// CHECK-HELP: {{.*}} --build-opts=<string> - build options passed to the offload runtime
36-
// CHECK-HELP: {{.*}} --desc-name=<name> - Specifies offload descriptor symbol name: '.<offload kind>.<name>', and makes it globally visible
37-
// CHECK-HELP: {{.*}} --emit-reg-funcs - Emit [un-]registration functions
38-
// CHECK-HELP: {{.*}} --entries=<filename> - File listing all offload function entries, SYCL offload only
39-
// CHECK-HELP: {{.*}} --format=<value> - device binary image formats:
40-
// CHECK-HELP: {{.*}} =none - not set
41-
// CHECK-HELP: {{.*}} =native - unknown or native
42-
// CHECK-HELP: {{.*}} =spirv - SPIRV binary
43-
// CHECK-HELP: {{.*}} =llvmbc - LLVMIR bitcode
44-
// CHECK-HELP: {{.*}} --host=<triple> - Target triple for the output module
45-
// CHECK-HELP: {{.*}} --kind=<value> - offload kind:
46-
// CHECK-HELP: {{.*}} =unknown - unknown
47-
// CHECK-HELP: {{.*}} =host - host
48-
// CHECK-HELP: {{.*}} =openmp - OpenMP
49-
// CHECK-HELP: {{.*}} =hip - HIP
50-
// CHECK-HELP: {{.*}} =sycl - SYCL
51-
// CHECK-HELP: {{.*}} -o=<filename> - Output filename
52-
// CHECK-HELP: {{.*}} --target=<string> - offload target triple
53-
// CHECK-HELP: {{.*}} -v - verbose output
8+
// CHECK-HELP: A tool to create a wrapper bitcode for offload target binaries.
9+
// CHECK-HELP: Takes offload target binaries and optional manifest files as input
10+
// CHECK-HELP: and produces bitcode file containing target binaries packaged as data
11+
// CHECK-HELP: and initialization code which registers target binaries in the offload
12+
// CHECK-HELP: runtime. Manifest files format and contents are not restricted and are
13+
// CHECK-HELP: a subject of agreement between the device compiler and the native
14+
// CHECK-HELP: runtime for that device. When present, manifest file name should
15+
// CHECK-HELP: immediately follow the corresponding device image filename on the
16+
// CHECK-HELP: command line. Options annotating a device binary have effect on all
17+
// CHECK-HELP: subsequent input, until redefined.
18+
// CHECK-HELP: For example:
19+
// CHECK-HELP: clang-offload-wrapper
20+
// CHECK-HELP: -host x86_64-pc-linux-gnu
21+
// CHECK-HELP: -kind=sycl
22+
// CHECK-HELP: -target=spir64
23+
// CHECK-HELP: -format=spirv
24+
// CHECK-HELP: -compile-opts=-g
25+
// CHECK-HELP: -link-opts=-cl-denorms-are-zero
26+
// CHECK-HELP: a.spv
27+
// CHECK-HELP: a_mf.txt
28+
// CHECK-HELP: -target=xxx
29+
// CHECK-HELP: -format=native
30+
// CHECK-HELP: -compile-opts=""
31+
// CHECK-HELP: -link-opts=""
32+
// CHECK-HELP: b.bin
33+
// CHECK-HELP: b_mf.txt
34+
// CHECK-HELP: -kind=openmp
35+
// CHECK-HELP: c.bin
36+
// CHECK-HELP: This command generates an x86 wrapper object (.bc) enclosing the
37+
// CHECK-HELP: following tuples describing a single device binary each:
38+
// CHECK-HELP: offload kind | target | data format | data | manifest | build options:
39+
// CHECK-HELP: ----------------------------------------------------------------------
40+
// CHECK-HELP: sycl | spir64 | spirv | a.spv| a_mf.txt | -g
41+
// CHECK-HELP: sycl | xxx | native | b.bin| b_mf.txt | -
42+
// CHECK-HELP: openmp | xxx | native | c.bin| n/a | -
43+
// CHECK-HELP: USAGE: clang-offload-wrapper [options] <input files>
44+
// CHECK-HELP: OPTIONS:
45+
// CHECK-HELP: clang-offload-wrapper options:
46+
// CHECK-HELP: --compile-opts=<string> - compile options passed to the offload runtime
47+
// CHECK-HELP: --desc-name=<name> - Specifies offload descriptor symbol name: '.<offload kind>.<name>', and makes it globally visible
48+
// CHECK-HELP: --emit-reg-funcs - Emit [un-]registration functions
49+
// CHECK-HELP: --entries=<filename> - File listing all offload function entries, SYCL offload only
50+
// CHECK-HELP: --format=<value> - device binary image formats:
51+
// CHECK-HELP: =none - not set
52+
// CHECK-HELP: =native - unknown or native
53+
// CHECK-HELP: =spirv - SPIRV binary
54+
// CHECK-HELP: =llvmbc - LLVMIR bitcode
55+
// CHECK-HELP: --host=<triple> - Target triple for the output module
56+
// CHECK-HELP: --kind=<value> - offload kind:
57+
// CHECK-HELP: =unknown - unknown
58+
// CHECK-HELP: =host - host
59+
// CHECK-HELP: =openmp - OpenMP
60+
// CHECK-HELP: =hip - HIP
61+
// CHECK-HELP: =sycl - SYCL
62+
// CHECK-HELP: --link-opts=<string> - link options passed to the offload runtime
63+
// CHECK-HELP: -o=<filename> - Output filename
64+
// CHECK-HELP: --target=<string> - offload target triple
65+
// CHECK-HELP: -v - verbose output
5466

5567
// -------
5668
// Generate files to wrap.
@@ -66,8 +78,10 @@
6678
// RUN: clang-offload-wrapper \
6779
// RUN: -host=x86_64-pc-linux-gnu \
6880
// RUN: -kind=openmp -target=tg2 -format=native %t3.tgt %t1_mf.txt \
69-
// RUN: -kind=sycl -target=tg1 -build-opts=-g -format spirv %t1.tgt \
70-
// RUN: -target=tg2 -build-opts= -format native %t2.tgt \
81+
// RUN: -kind=sycl -target=tg1 -compile-opts=-g -link-opts=-cl-denorms-are-zero \
82+
// RUN: -format spirv %t1.tgt \
83+
// RUN: -target=tg2 -compile-opts= -link-opts= \
84+
// RUN: -format native %t2.tgt \
7185
// RUN: -o %t.wrapper.bc
7286
// RUN: llvm-dis %t.wrapper.bc -o - | FileCheck %s --check-prefix CHECK-IR
7387

@@ -77,7 +91,7 @@
7791
// CHECK-IR-DAG: [[IMAGETY:%.+]] = type { i8*, i8*, [[ENTTY]]*, [[ENTTY]]* }
7892
// CHECK-IR-DAG: [[DESCTY:%.+]] = type { i32, [[IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* }
7993

80-
// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, [[ENTTY]]*, [[ENTTY]]* }
94+
// CHECK-IR-DAG: [[SYCL_IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, [[ENTTY]]*, [[ENTTY]]* }
8195
// CHECK-IR-DAG: [[SYCL_DESCTY:%.+]] = type { i16, i16, [[SYCL_IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* }
8296

8397
// CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]]
@@ -92,14 +106,16 @@
92106
// CHECK-IR: [[OMP_DESC:@.+]] = internal constant [[DESCTY]] { i32 1, [[IMAGETY]]* getelementptr inbounds ([1 x [[IMAGETY]]], [1 x [[IMAGETY]]]* [[OMP_IMAGES]], i64 0, i64 0), [[ENTTY]]* [[ENTBEGIN]], [[ENTTY]]* [[ENTEND]] }
93107

94108
// CHECK-IR: [[SYCL_TGT0:@.+]] = internal unnamed_addr constant [4 x i8] c"tg1\00"
95-
// CHECK-IR: [[SYCL_OPTS0:@.+]] = internal unnamed_addr constant [3 x i8] c"-g\00"
109+
// CHECK-IR: [[SYCL_COMPILE_OPTS0:@.+]] = internal unnamed_addr constant [3 x i8] c"-g\00"
110+
// CHECK-IR: [[SYCL_LINK_OPTS0:@.+]] = internal unnamed_addr constant [21 x i8] c"-cl-denorms-are-zero\00"
96111
// CHECK-IR: [[SYCL_BIN0:@.+]] = internal unnamed_addr constant [[SYCL_BIN0TY:\[[0-9]+ x i8\]]] c"Content of device file1{{.+}}"
97112

98113
// CHECK-IR: [[SYCL_TGT1:@.+]] = internal unnamed_addr constant [4 x i8] c"tg2\00"
99-
// CHECK-IR: [[SYCL_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer
114+
// CHECK-IR: [[SYCL_COMPILE_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer
115+
// CHECK-IR: [[SYCL_LINK_OPTS1:@.+]] = internal unnamed_addr constant [1 x i8] zeroinitializer
100116
// CHECK-IR: [[SYCL_BIN1:@.+]] = internal unnamed_addr constant [[SYCL_BIN1TY:\[[0-9]+ x i8\]]] c"Content of device file2{{.+}}"
101117

102-
// CHECK-IR: [[SYCL_IMAGES:@.+]] = internal unnamed_addr constant [2 x [[SYCL_IMAGETY]]] [{{.+}} { i16 1, i8 4, i8 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[SYCL_TGT0]], i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[SYCL_OPTS0]], i64 0, i64 0), i8* null, i8* null, i8* getelementptr inbounds ([[SYCL_BIN0TY]], [[SYCL_BIN0TY]]* [[SYCL_BIN0]], i64 0, i64 0), i8* getelementptr inbounds ([[SYCL_BIN0TY]], [[SYCL_BIN0TY]]* [[SYCL_BIN0]], i64 1, i64 0), [[ENTTY]]* null, [[ENTTY]]* null }, [[SYCL_IMAGETY]] { i16 1, i8 4, i8 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[SYCL_TGT1]], i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* [[SYCL_OPTS1]], i64 0, i64 0), i8* null, i8* null, i8* getelementptr inbounds ([[SYCL_BIN1TY]], [[SYCL_BIN1TY]]* [[SYCL_BIN1]], i64 0, i64 0), i8* getelementptr inbounds ([[SYCL_BIN1TY]], [[SYCL_BIN1TY]]* [[SYCL_BIN1]], i64 1, i64 0), [[ENTTY]]* null, [[ENTTY]]* null }]
118+
// CHECK-IR: [[SYCL_IMAGES:@.+]] = internal unnamed_addr constant [2 x [[SYCL_IMAGETY]]] [{{.+}} { i16 1, i8 4, i8 2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[SYCL_TGT0]], i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* [[SYCL_COMPILE_OPTS0]], i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* [[SYCL_LINK_OPTS0]], i64 0, i64 0), i8* null, i8* null, i8* getelementptr inbounds ([[SYCL_BIN0TY]], [[SYCL_BIN0TY]]* [[SYCL_BIN0]], i64 0, i64 0), i8* getelementptr inbounds ([[SYCL_BIN0TY]], [[SYCL_BIN0TY]]* [[SYCL_BIN0]], i64 1, i64 0), [[ENTTY]]* null, [[ENTTY]]* null }, [[SYCL_IMAGETY]] { i16 1, i8 4, i8 1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* [[SYCL_TGT1]], i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* [[SYCL_COMPILE_OPTS1]], i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* [[SYCL_LINK_OPTS1]], i64 0, i64 0), i8* null, i8* null, i8* getelementptr inbounds ([[SYCL_BIN1TY]], [[SYCL_BIN1TY]]* [[SYCL_BIN1]], i64 0, i64 0), i8* getelementptr inbounds ([[SYCL_BIN1TY]], [[SYCL_BIN1TY]]* [[SYCL_BIN1]], i64 1, i64 0), [[ENTTY]]* null, [[ENTTY]]* null }]
103119

104120
// CHECK-IR: [[SYCL_DESC:@.+]] = internal constant [[SYCL_DESCTY]] { i16 1, i16 2, [[SYCL_IMAGETY]]* getelementptr inbounds ([2 x [[SYCL_IMAGETY]]], [2 x [[SYCL_IMAGETY]]]* [[SYCL_IMAGES]], i64 0, i64 0), [[ENTTY]]* null, [[ENTTY]]* null }
105121

@@ -138,7 +154,7 @@
138154
//
139155
// RUN: clang-offload-wrapper -kind sycl -host=x86_64-pc-linux-gnu -emit-reg-funcs=0 -desc-name=lalala -o - %t.tgt | llvm-dis | FileCheck %s --check-prefix CHECK-IR1
140156
// CHECK-IR1: source_filename = "offload.wrapper.object"
141-
// CHECK-IR1: [[IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, %__tgt_offload_entry*, %__tgt_offload_entry* }
157+
// CHECK-IR1: [[IMAGETY:%.+]] = type { i16, i8, i8, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %__tgt_offload_entry*, %__tgt_offload_entry* }
142158
// CHECK-IR1: [[ENTTY:%.+]] = type { i8*, i8*, i64, i32, i32 }
143159
// CHECK-IR1: [[DESCTY:%.+]] = type { i16, i16, [[IMAGETY]]*, [[ENTTY]]*, [[ENTTY]]* }
144160
// CHECK-IR1-NOT: @llvm.global_ctors
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// RUN: %clang_cc1 -fcxx-exceptions -fsycl-is-device -verify -fsyntax-only %s
2+
3+
// Check that a function used in an unevaluated context is not subject
4+
// to delayed device diagnostics.
5+
6+
bool foo1() {
7+
// Throw exception which is not allowed on device. Error is expected
8+
// only when the function is called in evaluated context.
9+
// expected-error@+1 1{{SYCL kernel cannot use exceptions}}
10+
throw 10;
11+
12+
return false;
13+
}
14+
15+
template <typename T>
16+
T foo2(T t) {
17+
throw t;
18+
return t;
19+
}
20+
21+
bool foo3() {
22+
__float128 a;
23+
return false;
24+
}
25+
26+
template <typename Name, typename Func>
27+
__attribute__((sycl_kernel)) void kernel_single_task(Func kernelFunc) {
28+
// expected-note@+1 1{{called by}}
29+
kernelFunc();
30+
}
31+
32+
int main() {
33+
using T1 = decltype(foo1());
34+
kernel_single_task<class fake_kernel>([]() {
35+
using T2 = decltype(foo1());
36+
37+
// expected-note@+1 1{{called by}}
38+
auto S1 = foo1();
39+
auto S2 = sizeof(foo1());
40+
41+
using T3 = decltype(foo2(decltype(foo1()){}));
42+
using T4 = decltype(foo3());
43+
44+
T1 f1;
45+
T2 f2;
46+
T3 f3;
47+
T4 f4;
48+
});
49+
return 0;
50+
}

0 commit comments

Comments
 (0)