Author: Wenju He Date: 2026-07-16T17:15:10+08:00 New Revision: 2b8125c686614ffc5c5f8cde007cd6ddcf6649d8
URL: https://github.com/llvm/llvm-project/commit/2b8125c686614ffc5c5f8cde007cd6ddcf6649d8 DIFF: https://github.com/llvm/llvm-project/commit/2b8125c686614ffc5c5f8cde007cd6ddcf6649d8.diff LOG: [Clang][OpenCL] Promote a few extensions to OpenCL 3.1 core (#204330) Following 6 OpenCL extensions are promoted to core features in 3.1: https://github.com/KhronosGroup/OpenCL-Docs/commit/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 Added: clang/test/Misc/amdgcn.unsupported_core_3.1.cl Modified: clang/docs/ReleaseNotes.md clang/include/clang/Basic/OpenCLExtensions.def clang/test/SemaOpenCL/extension-version.cl Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md index 07e9d4a554dd1..052838ef0af0d 100644 --- a/clang/docs/ReleaseNotes.md +++ b/clang/docs/ReleaseNotes.md @@ -159,6 +159,12 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the ### OpenCL Specific Changes +- Extensions ``cl_khr_extended_bit_ops``, ``cl_khr_integer_dot_product``, + ``cl_khr_subgroup_extended_types``, ``cl_khr_subgroup_rotate``, + ``cl_khr_subgroup_shuffle``, and ``cl_khr_subgroup_shuffle_relative`` are + promoted to core features in OpenCL C 3.1. A target claiming OpenCL C 3.1 + conformance without supporting one of these features is now diagnosed. + ### Target Specific Changes #### AMDGPU Support diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def index 08ac5f692616a..f8af9b843f95f 100644 --- a/clang/include/clang/Basic/OpenCLExtensions.def +++ b/clang/include/clang/Basic/OpenCLExtensions.def @@ -69,23 +69,23 @@ OPENCL_EXTENSION(cl_khr_fp16, true, 100) OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100) OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100) OPENCL_EXTENSION(cl_khr_depth_images, true, 100) -OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 100) +OPENCL_COREFEATURE(cl_khr_extended_bit_ops, false, 100, OCL_C_31) OPENCL_EXTENSION(cl_ext_float_atomics, false, 100) OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, true, 100) -OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 100) +OPENCL_COREFEATURE(cl_khr_integer_dot_product, false, 100, OCL_C_31) OPENCL_EXTENSION(cl_khr_kernel_clock, false, 100) OPENCL_EXTENSION(cl_khr_mipmap_image, true, 100) OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 100) OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 100) OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 100) OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 100) -OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 100) +OPENCL_COREFEATURE(cl_khr_subgroup_extended_types, false, 100, OCL_C_31) OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 100) OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 100) OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 100) -OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 100) -OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 100) -OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 100) +OPENCL_COREFEATURE(cl_khr_subgroup_rotate, false, 100, OCL_C_31) +OPENCL_COREFEATURE(cl_khr_subgroup_shuffle_relative, false, 100, OCL_C_31) +OPENCL_COREFEATURE(cl_khr_subgroup_shuffle, false, 100, OCL_C_31) OPENCL_EXTENSION(cl_khr_subgroups, true, 100) OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30) @@ -117,8 +117,8 @@ OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unorm_int_2_101010, false, 200, OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unsigned_10x6_12x4_14x2, false, 200, OCL_C_20) OPENCL_GENERIC_EXTENSION(__opencl_c_generic_address_space, false, 200, OCL_C_20, OCL_C_30) OPENCL_GENERIC_EXTENSION(__opencl_c_images, false, 200, OCL_C_20, OCL_C_30) -OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit, false, 200, OCL_C_20) -OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit_packed, false, 200, OCL_C_20) +OPENCL_GENERIC_EXTENSION(__opencl_c_integer_dot_product_input_4x8bit, false, 200, OCL_C_31, OCL_C_20) +OPENCL_GENERIC_EXTENSION(__opencl_c_integer_dot_product_input_4x8bit_packed, false, 200, OCL_C_31, OCL_C_20) OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_device, false, 200, OCL_C_20) OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_sub_group, false, 200, OCL_C_20) OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_work_group, false, 200, OCL_C_20) diff --git a/clang/test/Misc/amdgcn.unsupported_core_3.1.cl b/clang/test/Misc/amdgcn.unsupported_core_3.1.cl new file mode 100644 index 0000000000000..5a406670777ae --- /dev/null +++ b/clang/test/Misc/amdgcn.unsupported_core_3.1.cl @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -cl-std=CL3.1 -triple amdgcn-amd-amdhsa -Wpedantic-core-features %s 2>&1 | FileCheck %s + +// CHECK: cl_khr_extended_bit_ops is a core feature in OpenCL C version 3.1 but not supported on this target +// CHECK: cl_khr_integer_dot_product is a core feature in OpenCL C version 3.1 but not supported on this target +// CHECK: cl_khr_subgroup_extended_types is a core feature in OpenCL C version 3.1 but not supported on this target +// CHECK: cl_khr_subgroup_rotate is a core feature in OpenCL C version 3.1 but not supported on this target +// CHECK: cl_khr_subgroup_shuffle_relative is a core feature in OpenCL C version 3.1 but not supported on this target +// CHECK: cl_khr_subgroup_shuffle is a core feature in OpenCL C version 3.1 but not supported on this target diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl index a02dbb93a535d..ee53b345a7eb2 100644 --- a/clang/test/SemaOpenCL/extension-version.cl +++ b/clang/test/SemaOpenCL/extension-version.cl @@ -4,12 +4,14 @@ // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=clc++ %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple spir-unknown-unknown +// RUN: %clang_cc1 -x cl -cl-std=CL3.1 %s -verify -triple spir-unknown-unknown // RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=clc++ %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES +// RUN: %clang_cc1 -x cl -cl-std=CL3.1 %s -verify -triple spir-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES // Extensions in all versions #ifndef cl_clang_storage_class_specifiers _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
