Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion clang/include/clang/Basic/OpenCLExtensions.def
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 200)
OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 200)
OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 200)
OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 200)
OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 200)
OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 200)
OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 200)
OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 200)
Expand Down Expand Up @@ -140,7 +141,8 @@ OPENCL_EXTENSION(cl_amd_media_ops, true, 100)
OPENCL_EXTENSION(cl_amd_media_ops2, true, 100)

// Intel OpenCL extensions
OPENCL_EXTENSION(cl_intel_bfloat16_conversion, false, 100)
OPENCL_EXTENSION(cl_intel_bfloat16_conversions, false, 100)
OPENCL_EXTENSION(cl_intel_required_subgroup_size, false, 200)
OPENCL_EXTENSION(cl_intel_subgroups, true, 120)
OPENCL_EXTENSION(cl_intel_subgroups_char, true, 120)
OPENCL_EXTENSION(cl_intel_subgroups_long, true, 120)
Expand Down
58 changes: 56 additions & 2 deletions clang/test/SemaOpenCL/extension-version.cl
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_extended_types' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_extended_types : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_named_barrier
#error "Missing cl_khr_subgroup_named_barrier define"
#endif
#else
#ifdef cl_khr_subgroup_named_barrier
#error "Incorrect cl_khr_subgroup_named_barrier define"
#endif
#endif
// expected-warning@+1{{OpenCL extension 'cl_khr_subgroup_named_barrier' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_named_barrier : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_khr_subgroup_non_uniform_arithmetic
#error "Missing cl_khr_subgroup_non_uniform_arithmetic define"
Expand Down Expand Up @@ -332,16 +344,37 @@
#pragma OPENCL EXTENSION cl_khr_depth_images : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 100)
#ifndef cl_intel_bfloat16_conversion
#error "Missing cl_intel_bfloat16_conversion define"
#ifndef cl_intel_bfloat16_conversions
#error "Missing cl_intel_bfloat16_conversions define"
#endif
#else
#ifdef cl_intel_bfloat16_conversions
#error "Incorrect cl_intel_bfloat16_conversions define"
#endif
#endif
// expected-warning@+1{{OpenCL extension 'cl_intel_bfloat16_conversions' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_intel_bfloat16_conversions : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
#ifndef cl_intel_required_subgroup_size
#error "Missing cl_intel_required_subgroup_size define"
#endif
#else
#ifdef cl_intel_required_subgroup_size
#error "Incorrect cl_intel_required_subgroup_size define"
#endif
#endif
// expected-warning@+1{{OpenCL extension 'cl_intel_required_subgroup_size' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_intel_required_subgroup_size : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120)
#ifndef cl_intel_subgroups
#error "Missing cl_intel_subgroups define"
#endif
#else
#ifdef cl_intel_subgroups
#error "Incorrect cl_intel_subgroups define"
#endif
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups' - ignoring}}
#endif
#pragma OPENCL EXTENSION cl_intel_subgroups : enable
Expand All @@ -351,6 +384,9 @@
#error "Missing cl_intel_subgroups_char define"
#endif
#else
#ifdef cl_intel_subgroups_char
#error "Incorrect cl_intel_subgroups_char define"
#endif
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups_char' - ignoring}}
#endif
#pragma OPENCL EXTENSION cl_intel_subgroups_char : enable
Expand All @@ -360,6 +396,9 @@
#error "Missing cl_intel_subgroups_long define"
#endif
#else
#ifdef cl_intel_subgroups_long
#error "Incorrect cl_intel_subgroups_long define"
#endif
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups_long' - ignoring}}
#endif
#pragma OPENCL EXTENSION cl_intel_subgroups_long : enable
Expand All @@ -369,6 +408,9 @@
#error "Missing cl_intel_subgroups_short define"
#endif
#else
#ifdef cl_intel_subgroups_short
#error "Incorrect cl_intel_subgroups_short define"
#endif
// expected-warning@+2{{unsupported OpenCL extension 'cl_intel_subgroups_short' - ignoring}}
#endif
#pragma OPENCL EXTENSION cl_intel_subgroups_short : enable
Expand All @@ -377,13 +419,25 @@
#ifndef cl_intel_subgroup_buffer_prefetch
#error "Missing cl_intel_subgroup_buffer_prefetch define"
#endif
#else
#ifdef cl_intel_subgroup_buffer_prefetch
#error "Incorrect cl_intel_subgroup_buffer_prefetch define"
#endif
#endif
// expected-warning@+1{{OpenCL extension 'cl_intel_subgroup_buffer_prefetch' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_intel_subgroup_buffer_prefetch : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120)
#ifndef cl_intel_subgroup_local_block_io
#error "Missing cl_intel_subgroup_local_block_io define"
#endif
#else
#ifdef cl_intel_subgroup_local_block_io
#error "Incorrect cl_intel_subgroup_local_block_io define"
#endif
#endif
// expected-warning@+1{{OpenCL extension 'cl_intel_subgroup_local_block_io' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_intel_subgroup_local_block_io : enable

