Hi,
this patch guards all missed half float functions based on the availabiltiy of the OpenCL extension cl_khr_fp16.
Best regards,
Jerry
Differential D46501
[OpenCL] Guard all half float usage based on cl_khr_fp16 extension AbandonedPublic Authored by jerryct on May 6 2018, 3:42 AM.
Details
Diff Detail
Event TimelineHerald added subscribers: cfe-commits, Anastasia, yaxunl. · View Herald TranscriptMay 6 2018, 3:42 AM jerryct retitled this revision from OpenCL Header: Guard all half float usage based on cl_khr_fp16 extension to [OpenCL] Guard all half float usage based on cl_khr_fp16 extension.May 6 2018, 3:48 AM Comment Actions Only halfn type requires cl_khr_fp16. These functions do not use halfn type, therefore cl_khr_fp16 is not required. Comment Actions
I think the extension is for all half https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/cl_khr_fp16.html This extension adds support for half scalar and vector types as built-in types that can be used for arithmetic operations, conversions, etc. An application that wants to use half and halfn types will need to include the directive shown above. Comment Actions Could you upload the full diff please, otherwise it's not easy to see all the functions guarded by the macro. bader added inline comments.
Revision Contents
Diff 145397 lib/Headers/opencl-c.h |
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.