Skip to content

Commit a364383

Browse files
authored
[SYCL] Add DPCPP_ENABLE_OPAQUE_POINTERS option (#6378)
This option controls the default behavior of LLVM projects regarding opaque pointers. The default value is OFF as most of the SYCL compiler components are not ready to handle opaque pointers. This change adds a new nightly job testing SYCL compiler with enabled opaque pointers by default.
1 parent 9488347 commit a364383

File tree

25 files changed

+125
-93
lines changed

25 files changed

+125
-93
lines changed

.github/workflows/sycl_nightly.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ jobs:
1919
build_configure_extra_args: ''
2020
lts_config: "ocl_gen9;ocl_x64"
2121

22+
ubuntu2004_opaque_pointers_build_test:
23+
if: github.repository == 'intel/llvm'
24+
uses: ./.github/workflows/sycl_linux_build_and_test.yml
25+
with:
26+
build_cache_root: "/__w/"
27+
build_cache_suffix: opaque_pointers
28+
build_artifact_suffix: opaque_pointers
29+
build_configure_extra_args: "--hip --cuda --enable-esimd-emulator --cmake-opt=-DDPCPP_ENABLE_OPAQUE_POINTERS=TRUE"
30+
lts_config: "ocl_gen9;ocl_x64"
31+
2232
windows_default:
2333
name: Windows
2434
if: github.repository == 'intel/llvm'

clang/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,11 @@ option(CLANG_DEFAULT_PIE_ON_LINUX "Default to -fPIE and -pie on linux-gnu" OFF)
255255
set(CLANG_ENABLE_OPAQUE_POINTERS "DEFAULT" CACHE STRING
256256
"Enable opaque pointers by default")
257257
if(CLANG_ENABLE_OPAQUE_POINTERS STREQUAL "DEFAULT")
258-
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
258+
if(DPCPP_ENABLE_OPAQUE_POINTERS)
259+
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
260+
else()
261+
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL OFF)
262+
endif()
259263
elseif(CLANG_ENABLE_OPAQUE_POINTERS)
260264
set(CLANG_ENABLE_OPAQUE_POINTERS_INTERNAL ON)
261265
else()

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5855,9 +5855,7 @@ defm enable_noundef_analysis : BoolOption<"",
58555855
defm opaque_pointers : BoolOption<"",
58565856
"opaque-pointers",
58575857
CodeGenOpts<"OpaquePointers">,
5858-
// FIXME: Upstream default is DefaultTrue, but llvm-spirv is broken after this
5859-
// change. Override to DefaultFalse until fixed downstream.
5860-
DefaultFalse,
5858+
DefaultTrue,
58615859
PosFlag<SetTrue, [], "Enable">,
58625860
NegFlag<SetFalse, [], "Disable">,
58635861
BothFlags<[], " opaque pointers">>;

clang/test/CodeGenOpenCL/sampled_image.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ __attribute__((overloadable)) void my_read_image(__ocl_sampled_image1d_ro_t img)
55
__attribute__((overloadable)) void my_read_image(__ocl_sampled_image2d_ro_t img);
66

77
void test_read_image(__ocl_sampled_image1d_ro_t img_ro, __ocl_sampled_image2d_ro_t img_2d) {
8-
// CHECK: call void @_Z13my_read_image32__spirv_SampledImage__image1d_ro(%spirv.SampledImage.image1d_ro_t* %{{[0-9]+}})
8+
// CHECK: call void @_Z13my_read_image32__spirv_SampledImage__image1d_ro(ptr %{{[0-9]+}})
99
my_read_image(img_ro);
10-
// CHECK: call void @_Z13my_read_image32__spirv_SampledImage__image2d_ro(%spirv.SampledImage.image2d_ro_t* %{{[0-9]+}})
10+
// CHECK: call void @_Z13my_read_image32__spirv_SampledImage__image2d_ro(ptr %{{[0-9]+}})
1111
my_read_image(img_2d);
1212
}

clang/test/CodeGenSPIRV/intel/is_valid_event.cl

Lines changed: 0 additions & 17 deletions
This file was deleted.

clang/test/CodeGenSPIRV/intel/private-array-initialization.cl

Lines changed: 0 additions & 12 deletions
This file was deleted.