#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120)
#ifndef cl_intel_device_side_avc_motion_estimation
Expand Down
62 changes: 62 additions & 0 deletions clang/test/SemaOpenCL/intel-unsupported-extensions.cl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -finclude-default-header -cl-std=CL3.0 -cl-ext=-cl_intel_subgroups,-cl_intel_subgroup_buffer_prefetch,-cl_intel_subgroups_char,-cl_intel_subgroups_short,-cl_intel_subgroups_long,-cl_intel_bfloat16_conversions,-cl_intel_subgroup_local_block_io,-cl_intel_device_side_avc_motion_estimation %s
// RUN: %clang_cc1 -triple spir-unknown-unknown -verify -finclude-default-header -cl-std=CL3.0 %s

#if defined(cl_intel_subgroups) && defined(cl_intel_subgroup_buffer_prefetch) && defined(cl_intel_subgroups_char) && defined(cl_intel_subgroups_short) && defined(cl_intel_subgroups_long) && defined(cl_intel_bfloat16_conversions) && defined(cl_intel_subgroup_local_block_io) && defined(cl_intel_device_side_avc_motion_estimation)
// expected-no-diagnostics
#endif

uint test1(read_only image2d_t im, int2 i) {
return intel_sub_group_block_read(im, i);
}
#if !defined(cl_intel_subgroups)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_block_read'}}
#endif

void test2(const __global uint *p) {
return intel_sub_group_block_prefetch_ui(p);
}
#if !defined(cl_intel_subgroup_buffer_prefetch)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_block_prefetch_ui'}}
#endif

uchar test4(read_only image2d_t im, int2 i) {
return intel_sub_group_block_read_uc(im, i);
}
#if !defined(cl_intel_subgroups_char)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_block_read_uc'}}
#endif

ushort test5(const __local ushort* p) {
return intel_sub_group_block_read_us(p);
}
#if !defined(cl_intel_subgroups_short)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_block_read_us'}}
#endif

ulong test6(const __global ulong* p) {
return intel_sub_group_block_read_ul(p);
}
#if !defined(cl_intel_subgroups_long)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_block_read_ul'}}
#endif

ushort test7(float f) {
return intel_convert_bfloat16_as_ushort(f);
}
#if !defined(cl_intel_bfloat16_conversions)
// expected-error@-3{{use of undeclared identifier 'intel_convert_bfloat16_as_ushort'}}
#endif

uint test8(const __local uint* p) {
return intel_sub_group_block_read(p);
}
#if !defined(cl_intel_subgroup_local_block_io)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_block_read'}}
#endif

uchar test9(uchar slice_type, uchar qp) {
return intel_sub_group_avc_mce_get_default_inter_base_multi_reference_penalty(slice_type, qp);
}
#if !defined(cl_intel_device_side_avc_motion_estimation)
// expected-error@-3{{use of undeclared identifier 'intel_sub_group_avc_mce_get_default_inter_base_multi_reference_penalty'}}
#endif
Loading