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) {
1042
1042
}
1043
1043
1044
1044
static 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())) {
1046
1051
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";
1048
1054
return true;
1049
1055
}
1050
1056
return false;
Original file line number Diff line number Diff line change 4
4
// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
5
5
// RUN: %clang_cc1 %s -cl-std=CL2.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS="const volatile"
6
6
// 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
8
8
// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir-unknown-unknown" -verify -pedantic -fsyntax-only -DB32 -DQUALS="const volatile"
9
9
// RUN: %clang_cc1 %s -cl-std=CL3.0 -triple "spir64-unknown-unknown" -verify -pedantic -fsyntax-only -Wconversion -DWCONV -DQUALS=
10
10
// 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)
241
241
kernel void foo1 (global unsigned int * buf )
242
242
{
243
243
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}}
245
245
}
246
246
247
247
kernel void bar1 (global unsigned int * buf )
248
248
{
249
249
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}}
251
251
}
252
252
#endif // ifdef cl_khr_subgroups
You can’t perform that action at this time.
0 commit comments