Skip to content

Commit 9faf1ee

Browse files
author
iclsrc
committed
Merge from 'sycl' to 'sycl-web'
2 parents f6128cd + c90e287 commit 9faf1ee

37 files changed

+2195
-836
lines changed

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,10 +2058,17 @@ Value *ScalarExprEmitter::VisitCastExpr(CastExpr *CE) {
20582058
Value *Src = Visit(const_cast<Expr*>(E));
20592059
llvm::Type *SrcTy = Src->getType();
20602060
llvm::Type *DstTy = ConvertType(DestTy);
2061-
if (SrcTy->isPtrOrPtrVectorTy() && DstTy->isPtrOrPtrVectorTy() &&
2061+
2062+
if (SrcTy->isPointerTy() && DstTy->isPointerTy() &&
20622063
SrcTy->getPointerAddressSpace() != DstTy->getPointerAddressSpace())
20632064
Src = Builder.CreateAddrSpaceCast(
2064-
Src, llvm::PointerType::get(SrcTy, DstTy->getPointerAddressSpace()));
2065+
Src,
2066+
llvm::PointerType::getWithSamePointeeType(
2067+
cast<llvm::PointerType>(SrcTy), DstTy->getPointerAddressSpace()));
2068+
else if (SrcTy->isPtrOrPtrVectorTy() && DstTy->isPtrOrPtrVectorTy() &&
2069+
SrcTy->getPointerAddressSpace() != DstTy->getPointerAddressSpace())
2070+
llvm_unreachable("wrong cast for pointers in different address spaces"
2071+
"(must be an address space cast)!");
20652072

20662073
if (CGF.SanOpts.has(SanitizerKind::CFIUnrelatedCast)) {
20672074
if (auto *PT = DestTy->getAs<PointerType>()) {
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
// RUN: %clang_cc1 -triple spir64-unknown-linux -fsycl-is-device -disable-llvm-passes -emit-llvm -x c++ %s -o - | FileCheck %s
1+
// RUN: %clang_cc1 -triple spir64-unknown-linux -fsycl-is-device -disable-llvm-passes -opaque-pointers -emit-llvm -x c++ %s -o - | FileCheck %s
22

33
// Test to verify that address space cast is generated correctly for __builtin_alloca
44

55
__attribute__((sycl_device)) void foo() {
6-
// CHECK: %TestVar = alloca i32 addrspace(4)*, align 8
7-
// CHECK: %TestVar.ascast = addrspacecast i32 addrspace(4)** %TestVar to i32 addrspace(4)* addrspace(4)*
6+
// CHECK: %TestVar = alloca ptr addrspace(4), align 8
7+
// CHECK: %TestVar.ascast = addrspacecast ptr %TestVar to ptr addrspace(4)
88
// CHECK: %[[ALLOCA:[0-9]+]] = alloca i8, i64 1, align 8
9-
// CHECK: %[[ADDRSPCAST:[0-9]+]] = addrspacecast i8* %[[ALLOCA]] to i8* addrspace(4)*
10-
// CHECK: %[[BITCAST:[0-9]+]] = bitcast i8* addrspace(4)* %[[ADDRSPCAST]] to i32 addrspace(4)*
11-
// CHECK: store i32 addrspace(4)* %[[BITCAST]], i32 addrspace(4)* addrspace(4)* %TestVar.ascast, align 8
9+
// CHECK: %[[ADDRSPCAST:[0-9]+]] = addrspacecast ptr %[[ALLOCA]] to ptr addrspace(4)
10+
// CHECK: store ptr addrspace(4) %[[ADDRSPCAST]], ptr addrspace(4) %TestVar.ascast, align 8
1211
int *TestVar = (int *)__builtin_alloca(1);
1312
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// RUN: %clang_cc1 -triple spir64-unknown-linux -fsycl-is-device -disable-llvm-passes -no-opaque-pointers -emit-llvm -x c++ %s -o - | FileCheck %s
2+
3+
// Test to verify that address space cast is generated correctly for __builtin_alloca
4+
5+
__attribute__((sycl_device)) void foo() {
6+
// CHECK: %TestVar = alloca i32 addrspace(4)*, align 8
7+
// CHECK: %TestVar.ascast = addrspacecast i32 addrspace(4)** %TestVar to i32 addrspace(4)* addrspace(4)*
8+
// CHECK: %[[ALLOCA:[0-9]+]] = alloca i8, i64 1, align 8
9+
// CHECK: %[[ADDRSPCAST:[0-9]+]] = addrspacecast i8* %[[ALLOCA]] to i8 addrspace(4)*
10+
// CHECK: %[[BITCAST:[0-9]+]] = bitcast i8 addrspace(4)* %[[ADDRSPCAST]] to i32 addrspace(4)*
11+
// CHECK: store i32 addrspace(4)* %[[BITCAST]], i32 addrspace(4)* addrspace(4)* %TestVar.ascast, align 8
12+
int *TestVar = (int *)__builtin_alloca(1);
13+
}

devops/actions/llvm_test_suite/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,16 @@ runs:
8484
export LIT_OPTS="-v --no-progress-bar --show-unsupported --time-tests -o $PWD/build/results_${{ inputs.results_name_suffix }}.json"
8585
if [ -e /runtimes/oneapi-tbb/env/vars.sh ]; then
8686
source /runtimes/oneapi-tbb/env/vars.sh;
87+
elif [ -e /opt/runtimes/oneapi-tbb/env/vars.sh ]; then
88+
source /opt/runtimes/oneapi-tbb/env/vars.sh;
89+
else
90+
echo "no TBB vars in /opt/runtimes or /runtimes";
8791
fi
8892
# TODO remove workaround of FPGA emu bug
8993
mkdir -p icd
9094
echo /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so > icd/gpu.icd
9195
echo /runtimes/oclcpu/x64/libintelocl.so > icd/cpu.icd
96+
echo /opt/runtimes/oclcpu/x64/libintelocl.so > icd/cpu2.icd
9297
export OCL_ICD_VENDORS=$PWD/icd
9398
echo "::group::sycl-ls --verbose"
9499
sycl-ls --verbose

devops/dependencies.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
22
"linux": {
33
"compute_runtime": {
4-
"github_tag": "22.10.22597",
5-
"version": "22.10.22597",
6-
"url": "https://github.com/intel/compute-runtime/releases/tag/22.10.22597",
4+
"github_tag": "22.15.22905",
5+
"version": "22.15.22905",
6+
"url": "https://github.com/intel/compute-runtime/releases/tag/22.15.22905",
77
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
88
},
99
"igc": {
10-
"github_tag": "igc-1.0.10409",
11-
"version": "1.0.10409",
12-
"url": "https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.10409",
10+
"github_tag": "igc-1.0.10840",
11+
"version": "1.0.10840",
12+
"url": "https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.10840",
1313
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
1414
},
1515
"cm": {
16-
"github_tag": "cmclang-1.0.120",
17-
"version": "1.0.120",
18-
"url": "https://github.com/intel/cm-compiler/releases/tag/cmclang-1.0.120",
16+
"github_tag": "cmclang-1.0.144",
17+
"version": "1.0.144",
18+
"url": "https://github.com/intel/cm-compiler/releases/tag/cmclang-1.0.144",
1919
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
2020
},
2121
"tbb": {
@@ -42,21 +42,21 @@
4242
},
4343
"linux_staging": {
4444
"compute_runtime": {
45-
"github_tag": "22.11.22682",
46-
"version": "22.11.22682",
47-
"url": "https://github.com/intel/compute-runtime/releases/tag/22.11.22682",
45+
"github_tag": "22.15.22905",
46+
"version": "22.15.22905",
47+
"url": "https://github.com/intel/compute-runtime/releases/tag/22.15.22905",
4848
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
4949
},
5050
"igc": {
51-
"github_tag": "igc-1.0.10409",
52-
"version": "1.0.10409",
53-
"url": "https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.10409",
51+
"github_tag": "igc-1.0.10840",
52+
"version": "1.0.10840",
53+
"url": "https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.10840",
5454
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
5555
},
5656
"cm": {
57-
"github_tag": "cmclang-1.0.126",
58-
"version": "1.0.126",
59-
"url": "https://github.com/intel/cm-compiler/releases/tag/cmclang-1.0.126",
57+
"github_tag": "cmclang-1.0.144",
58+
"version": "1.0.144",
59+
"url": "https://github.com/intel/cm-compiler/releases/tag/cmclang-1.0.144",
6060
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
6161
},
6262
"tbb": {
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
; RUN: sycl-post-link --device-globals --ir-output-only -S %s -o %t.ll
2+
; RUN: FileCheck %s -input-file=%t.ll
3+
;
4+
; TODO: Remove --device-globals once other features start using compile-time
5+
; properties.
6+
;
7+
; Tests the translation of "sycl-properties" pointer annotations to pointer
8+
; annotations the SPIR-V translator will produce decorations from.
9+
; NOTE: These use SYCL property meta-names that are currently only intended for
10+
; use in attributes-to-metadata translations, but sycl-post-link does not
11+
; currently make the distinction so we will use them for the purpose of
12+
; testing the transformations.
13+
14+
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
15+
target triple = "spir64-unknown-unknown"
16+
17+
%struct.foo = type { i32 addrspace(4)*, i32 addrspace(4)*, i32 addrspace(4)*, i32 addrspace(4)*, i32 addrspace(4)*, i32 addrspace(4)*, i32 addrspace(4)* }
18+
19+
$_ZTSZ4mainEUlvE_ = comdat any
20+
21+
@.str = private unnamed_addr constant [16 x i8] c"sycl-properties\00", section "llvm.metadata"
22+
@.str.1 = private unnamed_addr constant [36 x i8] c"sycl-properties-ptr-annotations.cpp\00", section "llvm.metadata"
23+
@.str.2 = private unnamed_addr constant [15 x i8] c"sycl-init-mode\00", section "llvm.metadata"
24+
@.str.3 = private unnamed_addr constant [2 x i8] c"1\00", section "llvm.metadata"
25+
@.str.4 = private unnamed_addr constant [22 x i8] c"sycl-implement-in-csr\00", section "llvm.metadata"
26+
@.str.5 = private unnamed_addr constant [5 x i8] c"true\00", section "llvm.metadata"
27+
@.args = private unnamed_addr constant { [15 x i8]*, [2 x i8]*, [22 x i8]*, [5 x i8]* } { [15 x i8]* @.str.2, [2 x i8]*@.str.3, [22 x i8]* @.str.4, [5 x i8]* @.str.5 }, section "llvm.metadata"
28+
@.args.6 = private unnamed_addr constant { [15 x i8]*, [2 x i8]* } { [15 x i8]* @.str.2, [2 x i8]* @.str.3 }, section "llvm.metadata"
29+
@.args.7 = private unnamed_addr constant { [22 x i8]*, [5 x i8]* } { [22 x i8]* @.str.4, [5 x i8]* @.str.5 }, section "llvm.metadata"
30+
@.args.8 = private unnamed_addr constant { [15 x i8]*, [2 x i8]*, [22 x i8]*, [5 x i8]* } { [15 x i8]* @.str.2, [2 x i8]* @.str.3, [22 x i8]* @.str.4, [5 x i8]* @.str.5 }, section "llvm.metadata"
31+
@.str.9 = private unnamed_addr constant [18 x i8] c"sycl-unrecognized\00", section "llvm.metadata"
32+
@.args.10 = private unnamed_addr constant { [15 x i8]*, [2 x i8]*, [18 x i8]*, i8* } { [15 x i8]* @.str.2, [2 x i8]* @.str.3, [18 x i8]* @.str.9, i8* null }, section "llvm.metadata"
33+
@.args.11 = private unnamed_addr constant { [18 x i8]*, i8* } { [18 x i8]* @.str.9, i8* null }, section "llvm.metadata"
34+
35+
;CHECK: @[[NewAnnotStr1:.*]] = private unnamed_addr constant [24 x i8] c"{6148:\221\22}{6149:\22true\22}\00", section "llvm.metadata"
36+
;CHECK: @[[NewAnnotStr2:.*]] = private unnamed_addr constant [11 x i8] c"{6148:\221\22}\00", section "llvm.metadata"
37+
;CHECK: @[[NewAnnotStr3:.*]] = private unnamed_addr constant [14 x i8] c"{6149:\22true\22}\00", section "llvm.metadata"
38+
39+
; Function Attrs: mustprogress norecurse
40+
define weak_odr dso_local spir_kernel void @_ZTSZ4mainEUlvE_() local_unnamed_addr #0 comdat !kernel_arg_buffer_location !7 !sycl_kernel_omit_args !7 {
41+
entry:
42+
%x.i = alloca %struct.foo, align 8
43+
%x.ascast.i = addrspacecast %struct.foo* %x.i to %struct.foo addrspace(4)*
44+
%0 = bitcast %struct.foo* %x.i to i8*
45+
%1 = addrspacecast i8* %0 to i8 addrspace(4)*
46+
%2 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %1, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 5, i8* bitcast ({ [15 x i8]*, [2 x i8]*, [22 x i8]*, [5 x i8]* }* @.args to i8*)) #2
47+
; CHECK: %{{.*}} = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %1, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @[[NewAnnotStr1]], i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 5, i8* null)
48+
%b.i = getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %x.ascast.i, i64 0, i32 1
49+
%3 = bitcast i32 addrspace(4)* addrspace(4)* %b.i to i8 addrspace(4)*
50+
%4 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 6, i8* bitcast ({ [15 x i8]*, [2 x i8]* }* @.args.6 to i8*)) #2
51+
; CHECK: %{{.*}} = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @[[NewAnnotStr2]], i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 6, i8* null)
52+
%c.i = getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %x.ascast.i, i64 0, i32 2
53+
%5 = bitcast i32 addrspace(4)* addrspace(4)* %c.i to i8 addrspace(4)*
54+
%6 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 7, i8* bitcast ({ [22 x i8]*, [5 x i8]* }* @.args.7 to i8*)) #2
55+
; CHECK: %{{.*}} = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @[[NewAnnotStr3]], i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 7, i8* null)
56+
%d.i = getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %x.ascast.i, i64 0, i32 3
57+
%7 = bitcast i32 addrspace(4)* addrspace(4)* %d.i to i8 addrspace(4)*
58+
%8 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %7, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 8, i8* bitcast ({ [15 x i8]*, [2 x i8]*, [22 x i8]*, [5 x i8]* }* @.args.8 to i8*)) #2
59+
; CHECK: %{{.*}} = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @[[NewAnnotStr1]], i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 8, i8* null)
60+
%e.i = getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %x.ascast.i, i64 0, i32 4
61+
%9 = bitcast i32 addrspace(4)* addrspace(4)* %e.i to i8 addrspace(4)*
62+
%10 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %9, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 9, i8* bitcast ({ [15 x i8]*, [2 x i8]*, [18 x i8]*, i8* }* @.args.10 to i8*)) #2
63+
; CHECK: %{{.*}} = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @[[NewAnnotStr2]], i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 9, i8* null)
64+
%f.i = getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %x.ascast.i, i64 0, i32 5
65+
%11 = bitcast i32 addrspace(4)* addrspace(4)* %f.i to i8 addrspace(4)*
66+
%12 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 10, i8* bitcast ({ [18 x i8]*, i8* }* @.args.11 to i8*)) #2
67+
; CHECK-NOT: %{{.*}} = call i8 addrspace(4)* @llvm.ptr.annotation.
68+
%g.i = getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %x.ascast.i, i64 0, i32 6
69+
%13 = bitcast i32 addrspace(4)* addrspace(4)* %g.i to i8 addrspace(4)*
70+
%14 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)* %13, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i32 11, i8* null) #2
71+
ret void
72+
}
73+
74+
; Function Attrs: inaccessiblememonly nofree nosync nounwind willreturn
75+
declare i8 addrspace(4)* @llvm.ptr.annotation.p4i8(i8 addrspace(4)*, i8*, i8*, i32, i8*) #1
76+
77+
attributes #0 = { mustprogress norecurse "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "sycl-module-id"="sycl-properties-ptr-annotations.cpp" "uniform-work-group-size"="true" }
78+
attributes #1 = { inaccessiblememonly nofree nosync nounwind willreturn }
79+
attributes #2 = { nounwind }
80+
81+
!opencl.spir.version = !{!0, !0, !0, !0, !0, !0}
82+
!spirv.Source = !{!1, !1, !1, !1, !1, !1}
83+
!llvm.ident = !{!2, !3, !3, !3, !4, !3}
84+
!llvm.module.flags = !{!5, !6}
85+
86+
!0 = !{i32 1, i32 2}
87+
!1 = !{i32 4, i32 100000}
88+
!2 = !{!"clang version 15.0.0"}
89+
!3 = !{!"clang version 15.0.0"}
90+
!4 = !{!"clang version 15.0.0"}
91+
!5 = !{i32 1, !"wchar_size", i32 4}
92+
!6 = !{i32 7, !"frame-pointer", i32 2}
93+
!7 = !{}

0 commit comments

Comments
 (0)