[clang] 58d18dd - [OpenCL] Remove pragma requirement from Arm dot extension.

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Wed May 12 08:25:45 PDT 2021


Author: Anastasia Stulova
Date: 2021-05-12T16:25:33+01:00
New Revision: 58d18dde5cca3417e3d52670775c95d2f6fe9d05

URL: https://github.com/llvm/llvm-project/commit/58d18dde5cca3417e3d52670775c95d2f6fe9d05
DIFF: https://github.com/llvm/llvm-project/commit/58d18dde5cca3417e3d52670775c95d2f6fe9d05.diff

LOG: [OpenCL] Remove pragma requirement from Arm dot extension.

This removed the pointless need for extension pragma since
it doesn't disable anything properly and it doesn't need to
enable anything that is not possible to disable.

The change doesn't break existing kernels since it allows to
compile more cases i.e. without pragma statements but the
pragma continues to be accepted.

Differential Revision: https://reviews.llvm.org/D100985

Added: 
    

Modified: 
    clang/lib/Headers/opencl-c.h
    clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
    clang/test/SemaOpenCL/arm-integer-dot-product.cl

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 62dbe459baa76..dcd325528f38b 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -16996,31 +16996,23 @@ uint16 __ovld amd_sadw(uint16 src0, uint16 src1, uint16 src2);
 #endif // cl_amd_media_ops2
 
 #if defined(cl_arm_integer_dot_product_int8)
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : begin
 uint __ovld arm_dot(uchar4 a, uchar4 b);
 int __ovld arm_dot(char4 a, char4 b);
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : end
 #endif // defined(cl_arm_integer_dot_product_int8)
 
 #if defined(cl_arm_integer_dot_product_accumulate_int8)
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : begin
 uint __ovld arm_dot_acc(uchar4 a, uchar4 b, uint c);
 int __ovld arm_dot_acc(char4 a, char4 b, int c);
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : end
 #endif // defined(cl_arm_integer_dot_product_accumulate_int8)
 
 #if defined(cl_arm_integer_dot_product_accumulate_int16)
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : begin
 uint __ovld arm_dot_acc(ushort2 a, ushort2 b, uint c);
 int __ovld arm_dot_acc(short2 a, short2 b, int c);
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : end
 #endif // defined(cl_arm_integer_dot_product_accumulate_int16)
 
 #if defined(cl_arm_integer_dot_product_accumulate_saturate_int8)
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : begin
 uint __ovld arm_dot_acc_sat(uchar4 a, uchar4 b, uint c);
 int __ovld arm_dot_acc_sat(char4 a, char4 b, int c);
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : end
 #endif // defined(cl_arm_integer_dot_product_accumulate_saturate_int8)
 
 // Disable any extensions we may have enabled previously.

diff  --git a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
index a4d28c7e6cf8f..c98615c5dd988 100644
--- a/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
+++ b/clang/test/CodeGenOpenCL/arm-integer-dot-product.cl
@@ -1,38 +1,39 @@
 // RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -fdeclare-opencl-builtins -cl-std=CL1.2 -emit-llvm -o - -O0 | FileCheck %s
 
+// Pragmas are only accepted for backward compatibility.
+
 #pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : enable
+#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : disable
 void test_int8(uchar4 ua, uchar4 ub, char4 sa, char4 sb) {
     uint ur = arm_dot(ua, ub);
     // CHECK: call spir_func i32 @_Z7arm_dotDv4_hS_
     int sr = arm_dot(sa, sb);
     // CHECK: call spir_func i32 @_Z7arm_dotDv4_cS_
 }
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_int8 : disable
 
 #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : enable
+#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : disable
 void test_accumulate_int8(uchar4 ua, uchar4 ub, uint uc, char4 sa, char4 sb, int c) {
     uint ur = arm_dot_acc(ua, ub, uc);
     // CHECK: call spir_func i32 @_Z11arm_dot_accDv4_hS_j
     int sr = arm_dot_acc(sa, sb, c);
     // CHECK: call spir_func i32 @_Z11arm_dot_accDv4_cS_i
 }
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int8 : disable
 
 #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : enable
