Skip to content

Commit 2b8125c

Browse files
authored
[Clang][OpenCL] Promote a few extensions to OpenCL 3.1 core (#204330)
Following 6 OpenCL extensions are promoted to core features in 3.1: KhronosGroup/OpenCL-Docs@9fff1a87a975 - cl_khr_extended_bit_ops - cl_khr_integer_dot_product - cl_khr_subgroup_extended_types - cl_khr_subgroup_rotate - cl_khr_subgroup_shuffle - cl_khr_subgroup_shuffle_relative A target claiming OpenCL C 3.1 conformance without supporting one of these features is now diagnosed. Updated release notes for the change. Assisted-by: Claude
1 parent c1ba7d0 commit 2b8125c

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

clang/docs/ReleaseNotes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
159159
160160
### OpenCL Specific Changes
161161
162+
- Extensions ``cl_khr_extended_bit_ops``, ``cl_khr_integer_dot_product``,
163+
``cl_khr_subgroup_extended_types``, ``cl_khr_subgroup_rotate``,
164+
``cl_khr_subgroup_shuffle``, and ``cl_khr_subgroup_shuffle_relative`` are
165+
promoted to core features in OpenCL C 3.1. A target claiming OpenCL C 3.1
166+
conformance without supporting one of these features is now diagnosed.
167+
162168
### Target Specific Changes
163169
164170
#### AMDGPU Support

clang/include/clang/Basic/OpenCLExtensions.def

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,23 +69,23 @@ OPENCL_EXTENSION(cl_khr_fp16, true, 100)
6969
OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100)
7070
OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100)
7171
OPENCL_EXTENSION(cl_khr_depth_images, true, 100)
72-
OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 100)
72+
OPENCL_COREFEATURE(cl_khr_extended_bit_ops, false, 100, OCL_C_31)
7373
OPENCL_EXTENSION(cl_ext_float_atomics, false, 100)
7474
OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, true, 100)
75-
OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 100)
75+
OPENCL_COREFEATURE(cl_khr_integer_dot_product, false, 100, OCL_C_31)
7676
OPENCL_EXTENSION(cl_khr_kernel_clock, false, 100)
7777
OPENCL_EXTENSION(cl_khr_mipmap_image, true, 100)
7878
OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 100)
7979
OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 100)
8080
OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 100)
8181
OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 100)
82-
OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 100)
82+
OPENCL_COREFEATURE(cl_khr_subgroup_extended_types, false, 100, OCL_C_31)
8383
OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 100)
8484
OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 100)
8585
OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 100)
86-
OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 100)
87-
OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 100)
88-
OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 100)
86+
OPENCL_COREFEATURE(cl_khr_subgroup_rotate, false, 100, OCL_C_31)
87+
OPENCL_COREFEATURE(cl_khr_subgroup_shuffle_relative, false, 100, OCL_C_31)
88+
OPENCL_COREFEATURE(cl_khr_subgroup_shuffle, false, 100, OCL_C_31)
8989
OPENCL_EXTENSION(cl_khr_subgroups, true, 100)
9090
OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30)
9191

@@ -117,8 +117,8 @@ OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unorm_int_2_101010, false, 200,
117117
OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unsigned_10x6_12x4_14x2, false, 200, OCL_C_20)
118118
OPENCL_GENERIC_EXTENSION(__opencl_c_generic_address_space, false, 200, OCL_C_20, OCL_C_30)
119119
OPENCL_GENERIC_EXTENSION(__opencl_c_images, false, 200, OCL_C_20, OCL_C_30)
120-
OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit, false, 200, OCL_C_20)
121-
OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit_packed, false, 200, OCL_C_20)
120+
OPENCL_GENERIC_EXTENSION(__opencl_c_integer_dot_product_input_4x8bit, false, 200, OCL_C_31, OCL_C_20)
121+
OPENCL_GENERIC_EXTENSION(__opencl_c_integer_dot_product_input_4x8bit_packed, false, 200, OCL_C_31, OCL_C_20)
122122
OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_device, false, 200, OCL_C_20)
123123
OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_sub_group, false, 200, OCL_C_20)
124124
OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_work_group, false, 200, OCL_C_20)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -cl-std=CL3.1 -triple amdgcn-amd-amdhsa -Wpedantic-core-features %s 2>&1 | FileCheck %s
2+
3+
// CHECK: cl_khr_extended_bit_ops is a core feature in OpenCL C version 3.1 but not supported on this target
4+
// CHECK: cl_khr_integer_dot_product is a core feature in OpenCL C version 3.1 but not supported on this target
5+
// CHECK: cl_khr_subgroup_extended_types is a core feature in OpenCL C version 3.1 but not supported on this target
6+
// CHECK: cl_khr_subgroup_rotate is a core feature in OpenCL C version 3.1 but not supported on this target
7+
// CHECK: cl_khr_subgroup_shuffle_relative is a core feature in OpenCL C version 3.1 but not supported on this target
8+
// CHECK: cl_khr_subgroup_shuffle is a core feature in OpenCL C version 3.1 but not supported on this target

clang/test/SemaOpenCL/extension-version.cl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
55
// RUN: %clang_cc1 -x cl -cl-std=clc++ %s -verify -triple spir-unknown-unknown
66
// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple spir-unknown-unknown
7+
// RUN: %clang_cc1 -x cl -cl-std=CL3.1 %s -verify -triple spir-unknown-unknown
78
// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
89
// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
910
// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
1011
// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
1112
// RUN: %clang_cc1 -x cl -cl-std=clc++ %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
1213
// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
14+
// RUN: %clang_cc1 -x cl -cl-std=CL3.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
1315

1416
// Extensions in all versions
1517
#ifndef cl_clang_storage_class_specifiers

0 commit comments

Comments
 (0)