Page MenuHomePhabricator

[OpenCL] Guard all half float usage based on cl_khr_fp16 extension
AbandonedPublic

Authored by jerryct on May 6 2018, 3:42 AM.

Details

Reviewers
yaxunl
Anastasia
Summary

Hi,

this patch guards all missed half float functions based on the availabiltiy of the OpenCL extension cl_khr_fp16.

Best regards,

Jerry

Diff Detail

Repository
rC Clang

Event Timeline

jerryct created this revision.May 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
yaxunl added a comment.May 7 2018, 8:27 AM

Only halfn type requires cl_khr_fp16. These functions do not use halfn type, therefore cl_khr_fp16 is not required.

Only halfn type requires cl_khr_fp16. These functions do not use halfn type, therefore cl_khr_fp16 is not required.

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.

Could you upload the full diff please, otherwise it's not easy to see all the functions guarded by the macro.

bader added a subscriber: bader.May 23 2018, 4:18 AM
bader added inline comments.
lib/Headers/opencl-c.h
12097

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.

jerryct abandoned this revision.Feb 2 2019, 12:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 2 2019, 12:55 AM
Herald added a subscriber: jfb. · View Herald Transcript