Skip to content

Commit 9613afe

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web' (29 commits)
2 parents 7973d80 + acbca47 commit 9613afe

File tree

159 files changed

+2122
-946
lines changed

Some content is hidden

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

159 files changed

+2122
-946
lines changed

.github/workflows/sycl-linux-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ jobs:
296296
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-cov
297297
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-profdata
298298
cmake --build $GITHUB_WORKSPACE/build --target install-compiler-rt
299+
# This is required to perform the DeviceConfigFile consistency test, see
300+
# sycl/test-e2e/Basic/device_config_file_consistency.cpp.
301+
cmake --install $GITHUB_WORKSPACE/build --component DeviceConfigFile
299302
- name: Additional Install for "--shared-libs" build
300303
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
301304
run: |

buildbot/configure.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def do_configure(args, passthrough_args):
6666
xpti_enable_werror = "OFF"
6767
llvm_enable_zstd = "OFF"
6868
spirv_enable_dis = "OFF"
69-
sycl_install_device_config_file = "OFF"
7069

7170
if sys.platform != "darwin":
7271
# For more info on the enablement of level_zero_v2 refer to this document:
@@ -162,7 +161,6 @@ def do_configure(args, passthrough_args):
162161
libclc_targets_to_build += libclc_nvidia_target_names
163162
libclc_gen_remangled_variants = "ON"
164163
spirv_enable_dis = "ON"
165-
sycl_install_device_config_file = "ON"
166164

167165
if args.enable_backends:
168166
sycl_enabled_backends += args.enable_backends
@@ -211,7 +209,6 @@ def do_configure(args, passthrough_args):
211209
"-DSYCL_ENABLE_EXTENSION_JIT={}".format(sycl_enable_jit),
212210
"-DSYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB={}".format(sycl_preview_lib),
213211
"-DBUG_REPORT_URL=https://github.com/intel/llvm/issues",
214-
"-DSYCL_INSTALL_DEVICE_CONFIG_FILE={}".format(sycl_install_device_config_file),
215212
]
216213

217214
if libclc_enabled:

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12949,7 +12949,8 @@ static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context,
1294912949
if (Context.shouldExternalize(D))
1295012950
return GVA_StrongExternal;
1295112951
} else if (Context.getLangOpts().SYCLIsDevice &&
12952-
D->hasAttr<DeviceKernelAttr>()) {
12952+
(D->hasAttr<DeviceKernelAttr>() &&
12953+
D->getAttr<DeviceKernelAttr>()->isImplicit())) {
1295312954
if (L == GVA_DiscardableODR)
1295412955
return GVA_StrongODR;
1295512956
}

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4099,10 +4099,13 @@ class SyclKernelBodyCreator : public SyclKernelFieldHandler {
40994099
}
41004100

41014101
void addArrayElementInit(FieldDecl *FD, QualType T) {
4102-
Expr *RCE = createReinterpretCastExpr(
4103-
createGetAddressOf(ArrayParamBases.pop_back_val()),
4104-
SemaSYCLRef.getASTContext().getPointerType(T));
4105-
Expr *Initializer = createDerefOp(RCE);
4102+
Expr *Initializer = ArrayParamBases.pop_back_val();
4103+
if (!T->isPointerType()) {
4104+
Expr *RCE = createReinterpretCastExpr(
4105+
createGetAddressOf(Initializer),
4106+
SemaSYCLRef.getASTContext().getPointerType(T));
4107+
Initializer = createDerefOp(RCE);
4108+
}
41064109
addFieldInit(FD, T, Initializer);
41074110
}
41084111