clang/test/CodeGenSYCL/const-wg-init.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ int main() {
1414
kernel_parallel_for_work_group<class kernel>([=](cl::sycl::group<1> G) {
1515
const int WG_CONST = 10;
1616
});
17-
// CHECK: store i32 10, i32 addrspace(4)* addrspacecast (i32 addrspace(3)* @{{.*}}WG_CONST{{.*}} to i32 addrspace(4)*)
18-
// CHECK: %{{[0-9]+}} = call {}* @llvm.invariant.start.p4i8(i64 4, i8 addrspace(4)* addrspacecast (i8 addrspace(3)* bitcast (i32 addrspace(3)* @{{.*}}WG_CONST{{.*}} to i8 addrspace(3)*) to i8 addrspace(4)*))
19-
17+
// CHECK: store i32 10, ptr addrspace(4) addrspacecast (ptr addrspace(3) @{{.*}}WG_CONST{{.*}} to ptr addrspace(4))
18+
// CHECK: %{{[0-9]+}} = call ptr @llvm.invariant.start.p4(i64 4, ptr addrspace(4) addrspacecast (ptr addrspace(3) @{{.*}}WG_CONST{{.*}} to ptr addrspace(4)))
2019
return 0;
2120
}

clang/test/CodeGenSYCL/debug-info-srcpos-kernel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int main() {
2525
}
2626

2727
// CHECK: define{{.*}} spir_kernel {{.*}}19use_kernel_for_test({{.*}}){{.*}} !dbg [[KERNEL:![0-9]+]] {{.*}}{
28-
// CHECK: getelementptr inbounds %class.anon, %class.anon addrspace(4)* %{{.*}}, i32 0, i32 0, !dbg [[LINE_A0:![0-9]+]]
28+
// CHECK: getelementptr inbounds %class.anon, {{.*}}, i32 0, i32 0, !dbg [[LINE_A0:![0-9]+]]
2929
// CHECK: call spir_func void {{.*}}6__init{{.*}} !dbg [[LINE_A0]]
3030
// CHECK: call spir_func void @_ZZ4mainENKUlvE_clEv{{.*}} !dbg [[LINE_B0:![0-9]+]]
3131
// CHECK: ret void, !dbg [[LINE_C0:![0-9]+]]

clang/test/CodeGenSYCL/kernel-annotation.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ class Functor {
2525
// CHECK-SPIR-NOT: annotations =
2626

2727
// CHECK-NVPTX: nvvm.annotations = !{[[FIRST:![0-9]]], [[SECOND:![0-9]]]}
28-
// CHECK-NVPTX: [[FIRST]] = !{void ()* @_ZTS7Functor, !"kernel", i32 1}
29-
// CHECK-NVPTX: [[SECOND]] = !{void ()* @_ZTSZZ4mainENKUlRN2cl4sycl7handlerEE0_clES2_E5foo_2, !"kernel", i32 1}
28+
// CHECK-NVPTX: [[FIRST]] = !{ptr @_ZTS7Functor, !"kernel", i32 1}
29+
// CHECK-NVPTX: [[SECOND]] = !{ptr @_ZTSZZ4mainENKUlRN2cl4sycl7handlerEE0_clES2_E5foo_2, !"kernel", i32 1}
3030

3131
// CHECK-AMDGCN: amdgcn.annotations = !{[[FIRST:![0-9]]], [[SECOND:![0-9]]]}
32-
// CHECK-AMDGCN: [[FIRST]] = !{void ()* @_ZTS7Functor, !"kernel", i32 1}
33-
// CHECK-AMDGCN: [[SECOND]] = !{void ()* @_ZTSZZ4mainENKUlRN2cl4sycl7handlerEE0_clES2_E5foo_2, !"kernel", i32 1}
32+
// CHECK-AMDGCN: [[FIRST]] = !{ptr @_ZTS7Functor, !"kernel", i32 1}
33+
// CHECK-AMDGCN: [[SECOND]] = !{ptr @_ZTSZZ4mainENKUlRN2cl4sycl7handlerEE0_clES2_E5foo_2, !"kernel", i32 1}
3434

3535
int main() {
3636
sycl::queue q;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// REQUIRES: x86-registered-target
22

3+
// FIXME: enable opaque pointers support
4+
// UNSUPPORTED: enable-opaque-pointers
5+
36
//
47
// Check help message.
58
//

0 commit comments

Comments
 (0)