[PATCH] D46501: [OpenCL] Guard all half float usage based on cl_khr_fp16 extension

Alexey Bader via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 23 04:18:34 PDT 2018


bader added inline comments.


================
Comment at: lib/Headers/opencl-c.h:12097
+#ifdef cl_khr_fp16
 float __ovld vload_half(size_t offset, const __constant half *p);
 #if __OPENCL_C_VERSION__ >= CL_VERSION_2_0
----------------
These built-ins are part of the core specification, which doesn't allow using `half` data type directly, but user can declare a pointer to `half` data type and use built-ins like vload_half/vstore_half converting `half` data type to `float` data type.

cl_khr_fp16 enables regular uses of half data types as well as built-ins returning `half` data type instead of `float` - vload/vstore.


Repository:
  rC Clang

https://reviews.llvm.org/D46501





More information about the cfe-commits mailing list