Skip to content

Commit 3ec82e5

Browse files
author
Anastasia Stulova
committed
[OpenCL] Prevent adding vendor extensions for all targets
Removed extension begin/end pragma as it has no effect and it is added unconditionally for all targets. Differential Revision: https://reviews.llvm.org/D92244
1 parent a1a2a8e commit 3ec82e5

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

clang/lib/Headers/opencl-c-base.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,6 @@ int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)))
567567
#endif
568568

569569
#ifdef cl_intel_device_side_avc_motion_estimation
570-
#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : begin
571570

572571
#define CLK_AVC_ME_MAJOR_16x16_INTEL 0x0
573572
#define CLK_AVC_ME_MAJOR_16x8_INTEL 0x1
@@ -701,7 +700,6 @@ int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)))
701700
#define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMOUT_INITIALIZE_INTEL 0x0
702701
#define CLK_AVC_IME_RESULT_DUAL_REFERENCE_STREAMIN_INITIALIZE_INTEL 0x0
703702

704-
#pragma OPENCL EXTENSION cl_intel_device_side_avc_motion_estimation : end
705703
#endif // cl_intel_device_side_avc_motion_estimation
706704

707705
// Disable any extensions we may have enabled previously.

clang/lib/Headers/opencl-c.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
#endif //cl_khr_3d_image_writes
2424
#endif //__OPENCL_C_VERSION__ < CL_VERSION_2_0
2525

26-
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
26+
27+
#if (defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)) && defined(__SPIR__)
2728
#pragma OPENCL EXTENSION cl_intel_planar_yuv : begin
2829
#pragma OPENCL EXTENSION cl_intel_planar_yuv : end
29-
#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
30+
#endif // (defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)) && defined(__SPIR__)
3031

3132
#define __ovld __attribute__((overloadable))
3233
#define __conv __attribute__((convergent))

clang/test/Headers/opencl-c-header.cl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,17 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
8989

9090
// Check that extension macros are defined correctly.
9191

92-
// FIXME: this should not be defined for all targets
93-
// Verify that non-builtin cl_intel_planar_yuv extension is defined from
94-
// OpenCL 1.2 onwards.
92+
// For SPIR all extensions are supported.
93+
#if defined(__SPIR__)
94+
95+
// Verify that cl_intel_planar_yuv extension is defined from OpenCL 1.2 onwards.
9596
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
9697
// expected-no-diagnostics
9798
#else //__OPENCL_C_VERSION__
9899
// expected-warning@+2{{unknown OpenCL extension 'cl_intel_planar_yuv' - ignoring}}
99100
#endif //__OPENCL_C_VERSION__
100101
#pragma OPENCL EXTENSION cl_intel_planar_yuv : enable
101102

102-
// For SPIR all extensions are supported.
103-
#if defined(__SPIR__)
104-
105103
#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
106104

107105
#if cl_khr_subgroup_extended_types != 1

0 commit comments

Comments
 (0)