@@ -5447,9 +5450,13 @@ void SemaSYCL::ConstructOpenCLKernel(FunctionDecl *KernelCallerFunc,
54475450
ESIMDKernelDiagnostics esimdKernel(*this, KernelObj->getLocation(),
54485451
IsSIMDKernel);
54495452

5450-
SyclKernelDeclCreator kernel_decl(*this, KernelObj->getLocation(),
5451-
KernelCallerFunc->isInlined(), IsSIMDKernel,
5452-
KernelCallerFunc);
5453+
// In case of syntax errors in input programs we are not able to access
5454+
// CallOperator. In this case the value of IsInlined doesn't matter, because
5455+
// compilation will fail with errors anyways.
5456+
const bool IsInlined =
5457+
CallOperator ? CallOperator->isInlined() : /* placeholder */ false;
5458+
SyclKernelDeclCreator kernel_decl(*this, KernelObj->getLocation(), IsInlined,
5459+
IsSIMDKernel, KernelCallerFunc);
54535460
SyclKernelBodyCreator kernel_body(*this, kernel_decl, KernelObj,
54545461
KernelCallerFunc, IsSIMDKernel,
54555462
CallOperator);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 5
2+
// RUN: %clang_cc1 -fsycl-is-device -internal-isystem %S/Inputs -triple spir64-unknown-unknown -disable-llvm-passes -emit-llvm %s -o - | FileCheck %s
3+
4+
#include "sycl.hpp"
5+
6+
sycl::queue myQueue;
7+
8+
using namespace sycl;
9+
10+
// CHECK: %struct.__wrapper_class = type { [2 x i32] }
11+
// CHECK: %class.anon = type { [2 x i32] }
12+
// CHECK: %struct.__wrapper_class.0 = type { [2 x ptr addrspace(1)] }
13+
// CHECK: %class.anon.1 = type { [2 x ptr addrspace(4)] }
14+
15+
int main() {
16+
int Array[2];
17+
myQueue.submit([&](sycl::handler &h) {
18+
h.single_task<class IntArray>(
19+
[=] {
20+
int local = Array[1];
21+
});
22+
});
23+
24+
// CHECK-LABEL: @{{.*}}IntArray(ptr {{.*}}byval(%struct.__wrapper_class)
25+
// CHECK: %__SYCLKernel = alloca %class.anon, align 4
26+
// CHECK: %__SYCLKernel.ascast = addrspacecast ptr %__SYCLKernel to ptr addrspace(4)
27+
// CHECK: %_arg_Array.ascast = addrspacecast ptr %_arg_Array to ptr addrspace(4)
28+
// CHECK: %Array = getelementptr inbounds nuw %class.anon, ptr addrspace(4) %__SYCLKernel.ascast, i32 0, i32 0
29+
// CHECK: %0 = getelementptr inbounds nuw %struct.__wrapper_class, ptr addrspace(4) %_arg_Array.ascast, i32 0, i32 0
30+
// CHECK: %arrayinit.begin = getelementptr inbounds [2 x i32], ptr addrspace(4) %Array, i64 0, i64 0
31+
// CHECK: br label %arrayinit.body
32+
// CHECK: arrayinit.body: ; preds = %arrayinit.body, %entry
33+
// CHECK: %arrayinit.index = phi i64 [ 0, %entry ], [ %arrayinit.next, %arrayinit.body ]
34+
// CHECK: %1 = getelementptr inbounds i32, ptr addrspace(4) %arrayinit.begin, i64 %arrayinit.index
35+
// CHECK: %arrayidx = getelementptr inbounds nuw [2 x i32], ptr addrspace(4) %0, i64 0, i64 %arrayinit.index
36+
// CHECK: %2 = load i32, ptr addrspace(4) %arrayidx, align 4
37+
// CHECK: store i32 %2, ptr addrspace(4) %1, align 4
38+
// CHECK: %arrayinit.next = add nuw i64 %arrayinit.index, 1
39+
// CHECK: %arrayinit.done = icmp eq i64 %arrayinit.next, 2
40+
// CHECK: br i1 %arrayinit.done, label %arrayinit.end, label %arrayinit.body
41+
// CHECK: arrayinit.end: ; preds = %arrayinit.body
42+
43+
int *ArrayOfPointers[2];
44+
myQueue.submit([&](sycl::handler &h) {
45+
h.single_task<class PtrArray>(
46+
[=] {
47+
int local = *ArrayOfPointers[1];
48+
});
49+
});
50+
// CHECK-LABEL: @{{.*}}PtrArray(ptr {{.*}}byval(%struct.__wrapper_class.0)
51+
// CHECK: %__SYCLKernel = alloca %class.anon.1, align 8
52+
// CHECK: %__SYCLKernel.ascast = addrspacecast ptr %__SYCLKernel to ptr addrspace(4)
53+
// CHECK: %_arg_ArrayOfPointers.ascast = addrspacecast ptr %_arg_ArrayOfPointers to ptr addrspace(4)
54+
// CHECK: %ArrayOfPointers = getelementptr inbounds nuw %class.anon.1, ptr addrspace(4) %__SYCLKernel.ascast, i32 0, i32 0
55+
// CHECK: %0 = getelementptr inbounds nuw %struct.__wrapper_class.0, ptr addrspace(4) %_arg_ArrayOfPointers.ascast, i32 0, i32 0
56+
// CHECK: %arrayidx = getelementptr inbounds nuw [2 x ptr addrspace(1)], ptr addrspace(4) %0, i64 0, i64 0
57+
// CHECK: %1 = load ptr addrspace(1), ptr addrspace(4) %arrayidx, align 8
58+
// CHECK: %2 = addrspacecast ptr addrspace(1) %1 to ptr addrspace(4)
59+
// CHECK: store ptr addrspace(4) %2, ptr addrspace(4) %ArrayOfPointers, align 8
60+
// CHECK: %arrayinit.element = getelementptr inbounds ptr addrspace(4), ptr addrspace(4) %ArrayOfPointers, i64 1
61+
// CHECK: %3 = getelementptr inbounds nuw %struct.__wrapper_class.0, ptr addrspace(4) %_arg_ArrayOfPointers.ascast, i32 0, i32 0
62+
// CHECK: %arrayidx1 = getelementptr inbounds nuw [2 x ptr addrspace(1)], ptr addrspace(4) %3, i64 0, i64 1
63+
// CHECK: %4 = load ptr addrspace(1), ptr addrspace(4) %arrayidx1, align 8
64+
// CHECK: %5 = addrspacecast ptr addrspace(1) %4 to ptr addrspace(4)
65+
// CHECK: store ptr addrspace(4) %5, ptr addrspace(4) %arrayinit.element, align 8
66+
}

clang/test/CodeGenSYCL/device_has.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using namespace sycl;
77
queue q;
88

9-
// CHECK-DAG: define dso_local spir_kernel void @{{.*}}kernel_name_1{{.*}} !sycl_declared_aspects ![[ASPECTS1:[0-9]+]] !srcloc ![[SRCLOC1:[0-9]+]]
9+
// CHECK-DAG: define {{.*}}spir_kernel void @{{.*}}kernel_name_1{{.*}} !sycl_declared_aspects ![[ASPECTS1:[0-9]+]] !srcloc ![[SRCLOC1:[0-9]+]]
1010

1111
// CHECK-DAG: define {{.*}}spir_func void @{{.*}}func1{{.*}} !sycl_declared_aspects ![[ASPECTS1]] !srcloc ![[SRCLOC2:[0-9]+]] {
1212
[[sycl::device_has(sycl::aspect::cpu)]] void func1() {}
@@ -67,7 +67,7 @@ void foo() {
6767
q.submit([&](handler &h) {
6868
KernelFunctor f1;
6969
h.single_task<class kernel_name_1>(f1);
70-
// CHECK-DAG: define dso_local spir_kernel void @{{.*}}kernel_name_2{{.*}} !sycl_declared_aspects ![[ASPECTS4:[0-9]+]] !srcloc ![[SRCLOC8:[0-9]+]]
70+
// CHECK-DAG: define {{.*}}spir_kernel void @{{.*}}kernel_name_2{{.*}} !sycl_declared_aspects ![[ASPECTS4:[0-9]+]] !srcloc ![[SRCLOC8:[0-9]+]]
7171
h.single_task<class kernel_name_2>([]() [[sycl::device_has(sycl::aspect::gpu)]] {});
7272
});
7373
}

clang/test/CodeGenSYCL/dynamic_local_accessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// The first two RUN commands verify that the init call is generated with the correct arguments in LLVM IR
88
// and the second two RUN commands verify the contents of the integration header produced by the frontend.
99
//
10-
// CHECK-IR: define dso_local spir_kernel void @
10+
// CHECK-IR: define {{.*}}spir_kernel void @
1111
// CHECK-IR-SAME: ptr addrspace(3) noundef align 4 [[PTR:%[a-zA-Z0-9_]+]]
1212
//
1313
// CHECK-IR: [[PTR]].addr = alloca ptr addrspace(3), align 8

clang/test/CodeGenSYCL/dynamic_work_group_memory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// The first two RUN commands verify that the init call is generated with the correct arguments in LLVM IR
88
// and the second two RUN commands verify the contents of the integration header produced by the frontend.
99
//
10-
// CHECK-IR: define dso_local spir_kernel void @
10+
// CHECK-IR: define {{.*}}spir_kernel void @
1111
// CHECK-IR-SAME: ptr addrspace(3) noundef align 4 [[PTR:%[a-zA-Z0-9_]+]]
1212
//
1313
// CHECK-IR: [[PTR]].addr = alloca ptr addrspace(3), align 8

clang/test/CodeGenSYCL/generated-types-initialization.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int main() {
3838
});
3939
return 0;
4040
}
41-
// CHECK: define dso_local spir_kernel void @{{.*}}basic(ptr noundef byval(%struct.__generated_B) align 8 %_arg_Obj)
41+
// CHECK: define {{.*}}spir_kernel void @{{.*}}basic(ptr noundef byval(%struct.__generated_B) align 8 %_arg_Obj)
4242
//
4343
// Kernel object clone.
4444
// CHECK: %[[K:[a-zA-Z0-9_.]+]] = alloca %class.anon
@@ -54,7 +54,7 @@ int main() {
5454
// Kernel body call.
5555
// CHECK: call spir_func void @_ZZZ4mainENKUlRN4sycl3_V17handlerEE_clES2_ENKUlvE_clEv(ptr addrspace(4) noundef align 8 dereferenceable_or_null(16) %[[K_as_cast]])
5656

57-
// CHECK: define dso_local spir_kernel void @{{.*}}nns(ptr noundef byval(%struct.__generated_B.0) align 8 %_arg_NNSObj)
57+
// CHECK: define {{.*}}spir_kernel void @{{.*}}nns(ptr noundef byval(%struct.__generated_B.0) align 8 %_arg_NNSObj)
5858
//
5959
// Kernel object clone.
6060
// CHECK: %[[NNSK:[a-zA-Z0-9_.]+]] = alloca %class.anon.2

clang/test/CodeGenSYCL/kernel-handler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ void test(int val) {
2222
});
2323
}
2424

25-
// ALL: define dso_local{{ spir_kernel | ptx_kernel | }}void @{{.*}}test_kernel_handler{{[^(]*}}
25+
// ALL: define {{.*}}{{ spir_kernel | ptx_kernel | }}void @{{.*}}test_kernel_handler{{[^(]*}}
2626
// NONATIVESUPPORT-SAME: (ptr noundef byval(%class.anon) align 4 %_arg__sycl_functor, ptr addrspace(1) noundef align 1 %_arg__specialization_constants_buffer)
2727
// NATIVESUPPORT-SAME: (i32 noundef %_arg_a, ptr addrspace(1) noundef align 1 %_arg__specialization_constants_buffer)
2828
// ALL: %kh = alloca %"class.sycl::_V1::kernel_handler", align 1

0 commit comments

Comments
 (0)