File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -1042,9 +1042,15 @@ static bool checkOpenCLBlockArgs(Sema &S, Expr *BlockArg) {
10421042}
10431043
10441044static bool checkOpenCLSubgroupExt(Sema &S, CallExpr *Call) {
1045- if (!S.getOpenCLOptions().isSupported("cl_khr_subgroups", S.getLangOpts())) {
1045+ // OpenCL device can support extension but not the feature as extension
1046+ // requires subgroup independent forward progress, but subgroup independent
1047+ // forward progress is optional in OpenCL C 3.0 __opencl_c_subgroups feature.
1048+ if (!S.getOpenCLOptions().isSupported("cl_khr_subgroups", S.getLangOpts()) &&
1049+ !S.getOpenCLOptions().isSupported("__opencl_c_subgroups",
1050+ S.getLangOpts())) {
10461051 S.Diag(Call->getBeginLoc(), diag::err_opencl_requires_extension)
1047- << 1 << Call->getDirectCallee() << "cl_khr_subgroups";
1052+ << 1 << Call->getDirectCallee()
1053+ << "cl_khr_subgroups or __opencl_c_subgroups";
10481054 return true;
10491055 }
10501056 return false;
Original file line number Diff line number Diff line change 44// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
55// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
66// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS=
7- // RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS= -cl-ext=-cl_khr_subgroups
7+ // RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS= -cl-ext=-cl_khr_subgroups,-__opencl_c_subgroups
88// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
99// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
1010// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
@@ -241,12 +241,12 @@ kernel void bar(global unsigned int *buf)
241241kernel void foo1 (global unsigned int * buf )
242242{
243243 ndrange_t n ;
244- buf [0 ] = get_kernel_max_sub_group_size_for_ndrange (n , ^( ){}); // expected-error {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups support}}
244+ buf [0 ] = get_kernel_max_sub_group_size_for_ndrange (n , ^( ){}); // expected-error {{use of declaration 'get_kernel_max_sub_group_size_for_ndrange' requires cl_khr_subgroups or __opencl_c_subgroups support}}
245245}
246246
247247kernel void bar1 (global unsigned int * buf )
248248{
249249 ndrange_t n ;
250- buf [0 ] = get_kernel_sub_group_count_for_ndrange (n , ^( ){}); // expected-error {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups support}}
250+ buf [0 ] = get_kernel_sub_group_count_for_ndrange (n , ^( ){}); // expected-error {{use of declaration 'get_kernel_sub_group_count_for_ndrange' requires cl_khr_subgroups or __opencl_c_subgroups support}}
251251}
252252#endif // ifdef cl_khr_subgroups
You can’t perform that action at this time.
0 commit comments