Page MenuHomePhabricator

[OpenCL] Stop opencl-c-base.h leaking extension enabling

Authored by svenvh on Nov 13 2020, 7:46 AM.



opencl-c.h disables all extensions at its end, but opencl-c-base.h
does not, and that causes any inclusion of only opencl-c-base.h to
leave some extensions (such as cl_khr_fp16) enabled. This affects the
-fdeclare-opencl-builtins option for example.

This violates the OpenCL Extension Specification which specifies that
"The initial state of the compiler is as if the directive #pragma
OPENCL EXTENSION all : disable was issued".

Fix by disabling all extensions at the end of opencl-c-base.h and
enable extensions inside opencl.h which relied on opencl-c-base.h
enabling the cl_khr_fp16/64 extensions.

Diff Detail

Event Timeline

svenvh created this revision.Nov 13 2020, 7:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 13 2020, 7:46 AM
Herald added a subscriber: yaxunl. · View Herald Transcript
svenvh requested review of this revision.Nov 13 2020, 7:46 AM
Anastasia accepted this revision.Nov 13 2020, 8:01 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Nov 13 2020, 8:01 AM

LGMT as it reduces the divergence in compilation flows. I let @Anastasia, or someone else more familiar with the codebase, give the final approval though.

This revision was landed with ongoing or failed builds.Nov 17 2020, 4:08 AM
This revision was automatically updated to reflect the committed changes.