[PATCH] D24666: [OpenCL] Allow half type kernel argument when cl_khr_fp16 is enabled

Alexey Bader via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 16 11:11:36 PDT 2016


bader added inline comments.

================
Comment at: lib/Sema/SemaDecl.cpp:7599-7602
@@ -7595,3 +7598,6 @@
     // of event_t type.
-    S.Diag(Param->getLocation(), diag::err_bad_kernel_param_type) << PT;
+    // Do not diagnose half type since it is diagnosed as invalid argument
+    // type for any function eleswhere.
+    if (!PT->isHalfType())
+      S.Diag(Param->getLocation(), diag::err_bad_kernel_param_type) << PT;
     D.setInvalidType();
----------------
It looks strange to me. First we check if parameter type is half - we set InvalidKernelParam status, later we check again and do not report an error.
I think it would be simpler just return ValidKernelParam for half data type from getOpenCLKernelParameterType,

I think the whole patch should two deleted lines from getOpenCLKernelParameterType function + test case.


https://reviews.llvm.org/D24666





More information about the cfe-commits mailing list