+#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : disable
 void test_accumulate_int16(ushort2 ua, ushort2 ub, uint uc, short2 sa, short2 sb, int c) {
     uint ur = arm_dot_acc(ua, ub, uc);
     // CHECK: call spir_func i32 @_Z11arm_dot_accDv2_tS_j
     int sr = arm_dot_acc(sa, sb, c);
     // CHECK: call spir_func i32 @_Z11arm_dot_accDv2_sS_i
 }
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_int16 : disable
 
 #pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : enable
+#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : disable
 void test_accumulate_saturate_int8(uchar4 ua, uchar4 ub, uint uc, char4 sa, char4 sb, int c) {
     uint ur = arm_dot_acc_sat(ua, ub, uc);
     // CHECK: call spir_func i32 @_Z15arm_dot_acc_satDv4_hS_j
     int sr = arm_dot_acc_sat(sa, sb, c);
     // CHECK: call spir_func i32 @_Z15arm_dot_acc_satDv4_cS_i
 }
-#pragma OPENCL EXTENSION cl_arm_integer_dot_product_accumulate_saturate_int8 : disable
-

diff  --git a/clang/test/SemaOpenCL/arm-integer-dot-product.cl b/clang/test/SemaOpenCL/arm-integer-dot-product.cl
index d7219d7402a90..5552f77779547 100644
--- a/clang/test/SemaOpenCL/arm-integer-dot-product.cl
+++ b/clang/test/SemaOpenCL/arm-integer-dot-product.cl
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header -verify -cl-std=CL1.2 -emit-llvm -o - -O0
+// RUN: %clang_cc1 %s -triple spir-unknown-unknown -finclude-default-header  -fdeclare-opencl-builtins -verify -cl-std=CL1.2 -emit-llvm -o - -cl-ext=-all
 
 void test_negative() {
     uchar4 ua8, ub8;
@@ -7,37 +7,13 @@ void test_negative() {
     short2 sa16, sb16;
     uint ur;
     int sr;
-    ur = arm_dot(ua8, ub8); // expected-error{{no matching function for call to 'arm_dot'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_int8' to be enabled}}
-    sr = arm_dot(sa8, sb8); // expected-error{{no matching function for call to 'arm_dot'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_int8' to be enabled}}
-    ur = arm_dot_acc(ua8, ub8, ur); // expected-error{{no matching function for call to 'arm_dot_acc'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int8' to be enabled}}
-    sr = arm_dot_acc(sa8, sb8, sr); // expected-error{{no matching function for call to 'arm_dot_acc'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int8' to be enabled}}
-    ur = arm_dot_acc(ua16, ub16, ur); // expected-error{{no matching function for call to 'arm_dot_acc'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int16' to be enabled}}
-    sr = arm_dot_acc(sa16, sb16, sr); // expected-error{{no matching function for call to 'arm_dot_acc'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_int16' to be enabled}}
-    ur = arm_dot_acc_sat(ua8, ub8, ur); // expected-error{{no matching function for call to 'arm_dot_acc_sat'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_saturate_int8' to be enabled}}
-    sr = arm_dot_acc_sat(sa8, sb8, sr); // expected-error{{no matching function for call to 'arm_dot_acc_sat'}}
-    // expected-note at opencl-c.h:* {{candidate function not viable}}
-    // expected-note at opencl-c.h:* {{candidate unavailable as it requires OpenCL extension 'cl_arm_integer_dot_product_accumulate_saturate_int8' to be enabled}}
+    ur = arm_dot(ua8, ub8); // expected-error{{implicit declaration of function 'arm_dot' is invalid in OpenCL}}
+    sr = arm_dot(sa8, sb8);
+    ur = arm_dot_acc(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc' is invalid in OpenCL}} //expected-note{{'arm_dot_acc' declared here}}
+    sr = arm_dot_acc(sa8, sb8, sr);
+    ur = arm_dot_acc(ua16, ub16, ur);
+    sr = arm_dot_acc(sa16, sb16, sr);
+    ur = arm_dot_acc_sat(ua8, ub8, ur); // expected-error{{implicit declaration of function 'arm_dot_acc_sat' is invalid in OpenCL}} //expected-note{{did you mean 'arm_dot_acc'?}}
+    sr = arm_dot_acc_sat(sa8, sb8, sr);
 }
 


        


More information about the cfe-commits mailing list